This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Cross compiled GCC wrongly builds dynamic executables
- From: Alastair Hughes <hobbitalastair at yandex dot com>
- To: gcc-help at gcc dot gnu dot org
- Cc: hjl dot tools at gmail dot com
- Date: Sat, 20 Aug 2016 08:35:57 +1200
- Subject: Cross compiled GCC wrongly builds dynamic executables
- Authentication-results: sourceware.org; auth=none
- Authentication-results: mxback5g.mail.yandex.net; dkim=pass header.i=@yandex.com
Hi all!
I am cross compiling GCC to produce a compiler to run on the target machine (ie --build="${_local_triplet}" --host="${_target_triplet}" --target="${_target_triplet}"). The target system is a simple *statically linked* musl-libc based system.
After a recent upgrade to binutils 2.27, the cross compiled cc1 and cc1plus executables where generated as *dynamically linked*, due to a combination of the -rdynamic flag to GCC during the build, and a recent change in binutils (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=bf89386a862ace008f0152bca8bddf996d3993c8, https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=9c1d7a087682074d585253ad38719ec2363eb2b7 - the first commit being problematic).
I am unsure as to whether this is an issue with the GCC build, something that I have configured, or a bug in binutils. Why is -rdynamic being passed when building cc1 and cc1plus? Is that what should be happening, a bug, or a problem with how I have configured GCC?
I've also CC'd the committer in case he can explain.
Regards,
Alastair Hughes