[gold][patch] Fix non-PIC warning to print only when building position-independent output

Daniel Jacobowitz drow@false.org
Thu Mar 26 14:56:00 GMT 2009


On Wed, Mar 25, 2009 at 05:26:22PM -0700, Cary Coutant wrote:
> If a missing -fPIC really is the problem, we will still print that. If
> you're building a non-position-independent executable, however, you
> shouldn't be told to recompile the code with -fPIC, because that's not
> supposed to be required for code in an executable. Instead, it points
> to a problem either with hand-written assembly code (most likely, I
> think), or with the compiler, or with the linker. If the only
> possibility were a linker bug, I could just put an assert here and let
> the linker die:
> 
> +      gold_assert(parameters->options().output_is_position_independent());
> +      object->error(_("requires unsupported dynamic reloc; "
> +                      "recompile with -fPIC"));
> +      this->issued_unsupp_reloc_error_ = true;
> 
> I don't think that's the only (or even the most likely) possibility, though.

How can hand-written or compiler-generated assembly code require an
unsupported dynamic relocation in a non-PIC executable?  On all
platforms I can think of except for VxWorks RTPs, both PIC and non-PIC
inputs are valid for executables.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Binutils mailing list