Bug 691315 - 'make so' fails with "ld: fatal: relocations remain against allocatable but non-writable sections"
Summary: 'make so' fails with "ld: fatal: relocations remain against allocatable but n...
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Build Process (show other bugs)
Version: 8.71
Hardware: Sun Solaris
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-18 02:44 UTC by Kenneth Berland
Modified: 2011-09-13 10:52 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Berland 2010-05-18 02:44:09 UTC
In trying to "make so" the linking fails.

I changed the link line for the last step and got it to work:

diff soobj/ldt.tr soobj/foo.tr
1c1
< gcc -shared -Wl,-soname=libgs.so.8 -o ./bin/../sobin/libgs.so.8.71 ./obj/../soobj/gsromfs1.o ./obj/../soobj/gs.o ./obj/../soobj/gp_getnv.o \
---
> gld -shared -soname=libgs.so.8 -o ./bin/../sobin/libgs.so.8.71 ./obj/../soobj/gsromfs1.o ./obj/../soobj/gs.o ./obj/../soobj/gp_getnv.o \


-KB
Comment 1 Hin-Tak Leung 2010-05-18 03:31:45 UTC
(In reply to comment #0)
> In trying to "make so" the linking fails.
> 
> I changed the link line for the last step and got it to work:
> 
> diff soobj/ldt.tr soobj/foo.tr
> 1c1
> < gcc -shared -Wl,-soname=libgs.so.8 -o ./bin/../sobin/libgs.so.8.71
> ./obj/../soobj/gsromfs1.o ./obj/../soobj/gs.o ./obj/../soobj/gp_getnv.o \
> ---
> > gld -shared -soname=libgs.so.8 -o ./bin/../sobin/libgs.so.8.71 ./obj/../soobj/gsromfs1.o ./obj/../soobj/gs.o ./obj/../soobj/gp_getnv.o \

Those two are equivalent if your gcc is built to use GNU ld. I suspect that your gcc was built against the Sun linker, rather than GNU ld, so I would like the output of your "gcc -v".

Note that you have to do "./configure --enable-dynamic" for "make so" to work at all. (this was an oversight in the documentation and has been corrected recently.)
Comment 2 Kenneth Berland 2010-05-18 04:30:23 UTC
hero@thmaster:~$ gcc -v
Using built-in specs.
Target: i386-pc-solaris2.11
Configured with: ./configure --prefix=/usr/sfw2 --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-shared
Thread model: posix
gcc version 4.3.4 (GCC)
Comment 3 Kenneth Berland 2010-05-18 04:31:09 UTC
When I ./configure with ./configure --enable-dynamic I get the same results.
Comment 4 Hin-Tak Leung 2010-05-19 23:43:28 UTC
Your gcc is not using GNU ld (from the -v), so your gld thing was using a different linker than gcc uses. 

Can you give the middle part of this patch ( 
bug 686865) http://bugs.ghostscript.com/attachment.cgi?id=469 a try? Just the middle part - the other parts won't apply any more and irrelevant.

i.e. change in base/unix-dll.mak
    -shared -Wl,-soname=
to 
    -Bdynamic -Wl,-so
?

we have some unreviewed/unincoporated patch from a knowledgeable SUN engineer (bug 689490) - do you also want to give that a try and maybe update them if the above doesn't work?
Comment 5 Kenneth Berland 2010-05-20 00:32:29 UTC
With the change below, 'make so' builds sobin/libgs.so.8.71


hero@thmaster:~/ghostscript-8.71$ diff ./base/unix-dll.mak base/unix-dll.mak~ 
52c52
< LDFLAGS_SO=-Bdynamic -Wl,-so$(GS_SONAME_MAJOR)
---
> LDFLAGS_SO=-shared -Wl,-soname=$(GS_SONAME_MAJOR)
Comment 6 Chris Liddell (chrisl) 2011-09-13 10:52:07 UTC
I believe this now works correctly. If not, please reopen.