[PATCH][gold] Fix an internal error in the constructor of Target_arm.

Cary Coutant ccoutant@gmail.com
Mon Dec 19 23:09:00 GMT 2016


> In some cases, a Target object may be created before all the options
> are read, for instance, if the used linker script contains
> an OUTPUT_FORMAT statement. Consequently, the initialization for target
> relocations cannot be done in the constructor and should be delayed.

There's a hook Target::do_select_as_default_target() for
initializations like this. It isn't called until we are reading the
first object file, which is after the command line options have all
been parsed.

I think a much simpler fix is to move the code that initializes
target1_reloc_ and target2_reloc_ from the constructor into
Target_arm::do_select_as_default_target().

-cary



More information about the Binutils mailing list