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: Nick Clifton <nickc at redhat dot com>
- Subject: Re: a patch to set ELF header flags for empty linker output files
- From: "H . J . Lu" <hjl at valinux dot com>
- Date: Tue, 16 Jan 2001 13:06:03 -0800
- Cc: wilson at cygnus dot com, binutils at sources dot redhat dot com
- References: <200101162033.MAA04736@elmo.cygnus.com>
On Tue, Jan 16, 2001 at 12:33:30PM -0800, Nick Clifton wrote:
>
> : > : 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.
> : >
> :
> : Ok. Here is a new one.
>
> This looks good, but can you add a comment as well, just saying that
> since the input bfd is empty, it is not allowed to set the private
> data of the output bfd, or some words to that effect.
>
> Otherwise please consider this patch approved.
>
Here is the patch I checked in.
H.J.
----
Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.37
diff -u -p -r1.37 ldlang.c
--- ldlang.c 2001/01/14 04:36:34 1.37
+++ ldlang.c 2001/01/16 20:52:49
@@ -3474,8 +3474,11 @@ lang_check ()
bfd_printable_name (input_bfd), input_bfd,
bfd_printable_name (output_bfd));
}
- else
+ else if (bfd_count_sections (input_bfd))
{
+ /* If the input bfd has no contents, it shouldn't set the
+ private data of the output bfd. */
+
bfd_error_handler_type pfn = NULL;
/* If we aren't supposed to warn about mismatched input