This is the mail archive of the binutils@sources.redhat.com 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]

Re: Patch: Check input format against output


"H . J . Lu" <hjl@lucon.org> writes:

> Isn't that what my patch does? I am enclosing here again. I don't see
> the significant difference between link_input_bfd in elf32.c/elf64.c
> and elf32-gen.c/elf64-gen.c.

Your patch prohibits me from linking a SPARC ELF input into a i386 ELF
output file.  I believe that is wrong.  When I do that, I should get a
warning, but it should be permitted.  The GNU linker in general
permits linking different types of object files together.

If we decide that the GNU linker should not permit linking different
types of object files together, then we can easily check that in
lang_check in ld/ldlang.c, in which case your patch is not necessary.

I think the problem in this case is that the generic ELF target can
not be linked, because there is no information about relocations.

> If it is defined in elf32-gen.c and
> elf64-gen.c, how it will be used? Shouldn't it be called by
> elf_link_input_bfd?

You're right, sorry, I didn't mean link_input_bfd.  I meant
link_add_symbols.  However, I see that there is no easy way to
override the add_symbols routine.  We could add one, or we could add
an add_symbol_hook to elf32-gen.c, or we could change
add_object_symbols to check for the generic ELF target.

Ian


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