Forum > Linux

build 32bit .so with -fPIC

(1/1)

abk.964:
Hi.
I try to build 32bit (i386) shared library with -fPIC option.
Create new project "Library", set target Linux i386, add -fPIC and -Cg to custom options (think it's synonym), pass to linker option --warn-shared-textrel.

Linker say:

--- Code: ---/usr/bin/ld: //usr/lib/fpc/3.2.2/units/i386-linux/rtl/system.o: warning: relocation in read-only section `.text.n_system_$$_fpsigaction$longint$psigactionrec$psigactionrec$$longint'
/usr/bin/ld: warning: creating a DT_TEXTREL in a shared object

--- End code ---

"readelf -d" say

--- Code: ---0x00000016 (TEXTREL)                    0x0
0x0000001e (FLAGS)                      TEXTREL

--- End code ---

I use Lazarus 3.99 64bit, FPC 3.2.2, Debian 10 64bit.
32bit FPC runtime builded from sources with default options.

I found Fpsigaction in ossysc.inc. Can`t understand, what a problem with it.

How to build 32bit .so without TEXTREL ?

abou.almontacir:
I'm also working on enabling PIC for Debian and have similar issue.

PascalDragon:

--- Quote from: abk.964 on December 28, 2024, 10:22:48 am ---32bit FPC runtime builded from sources with default options.
--- End quote ---

Try to rebuild your 32-bit FPC distribution with OPT=-Cg just to be sure that everything is alright there.

abk.964:
Use parameter CREATESHARED rebuilding runtime. For example:
--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---make all OS_TARGET=linux CPU_TARGET=i386 CREATESHARED=1 It turns on -Cg option.

dbannon:
Despite that warning, it still makes a PIE executable.

My app is built in Debian that way for multiple platforms (except Power64el) for several years and does not trigger the dreaded lintian PIE warning.

Davo

Navigation

[0] Message Index

Go to full version