[Buildroot] [PATCH v2 1/2] package/libabseil-cpp new package

Thomas Petazzoni thomas.petazzoni at bootlin.com
Wed Jul 22 07:27:00 UTC 2020


Hello Adam,

Thanks for the new iteration.

On Tue, 21 Jul 2020 14:45:21 -0700
aduskett at gmail.com wrote:

> +Because libabseil-cpp builds static libraries, it is better to set the
> +POSITION_INDEPENDENT_CODE to ON instead of forcing fPIC, as forcing fPIC may
> +cause relocation errors when shared libraries link against the built static
> +libraries.

Duh? This doesn't make much sense to me. Did you perhaps misunderstand
what I said in my previous e-mail ?

When building static libraries, -fPIC is normally not needed.

Except when such static libraries end up being linked into a shared
library, in which case all the code of the shared library (which
includes the static library) must have been compiled with -fPIC.

The reason is pretty simple: the load address of shared libraries is
decided at runtime, and it may be different for every program using a
given shared library. Hence the shared library code must be Position
Independent, so that it can run from any memory address.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



More information about the buildroot mailing list