Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 2026 18:00:08 -0700
From:      "Enji Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        Enji Cooper <ngie@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 48d6db4932c8 - main - OpenSSL: move `-DOPENSSL_PIC` from `PIC_FLAG` to `SHARED_CFLAGS`
Message-ID:  <961C60AE-B053-4531-9C81-E30AC2FEC3A0@gmail.com>
In-Reply-To: <A23D3E1A-C834-40FA-9442-B7E6D067A74F@gmail.com>
References:  <69e930dd.253f6.360e2614@gitrepo.freebsd.org> <A0C9E9F4-79E2-4FF0-85A9-48EB798FED21@freebsd.org> <A23D3E1A-C834-40FA-9442-B7E6D067A74F@gmail.com>

index | next in thread | previous in thread | raw e-mail


> On Apr 22, 2026, at 4:49 PM, Enji Cooper (yaneurabeya) <yaneurabeya@gmail.com> wrote:
> 
>> 
>> 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):

	Hmmm… PICFLAG= -fpic by default per share/mk/… and now it’s set to PICFLAG= -fPIC. A previous comment said the value was needed because PowerPC required it. I’m going to leave this be given that OpenSSL always builds with -fPIC on FreeBSD (look for "#### *BSD” in `crypto/openssl/Configurations/10-main.conf `).
Cheers,
-Enji

From https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html (because clang’s documentation is far from ideal…).

-fpic
	Generate position-independent code (PIC) suitable for use in a shared library, if supported for the target machine. Such code accesses all constant addresses through a global offset table (GOT). The dynamic loader resolves the GOT entries when the program starts (the dynamic loader is not part of GCC; it is part of the operating system). If the GOT size for the linked executable exceeds a machine-specific maximum size, you get an error message from the linker indicating that -fpic does not work; in that case, recompile with -fPIC instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The x86 has no such limit.)

	Position-independent code requires special support, and therefore works only on certain machines. For the x86, GCC supports PIC for System V but not for the Sun 386i. Code generated for the IBM RS/6000 is always position-independent.

	When this flag is set, the macros __pic__ and __PIC__ are defined to 1.

-fPIC
	If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table. This option makes a difference on AArch64, m68k, PowerPC and SPARC.
	Position-independent code requires special support, and therefore works only on certain machines.
	When this flag is set, the macros __pic__ and __PIC__ are defined to 2.



home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?961C60AE-B053-4531-9C81-E30AC2FEC3A0>