[llvm-branch-commits] [llvm] 1185d3f - [llvm-readobj] - Fix the compilation with GCC < 7.0.

Georgii Rymar via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 15 01:04:42 PST 2021


Author: Georgii Rymar
Date: 2021-01-15T11:58:04+03:00
New Revision: 1185d3f43d2186fa9291fe7779abf48d9b962ef4

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

LOG: [llvm-readobj] - Fix the compilation with GCC < 7.0.

This addressed post commit comments for D93900.

GCC had an issue and requires placing a specialization of
`printUnwindInfo` to a namespace to compile:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Added: 
    

Modified: 
    llvm/tools/llvm-readobj/ELFDumper.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index e03a3d1edc7e..9351338590ae 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -2536,6 +2536,8 @@ template <class ELFT> void ELFDumper<ELFT>::printUnwindInfo() {
   Ctx.printUnwindInformation();
 }
 
+// The namespace is needed to fix the compilation with GCC older than 7.0+.
+namespace {
 template <> void ELFDumper<ELF32LE>::printUnwindInfo() {
   if (Obj.getHeader().e_machine == EM_ARM) {
     ARM::EHABI::PrinterContext<ELF32LE> Ctx(W, Obj, ObjF.getFileName(),
@@ -2545,6 +2547,7 @@ template <> void ELFDumper<ELF32LE>::printUnwindInfo() {
   DwarfCFIEH::PrinterContext<ELF32LE> Ctx(W, ObjF);
   Ctx.printUnwindInformation();
 }
+} // namespace
 
 template <class ELFT> void ELFDumper<ELFT>::printNeededLibraries() {
   ListScope D(W, "NeededLibraries");


        


More information about the llvm-branch-commits mailing list