This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Add -z text-start-addr=ADDR to ELF linker


"H.J. Lu" <hjl.tools@gmail.com> writes:

> On Mon, Jan 12, 2009 at 10:40 PM, Ian Lance Taylor <iant@google.com> wrote:
>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>
>>> On Mon, Jan 12, 2009 at 09:39:16PM -0800, Ian Lance Taylor wrote:
>>>> "H.J. Lu" <hongjiu.lu@intel.com> writes:
>>>>
>>>> > Sometimes, we want to load the ELF executable in a different address from
>>>> > the default.  This patch adds -z text-start-addr=ADDR to ELF linker. If it
>>>> > is acceptable, I will submit a complete patch with some testcases.
>>>>
>>>> We already support -Ttext=ADDR and SEGMENT_START.  Does this add
>>>> anything to that approach?
>>>>
>>>
>>> Do they cover ELF headers?
>>
>> I don't see any reason that they could not cover ELF headers.  See
>> ld/scripttempl/armbpabi.sc.
>>
>
> SEGMENT_START may work. But it has 2 issues:
>
> 1.  It will change -Tbss, -Tdata, and -Ttext.

As far as I can see, if we only add SEGMENT_START("text") to the
linker script, it will only change -Ttext.  And even if it were
otherwise, I don't see why that is a problem, as it will only change
them for the better.

> 2. ELF segment has no names. The name of
> the ELF segment doesn't mean anything.

I'm not sure what you mean.  Of course ELF segments have no names.
I'm suggesting that -Ttext should set the start of the text segment.
The current behaviour, of setting the address of the .text section, is
useless for ELF.

> I need a different SEGMENT_START, which
> specifies the start of executable.

The start of the executable is normally the start of the text
segment.  Do you want the start of the executable and the text segment
to be two different locations?

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]