[Rpm-maint] [rpm-software-management/rpm] debug edit build generation is endian dependent when cross-compiling? (#171)
Jeff Johnson
notifications at github.com
Sun Mar 5 17:48:55 UTC 2017
For rpm portability with older versions of elfutils, this harmless sanity check might be useful:
(excuse the different hash functions in use in the patch snippet below)
@@ -1533,40 +1493,12 @@
/* Now format the build ID bits in hex to print out. */
{
const uint8_t * id = (uint8_t *)build_id->d_buf + build_id_offset;
- char hex[build_id_size * 2 + 1];
- int n = snprintf (hex, 3, "%02" PRIx8, id[0]);
- assert (n == 2);
- for (i = 1; i < (int)build_id_size; ++i)
- {
- n = snprintf (&hex[i * 2], 3, "%02" PRIx8, id[i]);
- assert (n == 2);
- }
+ char *hex = pgpHexStr(id, build_id_size);
puts (hex);
+ free(hex);
}
}
-/* It avoided the segment fault while file's bss offset have a large number.
- See https://bugzilla.redhat.com/show_bug.cgi?id=1019707
- https://bugzilla.redhat.com/show_bug.cgi?id=1020842 for detail. */
-void valid_file(int fd)
-{
- Elf *elf = elf_begin (fd, ELF_C_RDWR, NULL);
- if (elf == NULL)
- {
- error (1, 0, "elf_begin: %s", elf_errmsg (-1));
- return;
- }
-
- elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT);
-
- if (elf_update (elf, ELF_C_WRITE) < 0)
- error (1, 0, "elf_update: %s", elf_errmsg (-1));
-
- elf_end (elf);
-
- return;
-}
-
int
main (int argc, char *argv[])
{
@@ -1682,9 +1614,6 @@
exit (1);
}
- /* Make sure the file is valid. */
- valid_file(fd);
-
dso = fdopen_dso (fd, file);
if (dso == NULL)
exit (1);
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/171#issuecomment-284246637
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20170305/d9a178bb/attachment.html>
More information about the Rpm-maint
mailing list