[PATCH] D124042: [ELF] Shrink binding and type in Symbol
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 22:52:00 PDT 2022
smeenai updated this revision to Diff 423820.
smeenai added a comment.
Reorder type and binding
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124042/new/
https://reviews.llvm.org/D124042
Files:
lld/ELF/Symbols.h
Index: lld/ELF/Symbols.h
===================================================================
--- lld/ELF/Symbols.h
+++ lld/ELF/Symbols.h
@@ -73,15 +73,18 @@
uint32_t nameSize;
public:
+ // The next three fields have the same meaning as the ELF symbol attributes.
+ // type and binding are placed in this order to optimize generating st_info,
+ // which is defined as (binding << 4) + (type & 0xf).
+ uint8_t type : 4; // symbol type
+
// Symbol binding. This is not overwritten by replace() to track
// changes during resolution. In particular:
// - An undefined weak is still weak when it resolves to a shared library.
// - An undefined weak will not extract archive members, but we have to
// remember it is weak.
- uint8_t binding;
+ uint8_t binding : 4;
- // The following fields have the same meaning as the ELF symbol attributes.
- uint8_t type; // symbol type
uint8_t stOther; // st_other field value
uint8_t symbolKind;
@@ -236,8 +239,8 @@
protected:
Symbol(Kind k, InputFile *file, StringRef name, uint8_t binding,
uint8_t stOther, uint8_t type)
- : file(file), nameData(name.data()), nameSize(name.size()),
- binding(binding), type(type), stOther(stOther), symbolKind(k),
+ : file(file), nameData(name.data()), nameSize(name.size()), type(type),
+ binding(binding), stOther(stOther), symbolKind(k),
visibility(stOther & 3), isPreemptible(false),
isUsedInRegularObj(false), used(false), exportDynamic(false),
inDynamicList(false), referenced(false), traced(false),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124042.423820.patch
Type: text/x-patch
Size: 1586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/6fd8a8c9/attachment.bin>
More information about the llvm-commits
mailing list