This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Make libgcc.a symbols .hidden (fix for multilibs)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: cgd at broadcom dot com
- Cc: rth at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Mon, 4 Mar 2002 13:44:32 +0100
- Subject: [PATCH] Make libgcc.a symbols .hidden (fix for multilibs)
- References: <20020226184219.V2204@sunsite.ms.mff.cuni.cz> <20020226103703.B28565@redhat.com> <20020226134139.M2434@devserv.devel.redhat.com> <20020226133011.E28565@redhat.com> <mailpost.1014759057.24070@news-sj1-1> <yov5wuwvrj2a.fsf@broadcom.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Mar 01, 2002 at 02:59:09PM -0800, cgd@broadcom.com wrote:
> At Tue, 26 Feb 2002 21:30:57 +0000 (UTC), "Richard Henderson" wrote:
> > On Tue, Feb 26, 2002 at 01:41:39PM -0500, Jakub Jelinek wrote:
> > > That's what the } " above is there for.
> >
> > Ah, missed that.
> >
> > The patch is ok then, mainline and branch.
>
> This patch appears to have broken at least mips64-elf builds using a
> combined (as described on the gcc web pages) source tree.
> (--target=mips-elf, host is x86-linux.)
>
> The problem manifests itself when building the little-endian mips16(!)
> multilibs:
>
> ./xgcc -B./ -B/home/cgd/proj/gcc-testing/install64/mips64-elf/bin/ -isystem /home/cgd/proj/gcc-testing/install64/mips64-elf/include -isystem /home/cgd/proj/gcc-testing/install64/mips64-elf/sys-include -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -G 0 -g1 -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I/home/cgd/proj/gcc-testing/combined/gcc -I/home/cgd/proj/gcc-testing/combined/gcc/. -I/home/cgd/proj/gcc-testing/combined/gcc/config -I/home/cgd/proj/gcc-testing/combined/gcc/../include -EL -DL_m16addsf3 -xassembler-with-cpp -c /home/cgd/proj/gcc-testing/combined/gcc/config/mips/mips16.S -o libgcc/el/_m16addsf3.o
> ./nm -pg libgcc/el/_m16addsf3.o | gawk 'NF == 3 { print ".hidden", $3 }' | ./xgcc -B./ -B/home/cgd/proj/gcc-testing/install64/mips64-elf/bin/ -isystem /home/cgd/proj/gcc-testing/install64/mips64-elf/include -isystem /home/cgd/proj/gcc-testing/install64/mips64-elf/sys-include -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -G 0 -g1 -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -r -nostdinc -nostdlib -o libgcc/el/_m16addsf3.oS libgcc/el/_m16addsf3.o -xassembler -
> ./collect-ld: libgcc/el/_m16addsf3.o: compiled for a little endian system and target is big endian
> File in wrong format: failed to merge target specific data of file libgcc/el/_m16addsf3.o
>
>
> note that the line starting with ./nm, added by this patch, is
> normally _not_ printed by the make process, but i tweaked my makefile
> to print it after having puzzled for a few minutes about what was
> going wrong. (perhaps these rules shouldn't be output into libgcc.mk
> with @? is there any reason to use @ in this case?)
>
>
> Anyway, I think in a nutshell, the .oS files being built here have to
> be built with the same (multilib-based) compiler flags as are used for
> the original .o files.
>
> I don't currently have a patch; busy frying other fish at the moment.
Does the following work?
2002-03-04 Jakub Jelinek <jakub@redhat.com>
* mklibgcc.in: Prepend a tab before .hidden, add $flags to gcc
-r command line.
--- gcc/mklibgcc.in.jj Thu Feb 28 18:01:09 2002
+++ gcc/mklibgcc.in Mon Mar 4 13:49:03 2002
@@ -279,7 +279,7 @@ for ml in $MULTILIBS; do
# .oS objects will have all non-local symbol definitions .hidden
oS=`echo ${o} | sed s~${objext}'$~.oS~g'`
echo "${oS}: stmp-dirs ${o}"
- echo ' @$(NM_FOR_TARGET) '${SHLIB_NM_FLAGS} ${o}' | $(AWK) '\''NF == 3 { print ".hidden", $$3 }'\'' | $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -r -nostdinc -nostdlib -o $@ '${o}' -xassembler -'
+ echo ' @$(NM_FOR_TARGET) '${SHLIB_NM_FLAGS} ${o}' | $(AWK) '\''NF == 3 { print "\t.hidden", $$3 }'\'' | $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) '${flags}' -r -nostdinc -nostdlib -o $@ '${o}' -xassembler -'
libgcc_a_objs="${libgcc_a_objs} ${oS}"
done
fi
Jakub