This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: a patch to set ELF header flags for empty linker output files
- To: hjl at valinux dot com
- Subject: Re: a patch to set ELF header flags for empty linker output files
- From: Nick Clifton <nickc at redhat dot com>
- Date: Tue, 16 Jan 2001 11:39:54 -0800
- CC: wilson at cygnus dot com, binutils at sources dot redhat dot com
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