This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Cross MULTILIB libgcc is truncated by AR
- To: egcs-patches at cygnus dot com
- Subject: Cross MULTILIB libgcc is truncated by AR
- From: "Pavel Pisa;research student" <pisa at waltz dot felk dot cvut dot cz>
- Date: Tue, 3 Nov 1998 12:47:17 +0100 (MET)
I have found problem, when compiling cross-compiler egcs-1.1b
for Hitachi H8 architecture. I use binutilst 2.9.1.0.12
with more enabled targets for i586-linux/coff, m68k-coff/elf,
h8300-coff.
This architecture uses MULTILIB. When libgcc-asm is compiled,
some compile passes of libgcc-asm.S results in empty object files
for some machine flags (H8300H/H8300S) and ar truncates not only
added almost empty object file, but also resulting library.
=> compilation fails after some steps, because library is invalid.
May be, that this is mainly bug of my version of AR, which does not work
with empty objects, but these empty object files cannot be extracted
by link from library, because they cannot be referenced by any symbol
so they are garbage any way.
I have patched gcc/Makefile.in such way, that it does not add
object files without external symbols into library. Such files can be
found by nm --extern-only command empty output.
Next patch add this functionality for libgcc1 with hardwired
NM binary name, so it is not clean !!! It should be added to configure
to find right NM binary. May be that same patch should be added to
libgcc2 compilation.
----------------------- cut here ---------------------------------
*** Makefile.in.orig Thu Jul 30 12:52:17 1998
--- Makefile.in Thu Oct 29 13:20:04 1998
*************** libgcc1-asm.a: libgcc2.ready config.stat
*** 973,981 ****
echo $${name}; \
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
! mv libgcc1$(objext) $${name}$(objext); \
! $(AR) $(AR_FLAGS) tmplibgcc1.a $${name}$(objext); \
! rm -f $${name}$(objext); \
done
-rm -f libgcc1.S
mv tmplibgcc1.a libgcc1-asm.a
--- 973,986 ----
echo $${name}; \
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
! tmpfragextsyms=`nm --extern-only libgcc1$(objext)`; \
! if [ -z "$${tmpfragextsyms}" ] ; then \
! echo " empty ignored" ; rm libgcc1$(objext) ; \
! else \
! mv libgcc1$(objext) $${name}$(objext); \
! $(AR) $(AR_FLAGS) tmplibgcc1.a $${name}$(objext); \
! rm -f $${name}$(objext); \
! fi; \
done
-rm -f libgcc1.S
mv tmplibgcc1.a libgcc1-asm.a
------------------------- cut here -------------------------------
Please, say me, if you know better solution or if you do not recommend
this patch.
Pavel Pisa
pisa@cmp.felk.cvut.cz
PS: When reply, CC to my e-mail too