[PATCH] D45845: ELFObjectWriter: Allow one unique symver per symbol
Vlad Tsyrklevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 19 15:52:01 PDT 2018
vlad.tsyrklevich created this revision.
vlad.tsyrklevich added reviewers: pcc, tejohnson.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Only allow a single unique .symver alias per symbol. This matches the
behavior of gas. I noticed that we ignored multiple mismatched symver
directives looking at https://reviews.llvm.org/D45798
Repository:
rL LLVM
https://reviews.llvm.org/D45845
Files:
lib/MC/ELFObjectWriter.cpp
test/MC/ELF/multiple-different-symver.s
test/MC/ELF/multiple-equiv-symver.s
Index: test/MC/ELF/multiple-equiv-symver.s
===================================================================
--- /dev/null
+++ test/MC/ELF/multiple-equiv-symver.s
@@ -0,0 +1,6 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - 2>&1 | FileCheck %s
+
+// CHECK-NOT: Multiple symbol versions defined for foo
+
+.symver foo, foo at 1
+.symver foo, foo at 1
Index: test/MC/ELF/multiple-different-symver.s
===================================================================
--- /dev/null
+++ test/MC/ELF/multiple-different-symver.s
@@ -0,0 +1,6 @@
+// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t 2>&1 | FileCheck %s
+
+// CHECK: Multiple symbol versions defined for foo
+
+.symver foo, foo at 1
+.symver foo, foo at 2
Index: lib/MC/ELFObjectWriter.cpp
===================================================================
--- lib/MC/ELFObjectWriter.cpp
+++ lib/MC/ELFObjectWriter.cpp
@@ -420,6 +420,10 @@
!Rest.startswith("@@@"))
report_fatal_error("A @@ version cannot be undefined");
+ if (Renames.count(&Symbol) && Renames[&Symbol] != Alias)
+ report_fatal_error(llvm::Twine("Multiple symbol versions defined for ") +
+ Symbol.getName());
+
Renames.insert(std::make_pair(&Symbol, Alias));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45845.143179.patch
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180419/010bf454/attachment.bin>
More information about the llvm-commits
mailing list