[lld] r346934 - [ELF] Fix compilation with GCC 5

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 15 00:20:18 PST 2018


Author: mstorsjo
Date: Thu Nov 15 00:20:18 2018
New Revision: 346934

URL: http://llvm.org/viewvc/llvm-project?rev=346934&view=rev
Log:
[ELF] Fix compilation with GCC 5

Remove the default initializer for TrapInstr; all subclasses overwrite
the defaults in their constructors anyway.

This fixes compilation errors like these, with GCC 5.4 on Ubuntu 16.04,
present since SVN r346893:

 In file included from ../tools/lld/ELF/Arch/AArch64.cpp:12:0:
 ../tools/lld/ELF/Target.h:125:49: error: array must be initialized with a brace-enclosed initializer
    std::array<uint8_t, 4> TrapInstr = {0, 0, 0, 0};
                                                  ^
 ../tools/lld/ELF/Target.h:125:49: error: too many initializers for ‘std::array<unsigned char, 4ul>’

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

Modified:
    lld/trunk/ELF/Target.h

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=346934&r1=346933&r2=346934&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Nov 15 00:20:18 2018
@@ -122,7 +122,7 @@ public:
 
   // A 4-byte field corresponding to one or more trap instructions, used to pad
   // executable OutputSections.
-  std::array<uint8_t, 4> TrapInstr = {0, 0, 0, 0};
+  std::array<uint8_t, 4> TrapInstr;
 
   // If a target needs to rewrite calls to __morestack to instead call
   // __morestack_non_split when a split-stack enabled caller calls a




More information about the llvm-commits mailing list