public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/37611]  New: invalid relocation R_386_GOTOFF when using protected function pointers
@ 2008-09-22  7:17 gernot dot hillier at siemens dot com
  2008-09-22  7:20 ` [Bug c/37611] " gernot dot hillier at siemens dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gernot dot hillier at siemens dot com @ 2008-09-22  7:17 UTC (permalink / raw)
  To: gcc-bugs

When I try to use protected function pointers in a shared library, I experience
strange behaviour: directly passing a function name triggers an invalid
relocation during linking stage while it works when assigning the function name
to a global variable first.

This report might be a duplicate to the old bug 19520, but I'm not sure as my
knowledge about ELF internals is rather limited and I don't understand most of
the discussion there, sorry. If this is a duplicate, please excuse.

Here's the output during compilation. Sources will follow in a few seconds:

$ LANG="" gcc -v -save-temps -Wall test2.c -o libtest2.so -shared -fPIC
-fvisibility=hidden
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ./configure --enable-languages=c,c++
Thread model: posix
gcc version 4.3.2 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-o' 'libtest2.so' '-shared'
'-fPIC' '-fvisibility=hidden' '-mtune=generic'
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.2/cc1 -E -quiet -v test2.c
-mtune=generic -Wall -fPIC -fvisibility=hidden -fpch-preprocess -o test2.i
ignoring nonexistent directory
"/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-o' 'libtest2.so' '-shared'
'-fPIC' '-fvisibility=hidden' '-mtune=generic'
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.2/cc1 -fpreprocessed test2.i
-quiet -dumpbase test2.c -mtune=generic -auxbase test2 -Wall -version -fPIC
-fvisibility=hidden -o test2.s
GNU C (GCC) version 4.3.2 (i686-pc-linux-gnu)
        compiled by GNU C version 4.3.2, GMP version 4.2.2, MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 53913b99eaa90e1de01474d5b5d32b19
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-o' 'libtest2.so' '-shared'
'-fPIC' '-fvisibility=hidden' '-mtune=generic'
 as -V -Qy -o test2.o test2.s
GNU assembler version 2.18.0 (i486-linux-gnu) using BFD version (GNU Binutils
for Ubuntu) 2.18.0.20080103
COMPILER_PATH=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.2/:/usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.2/:/usr/local/libexec/gcc/i686-pc-linux-gnu/:/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/:/usr/local/lib/gcc/i686-pc-linux-gnu/
LIBRARY_PATH=/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/:/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-o' 'libtest2.so' '-shared'
'-fPIC' '-fvisibility=hidden' '-mtune=generic'
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.3.2/collect2 --eh-frame-hdr -m
elf_i386 -shared -o libtest2.so /usr/lib/crti.o
/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/crtbeginS.o
-L/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2
-L/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../.. test2.o -lgcc --as-needed
-lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/crtendS.o /usr/lib/crtn.o
/usr/bin/ld: test2.o: relocation R_386_GOTOFF against protected function `f2'
can not be used when making a shared object
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status


-- 
           Summary: invalid relocation R_386_GOTOFF when using protected
                    function pointers
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gernot dot hillier at siemens dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37611


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-05-17 13:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-22  7:17 [Bug c/37611] New: invalid relocation R_386_GOTOFF when using protected function pointers gernot dot hillier at siemens dot com
2008-09-22  7:20 ` [Bug c/37611] " gernot dot hillier at siemens dot com
2008-09-22  7:23 ` gernot dot hillier at siemens dot com
2010-01-06 21:01 ` [Bug target/37611] " 3b87w8mt2n at snkmail dot com
2010-01-06 21:27 ` 3b87w8mt2n at snkmail dot com
2010-01-06 23:27 ` hjl dot tools at gmail dot com
2010-05-17 13:50 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).