a patch to set ELF header flags for empty linker output files
Nick Clifton
nickc@redhat.com
Tue Jan 16 11:40:00 GMT 2001
Hi H.J.
: > Detecting empty files might be a problem. Object files which only
: > contain sections which are going to be discarded are 'empty' as are
: > object files whose sections are thrown away due to garbage collection.
: >
:
: By "empty", I mean "has no contents." That is
:
: if (abfd->sections == NULL)
:
: and/or
:
: if (bfd_count_sections (abfd) == 0)
:
Right, but you could still have the case where a (non-archive) input
bfd is not empty, but will not contribute anything to the output
because all of its sections will be discarded. In such a case you do
not really want this bfd to contribute to the ELF header flags
either.
: A patch like the one below.
This looks OK, although I would suggest that you can move the no
sections test to the surrounding else statement, and so avoid the
whole save and restore of the error handler.
I do not think we should check this in just yet though - let's see what
other people have to say.
Cheers
Nick
More information about the Binutils
mailing list