This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Cross-compiling elfutils


Hi,

I'm building elfutils on x86_64 (the "build machine", using the new autotools
terminology) for ARM (the "host machine").

Unfortunately, this fails because the build system emits an ARM binary
i386_gendis, and then attempts to execute this binary on x86_64.

I have a patch to fix this, which defines a FOR_BUILD compiler that's distinct
from the default compiler when cross-compiling, and uses that compiler to build
i386_gendis.

I can provide this patch.  However, there is one more tricky part:

Unfortunately, simply using this compiler to build the i386_gendis sources
isn't sufficient; i386_gendis also expects to have libeu.a linked in, which is
built once and then linked into multiple binaries.  It turns out that the only
thing i386_gendis needs libeu.a for is the xmalloc wrapper and friends, which
provide a helpful call to error() when the call fails.

For my purposes, I just replaced the xmalloc() calls to malloc() to remove
i386_gendis's dependence on libeu.a.  This seems fairly safe, given that unlike
general uses of elfutils this particular usage is not unbounded and is unlikely
to fail memory allocations.  This does seem kind of lame though; I guess an
alternative would be to build libeu.a for both build and host arch when
cross-compiling.  Would removing libeu.a from i386_gendis be acceptable?

Thanks,
Robert

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]