[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 13:52:47 PDT 2022


smeenai created this revision.
smeenai added reviewers: MaskRay, peter.smith.
Herald added subscribers: StephenFan, arichardson, emaste.
Herald added a project: All.
smeenai requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

STB_HIPROC and STT_HIPROC are both 15, so we can fit the symbol binding
and type in 4 bits. This gives us an additional byte to use for Symbol
flags (without increasing the type's size), which I'll be making use of
in the next diff.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124042

Files:
  lld/ELF/Symbols.h


Index: lld/ELF/Symbols.h
===================================================================
--- lld/ELF/Symbols.h
+++ lld/ELF/Symbols.h
@@ -78,11 +78,11 @@
   //  - 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 type : 4; // symbol type
+  uint8_t stOther;  // st_other field value
 
   uint8_t symbolKind;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124042.423730.patch
Type: text/x-patch
Size: 654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/0f91f595/attachment.bin>


More information about the llvm-commits mailing list