Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2014-08

OSv PIE support

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jy V

Hello all,

It has been recently announced at:
https://github.com/cloudius-systems/osv/issues/213 that it is now possible to run position independent executable on OSV, not requiring any longer to generate a .so,
has anyone been able to compile with FPC a PIE for Linux x64 and test on OSV ?
On Ubuntu 14.04 Desktop, I tried to look at option offered in Lazarus 1.3 FPC 2.6.5 (as pulled using FPCUP),
but I am not able to locate in the IDE the option to compile a PIE,

Regards.

Reply by email

Jonas Maebe
to Jy V
Jy V wrote
On Ubuntu 14.04 Desktop, I tried to look at option offered in Lazarus 1.3 FPC 2.6.5 (as pulled using FPCUP), but I am not able to locate in the IDE the option to compile a PIE,

A position-independent executable is simply an executable that only contains position-independent code and that is linked with the "-pie" linker option. So compiling all code with -Cg (the standard FPC RTL and packages are compiled like that by default on Linux/x86-64) and then linking your application with the -kpie command line option should be enough.

Jonas

Reply by email

Jy V
to Jonas Maebe
Show quoted text 7 lines
A position-independent executable is simply an executable that only contains position-independent code and that is linked with the "-pie" linker option. So compiling all code with -Cg (the standard FPC RTL and packages are compiled like that by default on Linux/x86-64) and then linking your application with the -kpie command line option should be enough.

Thank you Jonas.

Reply by email

Michael Schnell
to Jonas Maebe: A position-independent executable is simply an executable that only contains…
Jonas Maebe wrote 8 lines
A position-independent executable is simply an executable that only contains position-independent code and that is linked with the "-pie" linker option. So compiling all code with -Cg (the standard FPC RTL and packages are compiled like that by default on Linux/x86-64) and then linking your application with the -kpie command line option should be enough.

Sounds good.

Is "-Cg" available for all archs ?

I.e., I would (on the long run) like to do a kind of "loadable modules" that can be accessed by software done in ANSI C on a PIC32 (a MIPS architecture).
(Another option would be to have the Microchip IDE link-in a .o file created by fpc I don't know which of the possibilities would be more doable.)

-Michael

Reply by email