[PATCH] D89795: [jitlink][ELF] Allocate SHN_COMMON symbols as uninitialized blocks in __common
Stefan Gränitz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 22 12:19:20 PDT 2020
sgraenitz updated this revision to Diff 300067.
sgraenitz added a comment.
Drop unrelated switch case R_X86_64_32S
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89795/new/
https://reviews.llvm.org/D89795
Files:
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
Index: llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
+++ llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
@@ -517,6 +517,17 @@
// I am not sure on If this is going to hold as an invariant. Revisit.
if (!Name)
return Name.takeError();
+
+ // Allocate uninitialized common blocks.
+ if (SymRef.isCommon()) {
+ // st_value holds alignment constraints for SHN_COMMON symbols
+ Symbol &S =
+ G->addCommonSymbol(*Name, Scope::Default, getCommonSection(), 0,
+ SymRef.st_size, SymRef.getValue(), false);
+ JITSymbolTable[SymbolIndex] = &S;
+ continue;
+ }
+
// TODO: weak and hidden
if (SymRef.isExternal())
bindings = {Linkage::Strong, Scope::Default};
@@ -558,18 +569,12 @@
JITSymbolTable[SymbolIndex] = &S;
}
- // }
// TODO: The following has to be implmented.
// leaving commented out to save time for future patchs
/*
G->addAbsoluteSymbol(*Name, SymRef.getValue(), SymRef.st_size,
Linkage::Strong, Scope::Default, false);
-
- if(SymRef.isCommon()) {
- G->addCommonSymbol(*Name, Scope::Default, getCommonSection(), 0, 0,
- SymRef.getValue(), false);
- }
- */
+ */
}
}
return Error::success();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89795.300067.patch
Type: text/x-patch
Size: 1513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201022/01e4433b/attachment.bin>
More information about the llvm-commits
mailing list