Re: git: 48d6db4932c8 - main - OpenSSL: move `-DOPENSSL_PIC` from `PIC_FLAG` to `SHARED_CFLAGS`
- Reply: Enji Cooper (yaneurabeya): "Re: git: 48d6db4932c8 - main - OpenSSL: move `-DOPENSSL_PIC` from `PIC_FLAG` to `SHARED_CFLAGS`"
- In reply to: Jessica Clarke : "Re: git: 48d6db4932c8 - main - OpenSSL: move `-DOPENSSL_PIC` from `PIC_FLAG` to `SHARED_CFLAGS`"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Apr 2026 23:49:56 UTC
> On Apr 22, 2026, at 2:24 PM, Jessica Clarke <jrtc27@freebsd.org> wrote:
>
> On 22 Apr 2026, at 21:34, Enji Cooper <ngie@FreeBSD.org> wrote:
>>
>> The branch main has been updated by ngie:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=48d6db4932c8ec04ca3df79119803f8c7c1570d7
>>
>> commit 48d6db4932c8ec04ca3df79119803f8c7c1570d7
>> Author: Enji Cooper <ngie@FreeBSD.org>
>> AuthorDate: 2026-04-21 23:46:19 +0000
>> Commit: Enji Cooper <ngie@FreeBSD.org>
>> CommitDate: 2026-04-22 20:34:25 +0000
>>
>> OpenSSL: move `-DOPENSSL_PIC` from `PIC_FLAG` to `SHARED_CFLAGS`
>>
>> `PIC_FLAG` should be used strictly for `-fPIC`, `-fpic`, etc, options.
>> `SHARED_CFLAGS` is the more appropriate place to this flag to be set.
>>
>> Requested by: jrtc27
>
> Thank you!
>
>> MFC after: 3 days
>> MFC with: 3797fe720a
>> ---
>> secure/lib/libcrypto/Makefile.inc | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/secure/lib/libcrypto/Makefile.inc b/secure/lib/libcrypto/Makefile.inc
>> index 8f22d501e005..85e2c0813b79 100644
>> --- a/secure/lib/libcrypto/Makefile.inc
>> +++ b/secure/lib/libcrypto/Makefile.inc
>> @@ -13,7 +13,7 @@ CFLAGS+= -I${LCRYPTO_SRC}/providers/fips/include
>> CFLAGS+= -I${LCRYPTO_SRC}/providers/implementations/include
>>
>> PICFLAG= -fPIC
>
> Assuming nothing else is messing with it, this can now go?
That’s a good question. I’ll try taking it out and see what happens.
-Enji
PS This is what the code used to look like prior to my other change — I moved the definitions from secure/lib/libcrypto/Makefile to secure/lib/libcrypto/Makefile.inc so the symbols could be incorporated into all of the OpenSSL-related libraries (including the legacy provider, libssl, etc):
```
diff --git a/secure/lib/libcrypto/Makefile b/secure/lib/libcrypto/Makefile
index 738de3479987..9d484e9d480c 100644
--- a/secure/lib/libcrypto/Makefile
+++ b/secure/lib/libcrypto/Makefile
@@ -687,12 +687,6 @@ SUBDIR.${MK_TESTS}= tests
.include <bsd.lib.mk>
-.if ${MACHINE} == "powerpc"
-# Work around "relocation R_PPC_GOT16 out of range" errors
-PICFLAG= -fPIC
-.endif
-PICFLAG+= -DOPENSSL_PIC
-
.if defined(ASM_${MACHINE_CPUARCH})
.PATH: ${SRCTOP}/sys/crypto/openssl/${MACHINE_CPUARCH}
.if defined(ASM_amd64)
diff --git a/secure/lib/libcrypto/Makefile.inc b/secure/lib/libcrypto/Makefile.inc
index 73c650d590ff..8f22d501e005 100644
--- a/secure/lib/libcrypto/Makefile.inc
+++ b/secure/lib/libcrypto/Makefile.inc
@@ -12,6 +12,9 @@ CFLAGS+= -I${LCRYPTO_SRC}/providers/common/include
CFLAGS+= -I${LCRYPTO_SRC}/providers/fips/include
CFLAGS+= -I${LCRYPTO_SRC}/providers/implementations/include
+PICFLAG= -fPIC
+PICFLAG+= -DOPENSSL_PIC
+
.SUFFIXES: .pc
.PATH.pc: ${LCRYPTO_SRC}/exporters
```