[lld] r268060 - Fix producing undefined reference to __progname.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 09:34:30 PDT 2016


Please check in the source code of the so file and leave a comment how to
build it.

On Fri, Apr 29, 2016 at 9:23 AM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rafael
> Date: Fri Apr 29 11:23:31 2016
> New Revision: 268060
>
> URL: http://llvm.org/viewvc/llvm-project?rev=268060&view=rev
> Log:
> Fix producing undefined reference to __progname.
>
> We were not producing them if the library had version info.
>
> Added:
>     lld/trunk/test/ELF/Inputs/progname-ver.so   (with props)
> Modified:
>     lld/trunk/ELF/InputFiles.cpp
>     lld/trunk/test/ELF/progname.s
>
> Modified: lld/trunk/ELF/InputFiles.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=268060&r1=268059&r2=268060&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/InputFiles.cpp (original)
> +++ lld/trunk/ELF/InputFiles.cpp Fri Apr 29 11:23:31 2016
> @@ -490,6 +490,12 @@ template <class ELFT> void SharedFile<EL
>    uint32_t NumSymbols = std::distance(Syms.begin(), Syms.end());
>    SymbolBodies.reserve(NumSymbols);
>    for (const Elf_Sym &Sym : Syms) {
> +    StringRef Name = check(Sym.getName(this->StringTable));
> +    if (Sym.isUndefined()) {
> +      Undefs.push_back(Name);
> +      continue;
> +    }
> +
>      unsigned VersymIndex = 0;
>      if (Versym) {
>        VersymIndex = Versym->vs_index;
> @@ -498,11 +504,7 @@ template <class ELFT> void SharedFile<EL
>        if (VersymIndex == 0 || (VersymIndex & VERSYM_HIDDEN))
>          continue;
>      }
> -    StringRef Name = check(Sym.getName(this->StringTable));
> -    if (Sym.isUndefined())
> -      Undefs.push_back(Name);
> -    else
> -      SymbolBodies.emplace_back(this, Name, Sym, Verdefs[VersymIndex]);
> +    SymbolBodies.emplace_back(this, Name, Sym, Verdefs[VersymIndex]);
>    }
>  }
>
>
> Added: lld/trunk/test/ELF/Inputs/progname-ver.so
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/progname-ver.so?rev=268060&view=auto
>
> ==============================================================================
> Binary files lld/trunk/test/ELF/Inputs/progname-ver.so (added) and
> lld/trunk/test/ELF/Inputs/progname-ver.so Fri Apr 29 11:23:31 2016 differ
>
> Propchange: lld/trunk/test/ELF/Inputs/progname-ver.so
>
> ------------------------------------------------------------------------------
>     svn:executable = *
>
> Modified: lld/trunk/test/ELF/progname.s
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/progname.s?rev=268060&r1=268059&r2=268060&view=diff
>
> ==============================================================================
> --- lld/trunk/test/ELF/progname.s (original)
> +++ lld/trunk/test/ELF/progname.s Fri Apr 29 11:23:31 2016
> @@ -5,6 +5,9 @@
>  // RUN: ld.lld -o %t %t.o %t2.so
>  // RUN: llvm-readobj -dyn-symbols %t | FileCheck %s
>
> +// RUN: ld.lld -o %t %t.o %p/Inputs/progname-ver.so
> +// RUN: llvm-readobj -dyn-symbols %t | FileCheck %s
> +
>  // CHECK:      Name:     __progname@
>  // CHECK-NEXT: Value:    0x11000
>  // CHECK-NEXT: Size:     0
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160429/ff53c136/attachment.html>


More information about the llvm-commits mailing list