[lld] r249996 - Handle a crash in conflict detection with archive members.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 11 14:17:16 PDT 2015
You can now remove getFirstELF function.
On Sun, Oct 11, 2015 at 1:19 PM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Sun Oct 11 15:19:20 2015
> New Revision: 249996
>
> URL: http://llvm.org/viewvc/llvm-project?rev=249996&view=rev
> Log:
> Handle a crash in conflict detection with archive members.
>
> Added:
> lld/trunk/test/elf2/incompatible-ar-first.s
> Modified:
> lld/trunk/ELF/Config.h
> lld/trunk/ELF/InputFiles.h
> lld/trunk/ELF/SymbolTable.cpp
>
> Modified: lld/trunk/ELF/Config.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=249996&r1=249995&r2=249996&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Config.h (original)
> +++ lld/trunk/ELF/Config.h Sun Oct 11 15:19:20 2015
> @@ -18,6 +18,7 @@
> namespace lld {
> namespace elf2 {
>
> +class ELFFileBase;
> class SymbolBody;
>
> enum ELFKind {
> @@ -30,6 +31,7 @@ enum ELFKind {
>
> struct Configuration {
> SymbolBody *EntrySym = nullptr;
> + ELFFileBase *FirstElf = nullptr;
> llvm::StringRef DynamicLinker;
> llvm::StringRef Entry;
> llvm::StringRef Emulation;
>
> Modified: lld/trunk/ELF/InputFiles.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=249996&r1=249995&r2=249996&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/InputFiles.h (original)
> +++ lld/trunk/ELF/InputFiles.h Sun Oct 11 15:19:20 2015
> @@ -249,6 +249,9 @@ std::unique_ptr<ELFFileBase> createELFFi
> error("Invalid file class: " + MB.getBufferIdentifier());
> }
>
> + if (!Config->FirstElf)
> + Config->FirstElf = Ret.get();
> +
> if (Config->ElfKind == ELFNoneKind) {
> Config->ElfKind = Ret->getELFKind();
> Config->EMachine = Ret->getEMachine();
>
> Modified: lld/trunk/ELF/SymbolTable.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=249996&r1=249995&r2=249996&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/SymbolTable.cpp (original)
> +++ lld/trunk/ELF/SymbolTable.cpp Sun Oct 11 15:19:20 2015
> @@ -35,7 +35,7 @@ void SymbolTable<ELFT>::addFile(std::uni
> StringRef A = E->getName();
> StringRef B = Config->Emulation;
> if (B.empty())
> - B = getFirstELF()->getName();
> + B = Config->FirstElf->getName();
> error(A + " is incompatible with " + B);
> }
> }
>
> Added: lld/trunk/test/elf2/incompatible-ar-first.s
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/incompatible-ar-first.s?rev=249996&view=auto
>
> ==============================================================================
> --- lld/trunk/test/elf2/incompatible-ar-first.s (added)
> +++ lld/trunk/test/elf2/incompatible-ar-first.s Sun Oct 11 15:19:20 2015
> @@ -0,0 +1,11 @@
> +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/archive.s
> -o %ta.o
> +// RUN: llvm-ar rc %t.a %ta.o
> +// RUN: llvm-mc -filetype=obj -triple=i686-linux %s -o %tb.o
> +// RUN: not ld.lld2 %t.a %tb.o 2>&1 | FileCheck %s
> +
> +// We used to crash when
> +// * The first object seen by the symbol table is from an archive.
> +// * -m was not used.
> +// CHECK: a.o is incompatible with {{.*}}b.o
> +
> +// REQUIRES: x86
>
>
> _______________________________________________
> 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/20151011/b9663ccd/attachment.html>
More information about the llvm-commits
mailing list