This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Always create position independent executables
- From: Ian Lance Taylor <ian at airs dot com>
- To: Simon Richter <Simon dot Richter at hogyros dot de>
- Cc: binutils at sourceware dot org
- Date: 02 May 2005 14:54:41 -0400
- Subject: Re: Always create position independent executables
- References: <427651E3.5070300@hogyros.de>
Simon Richter <Simon.Richter@hogyros.de> writes:
> I have a MMU-less platform (ARM uClinux) and would like to have ld
> create position independent executables by default. I figured that
> probably the easiest way to do so would be to set link_info.pie = TRUE
> from before_parse, however noone else appears to be doing that, and I'm
> pretty confident this is not the first MMU-less architecture using ELF. :-)
>
> My current approach would be to add a new emulation armelf_uclinux /
> armelfb_uclinux that would always use -pie by setting link_info.pie and
> modifying genscripts.sh to accept a new parameter to not build non-PIE
> executable link scripts if a variable GENERATE_PIE_SCRIPT_ONLY is set
> (obviously, I'd leave relocatable links alone). Is that good, or am I
> completely wrong here?
Most people handle these issues in the compiler. Just have the
compiler pass -pie when invoking the linker.
Adding a new emulation tends to be somewhat error-prone over time, as
people do not update all the existing emulations. But you can do it
if you really want to.
Ian