This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gold linker 2.22 regressed for DragonFly
- From: Ian Lance Taylor <iant at google dot com>
- To: John Marino <binutils at marino dot st>
- Cc: binutils at sourceware dot org
- Date: Mon, 02 Jan 2012 10:38:16 -0800
- Subject: Re: gold linker 2.22 regressed for DragonFly
- References: <4ED7FCA6.8090706@marino.st> <mcrmxbbk1rp.fsf@dhcp-172-18-216-180.mtv.corp.google.com> <4ED88FA5.8050408@marino.st> <mcrpqg7hwux.fsf@dhcp-172-18-216-180.mtv.corp.google.com> <4EFF3AF3.3080404@marino.st> <mcrsjjy3ll7.fsf@dhcp-172-18-216-180.mtv.corp.google.com> <4F017A8B.1000905@marino.st>
John Marino <binutils@marino.st> writes:
> On 1/2/2012 3:05 AM, Ian Lance Taylor wrote:
>> John Marino <binutils@marino.st> writes:
>>
>>> On 12/2/2011 3:27 PM, Ian Lance Taylor wrote:
>>>> John Marino <binutils@marino.st> writes:
>>>>
>>>>> I need to stress that gold built with ld does not have this problem.
>>>>> It's only gold built with gold that segfaults. Does that affect your
>>>>> answer?
>>>>
>>>> Try using the gold option --no-ctors-in-init-array.
>>>>
>>>> Ian
>>>
>>> I'm sorry that I had to put this away for a while, but I've picked it
>>> back up today.
>>>
>>> Gold build with ld will function without segfaults and produces executables.
>>> Gold build with gold segfaults. It ignores all command-line options.
>>>
>>> I modified the makefile to set optimization level to 0. That let me see
>>> the values of variables in gdb. Using gdb on ld-new (gold built with
>>> ld), "print options" on gdb shows a properly defined option set of
>>> General_options class. Doing the same for ld1 (gold built by gold)
>>> shows every single option with null pointers. Not even strings like
>>> "Report usage information" and "Report version information" are included.
>>>
>>> So the problem lies in options.h within the General_options class. I
>>> have no idea what ld-new is doing wrong such that ld1 can't built its
>>> option set. These definitions are built with macros though.
>>
>>
>> Did you try using the --no-ctors-in-init-array option?
>>
>> Ian
>
> Yes, I modified the gold makefile to add that to ld1_LDFLAGS and it
> makes no difference. The resultant ld1 will still segfault as it tries
> to build ld2.
What linker are you using to build ld1?
You said earlier that gold built with ld does not have a problem. Only
gold build with gold segfaults. I am suggesting that you use
--no-ctors-in-init-array when running gold. In fact you should try just
editing options.h to make --no-ctors-in-init-array the default to see if
that fixes all your problems.
Otherwise, the problem you describe suggests that global constructors
are not running correctly when running gold itself, but I don't know why
that would happen if you are not linking gold itself with gold.
Ian