gold cannot handle _start in a library

Ian Lance Taylor iant@google.com
Wed May 25 00:18:00 GMT 2011


Roland McGrath <mcgrathr@google.com> writes:

> Given:
>
> 	$ gcc -c -xc <(echo '_start(){}') -o start.o
> 	$ ar cq libstart.a start.o
> 	$ ./gold/ld-new -o foo libstart.a
>
> The output file foo is an empty ELF file.
> With:
>
> 	$ ./gold/ld-new -o foo -e _start libstart.a
> 	./gold/ld-new: warning: cannot find entry symbol '_start'
>
> The results are the same, plus the extra warning.
>
> BFD ld does not have this bug.
> I tested with today's trunk builds of gold and BFD ld.

Thanks.  Fixed like so.  Committed to mainline.

Ian


2011-05-24  Ian Lance Taylor  <iant@google.com>

	* archive.cc (Library_base::should_include_member): Pull in object
	from archive if it defines the entry symbol.
	* parameters.cc (Parameters::entry): New function.
	* parameters.h (class Parameters): Declare entry.
	* output.h (class Output_file_header): Remove entry_ field.
	* output.cc (Output_file_header::Output_file_header): Remove entry
	parameter.  Change all callers.
	(Output_file_header::entry): Use parameters->entry.
	* gold.cc (queue_middle_tasks): Likewise.
	* plugin.cc (Plugin_hook::run): Likewise.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 6836 bytes
Desc: patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20110525/d860fbc7/attachment.bin>


More information about the Binutils mailing list