> -----Original Message----- > From: Leopold Toetsch [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 06, 2004 11:49 PM > To: Adam Thomason > Cc: [EMAIL PROTECTED] > Subject: Re: [perl #29257] Build libnci.so by default > > > Adam Thomason <[EMAIL PROTECTED]> wrote: > > > amd64 breaks. Shared libraries must be compiled with -fPIC; see > > http://www.x86-64.org/lists/discuss/msg02621.html for why. > LD_SHARED > > has the flag, but nci_test.o isn't compiled with it. > > Well, then we have to add $(LD_SHARED). > > > needs to be a CC_SHARED as well? > > You are thinking of many object files that are linked > together as a shared lib?
It's not the library that's the trouble, it's the contained objects. If they aren't all compiled as PIC, the linker refuses to build a shared library ("src/nci_test.o: relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC"). Since nci_test.o is compiled with the default make rule for .c files, the flag isn't included unless -fPIC is in CFLAGS... > > > ... -fPIC isn't desirable where > > unecessary, so it shouldn't be the default for every Linux, > > certainly... does this belong in the cpu/ tests? > > config/gen/cpu/* is more intended for generated files. I > think a similar thing should be in config/auto/cpu/* for > feature tests. > ... but that's not required in the general case (i.e., the rest of parrot's sources). Therefore, the building of nci_test.o (and in the future, any other object linked into libnci.so) needs a specific makefile rule that uses -fPIC or its equivalent, depending upon the compiler and platform. Adam