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: [PATCH] ld/ldlang.c: fatal error on architecture mismatch


Nick Clifton <nickc@redhat.com> writes:
>> The default linker scripts already have "ENTRY(_start);" (or a target-
>> specific equivalent).  The angle I was coming from -- and I think Dan
>> was coming from -- is that that's a good thing.  You should get an error
>> if you use the default linker script and don't provide a definition of
>> its designated entry point.  You should also get an error if your
>> custom linker script has "ENTRY (foo)" and you don't define foo.
>> It sounds like you're OK with that.  (This is the bit that Ian says
>> will break existing builds though.  The user has blindly copied the
>> ENTRY statement from the default linker script, hasn't defined the
>> symbol, and is currently ignoring what is only a warning.)
>
> Right.  So we could two things:
>
>    1. Leave things the way they are.  People who feel that the current
>       linker behaviour is wrong could add --fatal-warnings to the linker
>       command line, although this might cause them more problems if there
>       are other warnings they currently do want to ignore.
>
>    2. Change the linker so that if the script specifies an ENTRY symbol
>       and that symbol is not defined then an error occurs.  Presumably
>       we would also provide a new command line option to change this
>       error back to a warning for compatibility with the old behaviour.
>       (The user of the linker may not have the option of fixing the
>       linker script, so without this new option they would be stuck).
>
> I can see the benefits of approach 2 but also the hassle it might cause 
> for already existing projects.  Maybe the default behaviour could be 
> controlled by a configure time option, so that toolchain builders could 
> choose whether the linker will default to generating an error or a 
> warning and there could be a command line switch to override this default ?

FWIW, I think it should just be a command-line option.

>> In other words, if you use a custom linker script with no ENTRY,
>> you already (silently) get an entry point of 0.  Does that make
>> the warning->error change OK with you?
>
> Are you saying here that any linker script that does not define an ENTRY 
> point will result in an error ?  Or just that if the script does not 
> define an ENTRY point then we do not issue a warning or error, so it 
> would be OK to issue an error if the script does define an ENTRY point, 
> but that symbol is not defined ?

The latter, sorry.  I wasn't suggesting any change to what the linker
does in the absence of an ENTRY directive.  I think it should continue
to sliently accept the code and use an entry point of 0.

Richard


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