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


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

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