[LLVMdev] Error with Gold Linker during LTO
Ian Lance Taylor
iant at google.com
Fri May 30 17:02:12 PDT 2014
On Fri, May 30, 2014 at 9:01 AM, Daniel Stewart <stewartd at codeaurora.org> wrote:
>
> We’ve found an error during the use of LTO that appears to happen only
> during the use of the gold linker.
>
>
>
> We essentially have a file which is compiled *without* LTO:
>
> f1() {
>
> h1();
>
> }
>
>
>
> And a second file that is compiled/linked *with* LTO:
>
> f2() {
>
> f1();
>
> h1();
>
> }
>
>
>
> This second file has the function h1() inlined during LTO.
>
>
>
> The resulting executable fails because the symbol for h1 is weak in the
> first .o and doesn’t exist in the second .o.
>
>
>
> All the actual code is below for reproducing the error.
>
>
>
> Is this an error in the linker itself or in how LLVM deals with the symbols?
>From your description, it's an error in how LLVM generates the
symbols. It sounds like the linker sees an object that refers to h1
but does not see any objects that define h1. There is nothing the
linker can do in such a case.
Ian
More information about the llvm-dev
mailing list