Olaf Hering
2003-Nov-27 07:21 UTC
[klibc] [PATCH] do not use -R on ppc to link shared objects
The *.shared targets require -shared on powerpc, and -R leads to linker errors. This patch makes the -R an arch define. ia64 at least requires -R. --- ash/Makefile +++ ash/Makefile 2003/11/27 15:04:02 @@ -36,7 +36,7 @@ $(STRIP) $(PROG) $(PROG).shared: $(OBJS) $(LIBS) - $(LD) $(LDFLAGS) -o $(PROG).shared -e main $(KLIBSRC)/interp.o $(OBJS) -R $(KLIBSRC)/libc.so $(LIBGCC) + $(LD) $(LDFLAGS) -o $(PROG).shared -e main $(KLIBSRC)/interp.o $(OBJS) $(LD_SOLIB_FLAGS) $(KLIBSRC)/libc.so $(LIBGCC) $(STRIP) $(PROG).shared $(CRT0) $(LIBS): --- klibc/Makefile +++ klibc/Makefile 2003/11/27 15:03:50 @@ -62,7 +62,7 @@ $(STRIP) $@.stripped tests/%.shared : tests/%.o interp.o $(SOLIB) - $(LD) $(LDFLAGS) -o $@ -e main interp.o tests/$*.o -R $(SOLIB) $(LIBGCC) + $(LD) $(LDFLAGS) -o $@ -e main interp.o tests/$*.o $(LD_SOLIB_FLAGS) $(SOLIB) $(LIBGCC) cp $@ $@.stripped $(STRIP) $@.stripped --- klibc/arch/alpha/MCONFIG +++ klibc/arch/alpha/MCONFIG 2003/11/27 15:04:12 @@ -14,4 +14,4 @@ # 7 GB - normal binaries start at 4.5 GB, and the stack is below # the binary. SHAREDFLAGS = -Ttext 0x1c0000200 - +LD_SOLIB_FLAGS = -R --- klibc/arch/arm/MCONFIG +++ klibc/arch/arm/MCONFIG 2003/11/27 15:04:16 @@ -24,3 +24,4 @@ # This address needs to be reachable using normal inter-module # calls, and work on the memory models for this architecture SHAREDFLAGS = -Ttext 0x01000200 +LD_SOLIB_FLAGS = -R --- klibc/arch/cris/MCONFIG +++ klibc/arch/cris/MCONFIG 2003/11/27 15:04:19 @@ -9,3 +9,4 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 32 +LD_SOLIB_FLAGS = -R --- klibc/arch/i386/MCONFIG +++ klibc/arch/i386/MCONFIG 2003/11/27 15:04:21 @@ -30,3 +30,4 @@ # calls, and work on the memory models for this architecture # 96 MB - normal binaries start at 128 MB SHAREDFLAGS = -Ttext 0x06000200 +LD_SOLIB_FLAGS = -R --- klibc/arch/ia64/MCONFIG +++ klibc/arch/ia64/MCONFIG 2003/11/27 15:04:23 @@ -9,3 +9,4 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 64 +LD_SOLIB_FLAGS = -R --- klibc/arch/m68k/MCONFIG +++ klibc/arch/m68k/MCONFIG 2003/11/27 15:04:25 @@ -9,3 +9,4 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 32 +LD_SOLIB_FLAGS = -R --- klibc/arch/mips/MCONFIG +++ klibc/arch/mips/MCONFIG 2003/11/27 15:04:27 @@ -16,3 +16,4 @@ # calls, and work on the memory models for this architecture # 2 MB -- the normal starting point for text is 4 MB. SHAREDFLAGS = -Ttext 0x00200200 +LD_SOLIB_FLAGS = -R --- klibc/arch/mips64/MCONFIG +++ klibc/arch/mips64/MCONFIG 2003/11/27 15:04:29 @@ -9,3 +9,4 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 64 +LD_SOLIB_FLAGS = -R --- klibc/arch/parisc/MCONFIG +++ klibc/arch/parisc/MCONFIG 2003/11/27 15:04:31 @@ -9,3 +9,4 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 32 +LD_SOLIB_FLAGS = -R --- klibc/arch/ppc/MCONFIG +++ klibc/arch/ppc/MCONFIG 2003/11/27 15:07:19 @@ -9,3 +9,5 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 32 +SHAREDFLAGS = -shared +LD_SOLIB_FLAGS --- klibc/arch/ppc64/MCONFIG +++ klibc/arch/ppc64/MCONFIG 2003/11/27 15:07:22 @@ -9,3 +9,5 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 64 +SHAREDFLAGS = -shared +LD_SOLIB_FLAGS --- klibc/arch/s390/MCONFIG +++ klibc/arch/s390/MCONFIG 2003/11/27 15:04:37 @@ -11,3 +11,4 @@ BITSIZE = 32 SHAREDFLAGS = -Ttext 0x40000200 +LD_SOLIB_FLAGS = -R --- klibc/arch/s390x/MCONFIG +++ klibc/arch/s390x/MCONFIG 2003/11/27 15:04:39 @@ -11,3 +11,4 @@ BITSIZE = 64 SHAREDFLAGS = -Ttext 0x40000200 +LD_SOLIB_FLAGS = -R --- klibc/arch/sh/MCONFIG +++ klibc/arch/sh/MCONFIG 2003/11/27 15:04:41 @@ -17,3 +17,4 @@ # 2 MB -- the normal starting point for text is 4 MB. SHAREDFLAGS = -Ttext 0x00200200 +LD_SOLIB_FLAGS = -R --- klibc/arch/sparc/MCONFIG +++ klibc/arch/sparc/MCONFIG 2003/11/27 15:04:43 @@ -16,3 +16,4 @@ # Normal binaries start at 64K; the linker wants 64K alignment, # and call instructions have a 30-bit signed offset, << 2. SHAREDFLAGS = -Ttext 0x40000100 +LD_SOLIB_FLAGS = -R --- klibc/arch/sparc64/MCONFIG +++ klibc/arch/sparc64/MCONFIG 2003/11/27 15:04:46 @@ -19,3 +19,4 @@ # Normal binaries start at 1 MB; the linker wants 1 MB alignment, # and call instructions have a 30-bit signed offset, << 2. SHAREDFLAGS = -Ttext 0x80000200 +LD_SOLIB_FLAGS = -R --- klibc/arch/x86_64/MCONFIG +++ klibc/arch/x86_64/MCONFIG 2003/11/27 15:04:48 @@ -14,3 +14,4 @@ BITSIZE = 64 LDFLAGS = -m elf_x86_64 +LD_SOLIB_FLAGS = -R -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG
H. Peter Anvin
2003-Nov-27 08:53 UTC
[klibc] [PATCH] do not use -R on ppc to link shared objects
Olaf Hering wrote:> The *.shared targets require -shared on powerpc, and -R leads to linker > errors. > This patch makes the -R an arch define. ia64 at least requires -R.Hmmm... *both* of those sounds like linker bugs. Unless there is a specific reason for it I'd rather try to get binutils fixed. I'm not sure what consequences -shared has, and in *particular* what consequences it will have in future linker versions. -hpa