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: a patch to set ELF header flags for empty linker output files


>The problem with that is what happens if the object files contain
>incompatible flags ?  You would end up with an executable with an
>illegal set of flags, which would be just as bad.

No, we will get an error from bfd_merge_private_bfd_data.  We can set the
error handler to print whatever message we want, so we can print a message
saying something like "ambiguous object file format for empty output file".

On the linux ia64 kernel list, HJ mentioned another problem with my approach.
It doesn't work if the archive is empty.  That seems a little more reasonable
than mixing object files in an archive though, so this one we might want to
make work.  We would have to ignore empty input files to make this work.

>I actually like this idea.  Since the file is empty it cannot
>contribute anything to the final executable (in terms of code, data,
>symbols, etc), so why should it be able to contribute ELF header flags ?

It seems a little strange to me to ignore an input file.  However, I just
checked, and I noticed that
	 touch tmp.s
	 as tmp.s
does not produce an empty output file.  It produces one with zero-size text,
data, and bss sections.  If ld -r on an archive is the only way to produce
an empty output file, then that makes ignoring it more reasonable.

>  "warning - empty and incompatible object file <foo> detected during
>  link, ignored."

If the linux kernel hackers are willing to accept a warning.  They might be
annoyed that something which has always worked before is now suddenly getting
a warning.  I'd have to check.

Jim

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