[Bug 293934] CFLAGS+=-fPIC needed after commit 14b9955e57cc28b61e785165b9effcbe620edb46

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 20 Mar 2026 11:12:56 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293934

            Bug ID: 293934
           Summary: CFLAGS+=-fPIC needed after commit
                    14b9955e57cc28b61e785165b9effcbe620edb46
           Product: Base System
           Version: 16.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: Trond.Endrestol@ximalas.info

Created attachment 268948
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=268948&action=edit
Patch for secure/lib/libcrypto/modules/Makefile.inc adding the much needed
CFLAGS+=-fPIC

After commit 14b9955e57cc28b61e785165b9effcbe620edb46 and without
CFLAGS+=-fPIC these error messages ensues:

Building shared library legacy.so
Building /usr/obj/usr/src/amd64.amd64/lib/libsmutil/cf.pieo
Building /usr/obj/usr/src/amd64.amd64/lib/libtelnet/genget.pieo
Building /usr/obj/usr/src/amd64.amd64/lib/libipt/pt_section_file.pico
Building /usr/obj/usr/src/amd64.amd64/lib/libstats/libstats.so.0
Building shared library libstats.so.0
ld: error: relocation R_X86_64_32S cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(OSSL_provider_init)

ld: error: relocation R_X86_64_PC32 cannot be used against symbol
'__stack_chk_guard'; recompile with -fPIC
>>> defined in /usr/obj/usr/src/amd64.amd64/tmp/lib/libc.so.7
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(ERR_set_error)

ld: error: relocation R_X86_64_PC32 cannot be used against symbol
'__stack_chk_guard'; recompile with -fPIC
>>> defined in /usr/obj/usr/src/amd64.amd64/tmp/lib/libc.so.7
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(ERR_set_error)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_gettable_params)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_get_params)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_get_params)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_get_params)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_get_params)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_get_params)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_get_params)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_get_params)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in ciphercommon.pico
>>> referenced by ciphercommon.c
>>>               ciphercommon.pico:(ossl_cipher_generic_gettable_params)

ld: error: relocation R_X86_64_32S cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_query)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in ciphercommon.pico
>>> referenced by ciphercommon.c
>>>               ciphercommon.pico:(ossl_cipher_generic_get_params)

ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_dispatch_table)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in ciphercommon.pico
>>> referenced by ciphercommon.c
>>>               ciphercommon.pico:(ossl_cipher_generic_get_params)

ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_dispatch_table)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in ciphercommon.pico
>>> referenced by ciphercommon.c
>>>               ciphercommon.pico:(ossl_cipher_generic_get_params)

ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in legacyprov.pico
>>> referenced by legacyprov.c
>>>               legacyprov.pico:(legacy_dispatch_table)

ld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC
>>> defined in ciphercommon.pico
>>> referenced by ciphercommon.c
>>>               ciphercommon.pico:(ossl_cipher_generic_get_params)

ld: error: too many errors emitted, stopping now (use --error-limit=0 to see
all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [legacy.so] Error code 1

make[7]: stopped making "all" in /usr/src/secure/lib/libcrypto/modules/legacy

-- 
You are receiving this mail because:
You are the assignee for the bug.