[patch] First step to fix pr11866 during LTO

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Sep 5 14:29:59 PDT 2013


> No. It calls it when the only reason it was going to call
> lto_codegen_add_must_preserve_symbol instead is if it wants it for the
> symbol table.
>
> In the previous example, LLVM alone cannot tell the difference from F
> and G. It needs the linker to call
> lto_codegen_add_must_preserve_symbol on the one that is used from a .o
> (F) and  lto_codegen_add_symtab_symbol on the one that it wants just
> to put in a symbol table (G).

Maybe this is easier to see in code. The LLVM gold plugin after the patch has:

  if (I->syms[i].resolution == LDPR_PREVAILING_DEF) {
        lto_codegen_add_must_preserve_symbol(code_gen, I->syms[i].name);

        if (options::generate_api_file)
          api_file << I->syms[i].name << "\n";
      } else if (I->syms[i].resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) {
        lto_codegen_add_symtab_symbol(code_gen, I->syms[i].name);

        if (options::generate_api_file)
          api_file << I->syms[i].name << " symtab only\n";
      }

Cheers,
Rafael



More information about the llvm-commits mailing list