SH4 build failure - The return of `-lc'
Arnaud Lacombe
lacombar@gmail.com
Tue Aug 10 04:44:00 GMT 2010
Hi,
I've been playing with gcc 4.5.1 on sh4, and it failed the following way
/targets/sh4-system-linux-gnu/build/gcc-core-shared/sh4-system-linux-gnu/bin/ld:
cannot find -lc
collect2: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory
`/targets/sh4-system-linux-gnu/build/build-cc-core-shared/sh4-system-linux-gnu/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory
`/targets/sh4-system-linux-gnu/build/build-cc-core-shared'
My quick first fix was to patch the gcc tree:
--- libgcc/config/sh/t-linux 2010-08-10 00:20:56.000000000 -0400
+++ libgcc/config/sh/t-linux.new 2010-08-10 00:21:02.000000000 -0400
@@ -15,7 +15,7 @@
-Wl,--version-script=@shlib_map_file@ \
-o @multilib_dir@/@shlib_base_name@.so.1.tmp @multilib_flags@ \
- @shlib_objs@ -lc && \
+ @shlib_objs@ && \
rm -f @multilib_dir@/@shlib_base_name@.so && \
if [ -f @multilib_dir@/@shlib_base_name@.so.1 ]; then \
Then I noticed the libgcc's `-lc' removal hack in `scripts/cc/gcc.sh'.
The fact is that `libgcc.mvars' does include the -lc, however, it
should not be fixed, `libgcc/config/sh/t-linux' should be. The reason
is that the latter file is made to "Override SHLIB_LINK and
SHLIB_INSTALL to use linker script libgcc_s.so."[0]. Unfortunately,
this file is directly sourced from libgcc' Makefile, so the only way
to fix it, from a runtime point of view would be to:
% cd "${CT_BUILD_DIR}/build-cc-core-shared/${CT_TARGET}/libgcc/"
% tmake_file=$(sed '/^tmake_file.*$(srcdir)/!d; s///' Makefile)
% sed 's/-lc//'
"${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libgcc/$t{make_file}" >
overridden_tmake_file
% sed 's,\(tmake_file.*=\).*,\1 '$(pwd)'/overridden_tmake_file,'
Makefile > Makefile.new
% mv Makefile.new Makefile
% cd -
Which I personally find gross, but it's working. The other way is the
patch, but upstream is unlikely to consider it... unless I dig this
`-lc' issue, but that might be an occasion to "fix it" for all arch,
not just sh.
comments ?
- Arnaud
[0]: direct quotation from the file
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list