https://sourceware.org/bugzilla/show_bug.cgi?id=33409

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Sam James from comment #0)
> ```
> $ gcc a.c -o a.so -shared -mno-direct-extern-access
> $ gcc b.c a.so -shared -mdirect-extern-access
> /usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../x86_64-pc-linux-gnu/bin/ld:
> /tmp/cc9vITO3.o: warning: relocation against `bar' in read-only section
> `.text'
> /usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../x86_64-pc-linux-gnu/bin/ld:
> /tmp/cc9vITO3.o: relocation R_X86_64_PC32 against undefined symbol `bar' can
> not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../x86_64-pc-linux-gnu/bin/ld:
> final link failed: bad value
> collect2: error: ld returned 1 exit status
> ```

-fPIC must be used for shared library on x86-64.  Does it with -fPIC?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to