[llvm] d9220b5 - [JITLink][MachO] Fix common symbol size plumbing.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 21:22:57 PST 2019
Author: Lang Hames
Date: 2019-12-19T20:41:59-08:00
New Revision: d9220b580b323d6b3b9f6a57c163439fad5b2bde
URL: https://github.com/llvm/llvm-project/commit/d9220b580b323d6b3b9f6a57c163439fad5b2bde
DIFF: https://github.com/llvm/llvm-project/commit/d9220b580b323d6b3b9f6a57c163439fad5b2bde.diff
LOG: [JITLink][MachO] Fix common symbol size plumbing.
This fixes the underlying bug that was exposed by 298e183e813.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
index a33eacc2f67d..fa04653fa7bd 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
@@ -873,7 +873,7 @@ class LinkGraph {
uint64_t Alignment, bool IsLive) {
auto &Sym = Symbol::constructCommon(
Allocator.Allocate<Symbol>(),
- createBlock(Section, Address, Size, Alignment, 0), Name, Size, S,
+ createBlock(Section, Size, Address, Alignment, 0), Name, Size, S,
IsLive);
Section.addSymbol(Sym);
return Sym;
diff --git a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
index 1881bd0b287e..701f108a9a21 100644
--- a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
@@ -313,7 +313,7 @@ Error MachOLinkGraphBuilder::graphifyRegularSymbols() {
return make_error<JITLinkError>("Anonymous common symbol at index " +
Twine(KV.first));
NSym.GraphSymbol = &G->addCommonSymbol(
- *NSym.Name, NSym.S, getCommonSection(), NSym.Value, 0,
+ *NSym.Name, NSym.S, getCommonSection(), 0, NSym.Value,
1ull << MachO::GET_COMM_ALIGN(NSym.Desc),
NSym.Desc & MachO::N_NO_DEAD_STRIP);
} else {
diff --git a/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s b/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s
index 5fabc6db1218..87ed036556e1 100644
--- a/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s
+++ b/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s
@@ -4,6 +4,11 @@
.section __TEXT,__text,regular,pure_instructions
+# Check that common symbols work.
+# jitlink-check: *{4}common_symbol = 0
+# jitlink-check: common_symbol[1:0] = 0
+.comm common_symbol,4,2
+
.align 4, 0x90
Lanon_func:
retq
More information about the llvm-commits
mailing list