[PATCH] D54569: [LLD] [ELF] Fix compilation with GCC 5

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 15 00:12:24 PST 2018


mstorsjo created this revision.
mstorsjo added reviewers: ruiu, jrtc27, atanasyan, grimar.
Herald added subscribers: kristof.beyls, arichardson, javed.absar, emaste.
Herald added a reviewer: espindola.

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:

  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>’


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D54569

Files:
  ELF/Target.h


Index: ELF/Target.h
===================================================================
--- ELF/Target.h
+++ ELF/Target.h
@@ -122,7 +122,7 @@
 
   // 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54569.174162.patch
Type: text/x-patch
Size: 491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181115/bac008d4/attachment.bin>


More information about the llvm-commits mailing list