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]

PATCH: Add -Ttext-segment ADDR to ELF linker


On Tue, Jan 13, 2009 at 11:52 AM, Ian Lance Taylor <iant@google.com> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> On Tue, Jan 13, 2009 at 9:50 AM, Daniel Jacobowitz <drow@false.org> wrote:
>>> On Tue, Jan 13, 2009 at 09:34:16AM -0800, Ian Lance Taylor wrote:
>>>> > 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.
>>>
>>> Completely agreed, this would be useful...
>>>
>>
>> Some applications may depend the current behaviour as shown
>> in linker testcases.
>
> I am very skeptical that any real ELF code uses -Ttext without also
> using a custom linker script.
>
> Ian
>

I don't think we should take this risk to potentially break existing
applications.  Here is a patch to add a new switch -Ttext-segment.
I can reuse -Ttext and update linker tests if it is preferred.

Thanks.


-- 
H.J.
---
ld/

2009-01-13  H.J. Lu  <hongjiu.lu@intel.com>

	* lexsup.c (option_values): Add OPTION_TTEXT_SEGMENT.
	(ld_options): Add -Ttext-segment.
	(parse_args): Handle OPTION_TTEXT_SEGMENT.

	* ld.texinfo: Document -Ttext-segment.

	* scripttempl/elf.sc (TEXT_START_ADDR): Use SEGMENT_START.
	(SHLIB_TEXT_START_ADDR): Likewise.

ld/testsuite/

2009-01-13  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/textaddr1.d: New.
	* ld-elf/textaddr2.d: Likewise.

Attachment: ld-addr-2.patch
Description: Text document


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