[Bug 231790] objcopy: corrupts relocation entries in big-endian mips64 output when adjusting symbol indexes
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Oct 1 20:40:55 UTC 2018
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231790
--- Comment #7 from Ed Maste <emaste at freebsd.org> ---
In create_file() we create the output ELF object with elf_begin(...,
ELF_C_WRITE_, ...).
It calls _libelf_open_object where we default to the host's endianness for
e_byteorder: e->e_byteorder = LIBELF_PRIVATE(byteorder);
We set the output elf header endianness as appropriate:
if (ecp->oed == ELFDATANONE)
ecp->oed = ieh.e_ident[EI_DATA];
oeh.e_ident[EI_DATA] = ecp->oed;
Then the oeh is passed to gelf_update_ehdr, but it does not update e_byteorder;
this is done in _libelf_resync_elf().
There are several ways this could be addressed - I'm not sure what's best off
hand, but updating e_byteorder in gelf_update_ehdr might be the easiest
short-term fix.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-mips
mailing list