This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Position Independent Executable without GOT/PLT
- From: Olaf Lüke <olaf at tinkerforge dot com>
- To: gcc-help at gcc dot gnu dot org
- Cc: olaf at tinkerforge dot com
- Date: Wed, 27 Oct 2010 21:32:03 +0200
- Subject: Position Independent Executable without GOT/PLT
Hello,
I am trying to compile position independent executables (-fPIE), which
are written to eeproms on sensor boards. These sensor boards can be
plugged into a master board that has a microcontroller (arm, cortex-m3).
This microcontroller should then read out the binaries from the sensor
boards, write them into his flash and execute them (so, the addresses
are not known at runtime).
Since i don't want to handle GOT/PLT tables, i would like to inline
these tables in the function calls. This is already done by default for
functions that are local to the entry function (i.e. they are in the
same file), but not for any other functions. For some architectures
there is a -minline-plt flag (blackfin, FRV), which probably does
exactly what i want. Unfortunately i can't find anything comparable for
arm.
I found two ways of dealing with this: The usage of -fwhole-program
(which is deprecated if i understand that right) or to make an
everything.c which includes every c file.
Both possibilities require to rebuild the whole project if some small
piece of code is changed. Is there a more sane way to create position
independent executables with inlined GOT/PLT on arm?