[llvm] 29c6f5c - [llvm-objcopy][MachO] Fix build

Alexander Shaposhnikov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 18:24:15 PDT 2020


Author: Alexander Shaposhnikov
Date: 2020-04-27T18:20:01-07:00
New Revision: 29c6f5c7fdd981ebf03f7f61ab4c328fad7555dc

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

LOG: [llvm-objcopy][MachO] Fix build

Some compilers are confused when the same name is used in different contexts.
Rename the field Section to unbreak the build.
(Caught by the buildbot http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/22374)

Added: 
    

Modified: 
    llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
    llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
    llvm/tools/llvm-objcopy/MachO/Object.h

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp b/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
index b12e39ccd488..cf32f00f3615 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
@@ -222,7 +222,7 @@ void MachOReader::setSymbolInRelocationInfo(Object &O) const {
             // if we encounter an invalid relocation.
             assert(SymbolNum >= 1 && SymbolNum <= Sections.size() &&
                    "Invalid section index.");
-            Reloc.Section = Sections[SymbolNum - 1];
+            Reloc.Sec = Sections[SymbolNum - 1];
           }
         }
 }

diff  --git a/llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp b/llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
index 4a8d1aeedb11..1cb67d0647f7 100644
--- a/llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
+++ b/llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
@@ -243,7 +243,7 @@ void MachOWriter::writeSections() {
         if (!RelocInfo.Scattered) {
           const uint32_t SymbolNum = RelocInfo.Extern
                                          ? (*RelocInfo.Symbol)->Index
-                                         : (*RelocInfo.Section)->Index;
+                                         : (*RelocInfo.Sec)->Index;
           RelocInfo.setPlainRelocationSymbolNum(SymbolNum, IsLittleEndian);
         }
         if (IsLittleEndian != sys::IsLittleEndianHost)

diff  --git a/llvm/tools/llvm-objcopy/MachO/Object.h b/llvm/tools/llvm-objcopy/MachO/Object.h
index 703c31fac0e4..a2c007459f2a 100644
--- a/llvm/tools/llvm-objcopy/MachO/Object.h
+++ b/llvm/tools/llvm-objcopy/MachO/Object.h
@@ -165,7 +165,7 @@ struct RelocationInfo {
   // The referenced symbol entry. Set if !Scattered && Extern.
   Optional<const SymbolEntry *> Symbol;
   // The referenced section. Set if !Scattered && !Extern.
-  Optional<const Section *> Section;
+  Optional<const Section *> Sec;
   // True if Info is a scattered_relocation_info.
   bool Scattered;
   // True if the r_symbolnum points to a section number (i.e. r_extern=0).


        


More information about the llvm-commits mailing list