Bug 293934 - CFLAGS+=-fPIC needed after commit 14b9955e57cc28b61e785165b9effcbe620edb46
Summary: CFLAGS+=-fPIC needed after commit 14b9955e57cc28b61e785165b9effcbe620edb46
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 16.0-CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Enji Cooper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-03-20 11:12 UTC by Trond Endrestøl
Modified: 2026-03-22 02:21 UTC (History)
2 users (show)

See Also:


Attachments
Patch for secure/lib/libcrypto/modules/Makefile.inc adding the much needed CFLAGS+=-fPIC (5.40 KB, patch)
2026-03-20 11:12 UTC, Trond Endrestøl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Trond Endrestøl 2026-03-20 11:12:56 UTC
Created attachment 268948 [details]
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
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2026-03-20 20:07:17 UTC
Sorry about that Trond! I -fPIC should be added to PICFLAG, but I need to check and make sure it doesn't break other architectures first. I'll back out the change and reintroduce another one incorporating your proposed patch after I run it through `make universe`.
Comment 2 commit-hook freebsd_committer freebsd_triage 2026-03-20 20:13:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=67b918e03475e780854a43fe4eb7c8e95f4deb29

commit 67b918e03475e780854a43fe4eb7c8e95f4deb29
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-03-20 20:08:09 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-03-20 20:12:26 +0000

    Revert "libcrypto: compile all PIC objects with -DOPENSSL_PIC"

    This commit broke the build with some build options.

    Some validation needs to be done to confirm that moving the preprocessor
    argument to `secure/lib/libcrypto/Makefile.inc` works without breaking
    the build, but revert for now until a `tinderbox` run can be done with
    the change.

    PR:             293934
    Reported by:    Jenkins, Trond Endrestøl

    This reverts commit 14b9955e57cc28b61e785165b9effcbe620edb46.

 secure/lib/libcrypto/modules/Makefile.inc | 2 --
 1 file changed, 2 deletions(-)