gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sparc: ld: --relax and -r may not be used together


From: Nicola Pero
Subject: Re: sparc: ld: --relax and -r may not be used together
Date: Sun, 10 Apr 2011 12:38:25 +0200 (CEST)

> Apparently the default of "relax" is there for everybody, but since on 
> x86 it does nothing, the majority of people never noticed, because if it 
> does nothing it does not cause errors :)

I'm not sure.  I looked at the linker command-line generated on my GNU/Linux 
i386
with GCC 4.1.2 when compiling gnustep-base's Additions subproject, and there is 
no
mention of --relax. ;-)

/usr/bin/ld --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker 
/lib/ld-linux.so.2 -o ./obj/subproject.o -L/usr/lib/gcc/i386-redhat-linux/4.1.2 
-L/usr/lib/gcc/i386-redhat-linux/4.1.2 
-L/usr/lib/gcc/i386-redhat-linux/4.1.2/../../.. -r 
obj/Additions.obj/GSObjCRuntime.m.o obj/Additions.obj/GCObject.m.o 
obj/Additions.obj/GCArray.m.o obj/Additions.obj/GCDictionary.m.o 
obj/Additions.obj/GSLock.m.o obj/Additions.obj/GSMime.m.o 
obj/Additions.obj/GSXML.m.o obj/Additions.obj/GSFunctions.m.o 
obj/Additions.obj/GSInsensitiveDictionary.m.o 
obj/Additions.obj/NSArray+GNUstepBase.m.o 
obj/Additions.obj/NSAttributedString+GNUstepBase.m.o 
obj/Additions.obj/NSBundle+GNUstepBase.m.o 
obj/Additions.obj/NSCalendarDate+GNUstepBase.m.o 
obj/Additions.obj/NSData+GNUstepBase.m.o 
obj/Additions.obj/NSDebug+GNUstepBase.m.o 
obj/Additions.obj/NSError+GNUstepBase.m.o 
obj/Additions.obj/NSFileHandle+GNUstepBase.m.o 
obj/Additions.obj/NSLock+GNUstepBase.m.o 
obj/Additions.obj/NSMutableString+GNUstepBase.m.o 
obj/Additions.obj/NSNumber+GNUstepBase.m.o 
obj/Additions.obj/NSObject+GNUstepBase.m.o 
obj/Additions.obj/NSPropertyList+GNUstepBase.m.o 
obj/Additions.obj/NSProcessInfo+GNUstepBase.m.o 
obj/Additions.obj/NSStream+GNUstepBase.m.o 
obj/Additions.obj/NSString+GNUstepBase.m.o 
obj/Additions.obj/NSTask+GNUstepBase.m.o 
obj/Additions.obj/NSThread+GNUstepBase.m.o 
obj/Additions.obj/NSURL+GNUstepBase.m.o obj/Additions.obj/Unicode.m.o

> That's strange... gcc must have dropped that option? Or perhaps it is 
> present only if gcc is compiled to issue automatically --relax to the 
> linker? That would make no sense: an options needs to be there and in 
> case "do nothing". With gcc 4.5.2 it works. -dumpspecs should tell you 
> if it has the relax option built in.

On my machine I can't find any relax option anywhere with either GCC 4.1.2
or GCC 4.7.0.  Both "gcc --target-help | grep relax" and
"gcc -dumpspecs | grep relax" return nothing.

It makes sense; since it's an "-m" option, it is a machine-dependent option.
So, it is supported on some target machines, but not on others.  I think
GCC 4.6.0+ became more strict/accurate in checking target flags.

The simple solution would be to only add -mno-relax on Sparc, if you're having
the problem on Sparc.  We don't even need a configure check; in target.make,
simply find the right location for it, and add a make conditional to add
-mno-relax on the target CPU that requires it.  Something like (untested
pseudo-code, to give you something to start with) --

# On Sparc, this is required because otherwise GCC automatically passes
# -relax to the linker, which conflicts with the -r passed via -Wl,-r.
ifeq ($(findstring sparc, $(GNUSTEP_TARGET_CPU)), sparc)
  OBJC_MERGE_CMD += -mno-relax
endif

Btw, thanks for looking into this.

Thanks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]