This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld won't complain if asked to link obj files of different arches
On Wed, Dec 18, 2002 at 03:41:39PM +0000, Nick Clifton wrote:
> Hi Guys,
>
> > Richard Henderson <rth@redhat.com> writes:
> >
> > On Tue, Dec 17, 2002 at 07:40:19PM +0000, Nick Clifton wrote:
> > > It is not desirable, but I suspect that if we change the behavior
> > > something will break. ie there are probably projects somewhere that
> > > need this behavior.
> >
> > Seems to me it would be best to default to not allowing this,
> > and to add a link switch that explicitly allows it, and to not
> > confuse the issue on a per-port basis.
>
> OK - well how about this (unapplied) patch ? It changes the default
> behavior to reject unknown formats and adds a new switch to allow
> them.
>
> With the patch applied, Alex's test case now gives:
>
> % ld-new foo.o bar.o
> ld-new: warning: unknown architecture of input file `bar.o' is incompatible with mn10300 output
> ld-new: warning: cannot find entry symbol _start; defaulting to 00000000
> and:
> % ld-new foo.o bar.o --accept-unknown-input-format
> ld-new: warning: cannot find entry symbol _start; defaulting to 00000000
>
> The patch does not introduce any new failures in the linker or
> binutils testsuite for the native x86 linux toolchain or the
> mn10300-elf toolchain. I have not added a testcase, because I am not
> sure how to generate an 'unknown' format binary file in a reliable
> way.
>
I am not sure if it is necessary. I'd like to see a real testcase
first. That is the linker doesn't complain and the resulting binary
is wrong. For all I know, the linker will complain if it can't handle
the input.
H.J.