A tough bug in mixing two binary formats in the linker

H.J. Lu hjl@nynexst.com
Wed Nov 30 19:21:00 GMT 1994


There is a very tough bug dealing with mixing two binary formats. 
bfd_check_format_matches () does a very poor job checking the binary
format used by the contents in an archive.

If two different binary format .o files are archived by the same
ar, from headers two .a files look the same. If the linker is called
with:

ld -m binary_format_1 foo.a

which foo.a is in binary_format_2, bfd_check_format_matches () will
match foo.a with binary_format_1 since it only looks at the
header of foo.a.

One possible solution is set _bfd_check_format [bfd_archive] to
a function which not only checks the header of an archive, but
also check what's inside. If bfd_generic_archive_p () is only
used for that purpose, it should be fixed. Has anyone been working
on it? I don't know enough about BFD. Probably my patch will break
other stuff :-(.

BTW, if there are more than one binary formats in an archive, we will
be in a even bigger mess :-(.

-- 
H.J. Lu
NYNEX Science and Technology, Inc.			hjl@nynexst.com




More information about the Gas2 mailing list