[lld] 8c4638c - [lld-macho] Clean up comments

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 09:13:26 PST 2021


Author: Jez Ng
Date: 2021-02-22T12:13:17-05:00
New Revision: 8c4638c3676ef8071a4aba2070da09abe8fe3244

URL: https://github.com/llvm/llvm-project/commit/8c4638c3676ef8071a4aba2070da09abe8fe3244
DIFF: https://github.com/llvm/llvm-project/commit/8c4638c3676ef8071a4aba2070da09abe8fe3244.diff

LOG: [lld-macho] Clean up comments

Added: 
    

Modified: 
    lld/MachO/SyntheticSections.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 3281f116833c..0026cd04dc9a 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -200,7 +200,7 @@ void RebaseSection::writeTo(uint8_t *buf) const {
 NonLazyPointerSectionBase::NonLazyPointerSectionBase(const char *segname,
                                                      const char *name)
     : SyntheticSection(segname, name) {
-  align = WordSize; // vector of pointers / mimic ld64
+  align = WordSize;
   flags = MachO::S_NON_LAZY_SYMBOL_POINTERS;
 }
 
@@ -405,7 +405,9 @@ StubsSection::StubsSection()
     : SyntheticSection(segment_names::text, "__stubs") {
   flags = MachO::S_SYMBOL_STUBS | MachO::S_ATTR_SOME_INSTRUCTIONS |
           MachO::S_ATTR_PURE_INSTRUCTIONS;
-  align = 4; // machine instructions / mimic ld64
+  // The stubs section comprises machine instructions, which are aligned to
+  // 4 bytes on the archs we care about.
+  align = 4;
   reserved2 = target->stubSize;
 }
 
@@ -431,7 +433,7 @@ bool StubsSection::addEntry(Symbol *sym) {
 StubHelperSection::StubHelperSection()
     : SyntheticSection(segment_names::text, "__stub_helper") {
   flags = MachO::S_ATTR_SOME_INSTRUCTIONS | MachO::S_ATTR_PURE_INSTRUCTIONS;
-  align = 4; // machine instructions / mimic ld64
+  align = 4; // This section comprises machine instructions
 }
 
 uint64_t StubHelperSection::getSize() const {
@@ -472,12 +474,12 @@ ImageLoaderCacheSection::ImageLoaderCacheSection() {
   uint8_t *arr = bAlloc.Allocate<uint8_t>(WordSize);
   memset(arr, 0, WordSize);
   data = {arr, WordSize};
-  align = WordSize; // pointer / mimic ld64
+  align = WordSize;
 }
 
 LazyPointerSection::LazyPointerSection()
     : SyntheticSection(segment_names::data, "__la_symbol_ptr") {
-  align = WordSize; // vector of pointers / mimic ld64
+  align = WordSize;
   flags = MachO::S_LAZY_SYMBOL_POINTERS;
 }
 


        


More information about the llvm-commits mailing list