Hi,
I have stooped for a wile to try to test fPIE and fPIC link asm code, related some bugs found in gcc and clang. In favor for time necessary to get my hands on macros lib's for uasm integration.
Most of the time hasted compiling new releases of the gcc and clang to test the code, and I have get some info that is imperative both or one of the options with gcc or clang (-fPIC or -fPIE) at symbol link-time, to generate correct relocation's tables.
I have get some references about the problem here
https://stackoverflow.com/questions/36968287/why-doesnt-gcc-reference-the-plt-for-function-calls, and here
https://stackoverflow.com/questions/2463150/what-is-the-fpie-option-for-position-independent-executables-in-gcc-and-ld.
I remember that I only succeed to run the PIC test in ubuntu 18 with this gcc command at link time (SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC), this basically to linker create the addresses for the uasm object functions.
And also using:
SYSTEMV - default call-convention for new linux kernel releases.
And this:
option casemap:none
ifndef __x64__
.686P
.model flat
option stackbase:esp ; RSP or RBP are supported options for the stackbase.
else
.X64P
option stackbase:rsp ; RSP or RBP are supported options for the stackbase.
endif
option win64:15 ; 11-15 for RSP and 1-7 for RBP.
option frame:auto
No idea why i'm using this in ubuntu 18, but if I don't declare-it, I get some segment fault error's at runtime.
Not tested fPIE, I think the problem its the same and related to linux kernel standard's, not full implemented in older or bugged compiler's linker's.