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
On Thu, May 03, 2007 at 03:08:03PM +0100, Richard Sandiford wrote:
> erik@dd.nec.com.au (Erik Christiansen) writes:
> > On Wed, May 02, 2007 at 08:19:13AM +0100, Nick Clifton wrote:
> >> 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.
Having also advocated that the script would never be ignored, i.e.
"whether _start or ENTRY() exist is explicitly up to the programmer", I
can only agree totally. But Nick's case (IIUC), and mine, arise when
your "if" is not satisfied. ;-)
IIUC, the "problem" only arises where a programmer _hasn't_ specified an
entry point in the linker script, and hasn't provided _start (*), but wishes
he had. The result is that the first build of the project doesn't run.
Does that warrant breaking existing builds? :-)
Maybe it does, but is it perhaps enough to put "ENTRY(_start);" in the
default linker scripts instead? Existing projects would use existing
scripts, and wouldn't break. A new embedded project would start with
customising a default linker script, mandating a named entry point by
default. Could that please both camps?
Leaving the policy to the linker script also seems more flexible and
user-friendly than hard-coding.
* Otherwise the offending auto-selection won't occur.
Cheers,
Erik