This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][GOLD] Handle -Ttext, -Tdata and -Tbss options in scripts.
Hi,
Actually this changing the section addresses easier. I chose this
because the behaviour is more similar to the non-script case. I will
change the patch to set the section addresses only.
-Doug
2009/10/15 Ian Lance Taylor <iant@google.com>:
> I don't think we should do this. ?The patch is well-written, and there
> is a sense in which it is clearly correct: -Ttext really should set
> the address of the text segment, even when using a linker script.
> However, the purpose of supporting linker scripts in gold is to be
> compatible with the GNU linker, and this is not how the GNU linker
> handles -Ttext, et. al. ?In the GNU linker, -Ttext sets the address of
> the .text section, not the text segment, and similarly -Tdata and
> -Tbss set the addresses of the .data and the .bss sections.
>
> In the GNU linker this is changed by the use of SEGMENT_START in a
> linker script. ?If SEGMENT_START is used, then -Ttext, et. al., change
> that value. ?gold currently parses SEGMENT_START but does not
> implement it--see script_exp_function_segment_start in expression.cc.
>
> So I think the right thing to do here is to have the script code
> support -Ttext, et. al., as changing the address of the relevant
> section only, in Output_section_definition::set_section_addresses,
> *unless* SEGMENT_START is used, in which case we should use the value
> in script_exp_function_segment_start.
>
> I think that would be compatible, which is the goal here.
>
> Ian
>