Project

General

Profile

Bug #3336

ld: fatal: relocations remain against allocatable but non-writable sections

Added by Richard PALO almost 8 years ago. Updated almost 8 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2012-11-02
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

as this is perhaps an issue with /usr/bin/ld, here is a link to an issue discovered using illumos pkgsrc... https://github.com/joyent/pkgsrc/issues/16

The global zone is running SunOS x3200 5.11 oi_151a7 i86pc i386 i86pc
but the build is in a minimal non-global zone with joyents pkgsrc illumos 2012Q3 installed in order to build off of their 'joyent/pkgsrc' trunk.

As indicated as well in the github issue are the frequent warnings, not sure if that's a link editor problem or the build system problem of not suppressing duplicates in the actual generated build commands...


Files

gncEntryLedgerLayout.c (10 KB) gncEntryLedgerLayout.c this is the file causing problems ( the const char *'s ?) Richard PALO, 2012-11-02 09:30 AM
gnc.tar.gz (4.14 KB) gnc.tar.gz Richard PALO, 2012-11-02 04:08 PM
gnc.tar.gz (4.14 KB) gnc.tar.gz Richard PALO, 2012-11-02 04:19 PM

History

#1

Updated by Rich Lowe almost 8 years ago

  • Status changed from New to Feedback

Errors of this kind are almost always the fault of the software you're building. Generally because some bit of code is non-PIC.

You don't need to use GNU ld as a workaround, you can just pass -z textoff to the link-editor if you don't want it to complain (but do want it to leave the relocations), through the compiler driver, that'd be -Wl,-z,textoff

I'd need to see the objects involved, etc, to have some idea as to what is wrong. Please attach a problematic object or two to the bug.

#2

Updated by Richard PALO almost 8 years ago

Hello,

I attached a tarball with the object file indicated in the error message (in .libs) and, as well, the objectfile in the directory which, strangely enough, differs... If the .lo file is useful, I can add you that as well.

Rich Lowe wrote:

Errors of this kind are almost always the fault of the software you're building. Generally because some bit of code is non-PIC.

You don't need to use GNU ld as a workaround, you can just pass -z textoff to the link-editor if you don't want it to complain (but do want it to leave the relocations), through the compiler driver, that'd be -Wl,-z,textoff

I'd need to see the objects involved, etc, to have some idea as to what is wrong. Please attach a problematic object or two to the bug.

#3

Updated by Richard PALO almost 8 years ago

I just realised that the .lo is a text file:

richard@devzone:~/src/pkgsrc/finance/gnucash/work.devzone/gnucash-2.4.11/src/business/business-ledger$ more gncEntryLedgerLayout.lo
# gncEntryLedgerLayout.lo - a libtool object file
# Generated by ltmain.sh (GNU libtool) 2.2.6b
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# Name of the PIC object.
pic_object='.libs/gncEntryLedgerLayout.o'

# Name of the non-PIC object
non_pic_object='gncEntryLedgerLayout.o'

#4

Updated by Rich Lowe almost 8 years ago

I can't, at a glance, work out why relocations remain (never mind why they remain in that object alone).

It'd probably be useful to build with -Wl,-z,textwarn (presuming libtool will pass that through, libtool being involved is never pleasant...), and actually get a look at what the resulting object looks like.

Happily, the resulting object will also work, so you'd have a workaround too.

#5

Updated by Richard PALO almost 8 years ago

May be a bit over my head here with libtool:

richard@devzone:/opt/pkg/bin$ libtool --features
host: x86_64-sun-solaris2.11
enable shared libraries
enable static libraries
richard@devzone:/opt/pkg/bin$ grep '[,|}]text' libtool
archive_cmds="\$CC -shared \${wl}-z \${wl}text \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags" 
          \$CC -shared \${wl}-z \${wl}text \${wl}-M \${wl}\$lib.exp \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags~\$RM \$lib.exp" 
archive_cmds="\$CC -shared \${wl}-z \${wl}text \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags" 
          \$CC -shared \${wl}-z \${wl}text \${wl}-M \${wl}\$lib.exp \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags~\$RM \$lib.exp" 
archive_cmds="\$CC -shared \${wl}-z \${wl}text \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags" 
          \$CC -shared \${wl}-z \${wl}text \${wl}-M \${wl}\$lib.exp \${wl}-h \${wl}\$soname -o \$lib \$libobjs \$deplibs \$compiler_flags~\$RM \$lib.exp" 

Tried temporarily modifying directly in libtool these 'text' to 'textwarn', but the linker pukes saying it don't like both -z text and -z textwarn at the same time.

Tried a number of combinations in the makefile and even in the original configure for the solaris* parts (the first two) :

richard@devzone:~/src/pkgsrc/finance/gnucash/work.devzone/gnucash-2.4.11$ grep '[,|}]text' configure.orig 
        archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
          $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
      no_undefined_flag='${wl}-z,text'
      no_undefined_flag='${wl}-z,text'
      no_undefined_flag_CXX='${wl}-z,text'
        no_undefined_flag_CXX='${wl}-z,text'

but can't seem to make any music due to my poor knowledge of libtool interaction here. Guess will have to wait and see about this later when I have much more time...

thanks anyway.

#6

Updated by Richard PALO almost 8 years ago

for information, two other cases of this as noted in the above github issue.
This time with gcc 4.7.2 (and gcc-java) and also with clang.

Also available in: Atom PDF