> cat gcc.c
static inline void foo (void) { }
void baz (void (*f) (void));
void bar (void) { baz (foo); }

> gcc -O0 -c -fPIC gcc.c
> gcc -shared -o gcc.so gcc.o
/usr/lib64/gcc/x86_64-suse-linux/4.1.0/../../../../x86_64-suse-linux/bin/ld:
gcc.o: relocation R_X86_64_PC32 against `foo' can not be used when making a
shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.1.0/../../../../x86_64-suse-linux/bin/ld:
final link failed: Bad value
collect2: ld returned 1 exit status


Note: Adding -02 to the compilation silences this.
Note: Removing "inline" silences this.


-- 
           Summary: -fPIC failure
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: terra at gnome dot org
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


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

Reply via email to