Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Oct 2018 20:40:53 +0000
From:      bugzilla-noreply@freebsd.org
To:        mips@FreeBSD.org
Subject:   [Bug 231790] objcopy: corrupts relocation entries in big-endian mips64 output when adjusting symbol indexes
Message-ID:  <bug-231790-27794-2Q7LKtFH8v@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-231790-27794@https.bugs.freebsd.org/bugzilla/>
References:  <bug-231790-27794@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D231790

--- Comment #7 from Ed Maste <emaste@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 =3D LIBELF_PRIVATE(byteorder);

We set the output elf header endianness as appropriate:
        if (ecp->oed =3D=3D ELFDATANONE)
                ecp->oed =3D ieh.e_ident[EI_DATA];
        oeh.e_ident[EI_DATA]  =3D ecp->oed;

Then the oeh is passed to gelf_update_ehdr, but it does not update e_byteor=
der;
this is done in _libelf_resync_elf().

There are several ways this could be addressed - I'm not sure what's best o=
ff
hand, but updating e_byteorder in gelf_update_ehdr might be the easiest
short-term fix.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-231790-27794-2Q7LKtFH8v>