gold linker 2.22 regressed for DragonFly

John Marino binutils@marino.st
Fri Dec 2 08:44:00 GMT 2011


On 12/2/2011 5:58 AM, Ian Lance Taylor wrote:
> John Marino<binutils@marino.st>  writes:
>
> string_to_object_format is being called with a NULL pointer.
>
>> #1  0x000000000053b5e2 in format_enum (this=0x62a5fe)
>>      at ../../binutils-2.22/gold/options.cc:937
> This line is
>    return General_options::string_to_object_format(this->format());
> so this->format() is return a NULL string.
>
> That should not happen.  this->format() is going to return the value of
> this->format_.value.  That should be initialized to "elf" and nothing
> should ever change it to NULL.  In this case "this" appears to refer to
> the static variable Position_dependent_options::default_options_.
>
> I'm not aware of anything that has changed in this area between binutils
> 2.21 and 2.22.  The same code is in 2.21.
>
> I guess I would debug it by verifying that
> Position_independent_options::default_options_.format_.value is in fact
> initialized to "elf".  If not, why not?  If it is, when does it change?
>
> Ian

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?  By the way, the format initialization is all happening via 
macro, so I had to "gcc -E" to even see what it's doing.  The code looks 
fine to me.

I'll try to analysis gold-by-gold with gdb later to see if I can get to 
the elf initiation or if it just skips it altogether.  I suspect that 
it's never initialized.

John





More information about the Binutils mailing list