This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] ld/ldlang.c: fatal error on architecture mismatch
erik@dd.nec.com.au (Erik Christiansen) writes:
> On Wed, May 02, 2007 at 08:19:13AM +0100, Nick Clifton wrote:
>> Hi Guys,
>>
>> >>>>>While we're on the subject of errors, it bugs me that the linker warns
>> >>>>>and auto-selects an address if you don't provide _start or specify an
>> >>>>>entry point. How do you feel about making that fatal?
>>
>> >Fair enough, I'll rephrase. The change would break a number of
>> >embedded builds. Whether that is a bad idea or not, I don't know.
>>
>> I strongly suspect that if we make this change then in the cases where
>> entry points are not being specified at the moment the programmers will
>> just add "-e 0" to the command line. ie they will not set a real start
>> address because they do not want to (or do not have one), they will just
>> add a switch to the command line to shut the linker up.
>>
>> I see no good reason to break embedded builds in this way. If it really
>> matters that the linker refuses to build a binary without a start
>> address then you can add the "--fatal-warnings" switch to the command
>> line. So my vote is against changing the linker's current behaviour.
>
> It's hard not to agree.
>
> When using gcc with "-nostartfiles", whether _start or ENTRY() exist is
> explicitly up to the programmer.
>
> For the linker to have a vestigial fixation on a named entry point, when
> the rest of the toolchain and the user have ditched it, would seem to
> violate POLA?
I don't think we can say the user has ditched the entry point if they
are still using a linker script that explicitly says "set the entry point
to this". Ignoring the linker script really violates the POLA for me.
For example, if the linker script says:
SECTIONS
{
_foo = _bar;
}
we will treat a missing _bar as a hard error. Why should:
ENTRY(_bar)
be any different? It is effectively an assignment to a variable in
the ELF header (and often a very important one at that). We have
no more reason to believe that the entry point is unused than we
have to believe that _foo is unused.
Richard