Convert x86 assembly stub to PIC to fix linking with lld
Submitted by Christian Weisgerber
Assigned to mes..@..op.org
Link to original bug (#108541)
Description
Created attachment 142177 Convert entry_x86_tsd.h to PIC
The x86 assembly language stub in src/mapi/entry_x86_tsd.h does not generate PIC (position-independent code). This causes text relocations, which are by default treated as an error by LLVM's lld linker (now used by FreeBSD and OpenBSD) when building a shared library.
/usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: _glapi_Dispatch in readonly segment; recompile object files with -fPIC
defined in .libs/shared_glapi_libglapi_la-u_current.o referenced by entry.c .libs/shared_glapi_libglapi_la-entry.o:(.text+0x1)
The accompanying minimal diff remedies this by generating PIC code. This is mostly copied from the neighboring entry_x86_tls.h.
Patch 142177, "Convert entry_x86_tsd.h to PIC":
entry_x86_tsd.diff