[lld] f2b1a1e - [lld/mac] Use sectionType() more

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 11 08:15:58 PDT 2021


Author: Nico Weber
Date: 2021-06-11T11:15:47-04:00
New Revision: f2b1a1e10c5a4a3e96cc244adfbacfb5e97c3ca5

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

LOG: [lld/mac] Use sectionType() more

Not sure sectionType() carries its weight, but while we have it
we should use it consistently.

No behavior change.

Differential Revision: https://reviews.llvm.org/D104027

Added: 
    

Modified: 
    lld/MachO/ConcatOutputSection.cpp
    lld/MachO/InputSection.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/ConcatOutputSection.cpp b/lld/MachO/ConcatOutputSection.cpp
index 2ef43598c9d1..3b5a31d8be70 100644
--- a/lld/MachO/ConcatOutputSection.cpp
+++ b/lld/MachO/ConcatOutputSection.cpp
@@ -339,8 +339,8 @@ void ConcatOutputSection::writeTo(uint8_t *buf) const {
 // are actually merged. The logic presented here was written without
 // any form of informed research.
 void ConcatOutputSection::mergeFlags(InputSection *input) {
-  uint8_t baseType = flags & SECTION_TYPE;
-  uint8_t inputType = input->flags & SECTION_TYPE;
+  uint8_t baseType = sectionType(flags);
+  uint8_t inputType = sectionType(input->flags);
   if (baseType != inputType)
     error("Cannot merge section " + input->name + " (type=0x" +
           to_hexString(inputType) + ") into " + name + " (type=0x" +

diff  --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp
index 4cd6eb13eef4..0b08e4febac7 100644
--- a/lld/MachO/InputSection.cpp
+++ b/lld/MachO/InputSection.cpp
@@ -128,7 +128,7 @@ uint64_t CStringInputSection::getOffset(uint64_t off) const {
 }
 
 bool macho::isCodeSection(const InputSection *isec) {
-  uint32_t type = isec->flags & SECTION_TYPE;
+  uint32_t type = sectionType(isec->flags);
   if (type != S_REGULAR && type != S_COALESCED)
     return false;
 


        


More information about the llvm-commits mailing list