[PATCH] D32907: [ELF] - Fix warnings when LLD compiled using gcc 7.1.0
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 5 06:44:13 PDT 2017
grimar created this revision.
Herald added subscribers: rengolin, aemerson.
I tried to compile LLD using gcc 7.1.0 and got 2 warnings:
[1/3] Building CXX object tools/lld/ELF/CMakeFiles/lldELF.dir/Target.cpp.o
/home/umb/LLVM/llvm/tools/lld/ELF/Target.cpp: In member function ‘virtual void lld::elf::{anonymous}::ARMTargetInfo::relocateOne(uint8_t*, uint32_t, uint64_t) const’:
/home/umb/LLVM/llvm/tools/lld/ELF/Target.cpp:1897:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
if ((read32le(Loc) & 0xfe000000) == 0xfa000000)
^~
/home/umb/LLVM/llvm/tools/lld/ELF/Target.cpp:1903:3: note: here
case R_ARM_JUMP24:
^~~~
/home/umb/LLVM/llvm/tools/lld/ELF/Target.cpp:1935:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
write16le(Loc + 2, (read16le(Loc + 2) & ~0x1000) | (Val & 1) << 12);
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/umb/LLVM/llvm/tools/lld/ELF/Target.cpp:1938:3: note: here
case R_ARM_THM_JUMP24:
^~~~
Them can be fixed easily. GCC wants to see "fallthrough" word in a comment that has nothing else. People in the web also uses "/* FALLTHRU */" comment for that. Way used in this patch looks to be consistent with rest LLVM code. Patch fixes the warnings for me.
https://reviews.llvm.org/D32907
Files:
ELF/Target.cpp
Index: ELF/Target.cpp
===================================================================
--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -1898,7 +1898,8 @@
// BLX (always unconditional) instruction to an ARM Target, select an
// unconditional BL.
write32le(Loc, 0xeb000000 | (read32le(Loc) & 0x00ffffff));
- // fall through as BL encoding is shared with B
+ // fallthrough
+ // as BL encoding is shared with B
case R_ARM_JUMP24:
case R_ARM_PC24:
case R_ARM_PLT32:
@@ -1932,7 +1933,8 @@
}
// Bit 12 is 0 for BLX, 1 for BL
write16le(Loc + 2, (read16le(Loc + 2) & ~0x1000) | (Val & 1) << 12);
- // Fall through as rest of encoding is the same as B.W
+ // fallthrough
+ // as rest of encoding is the same as B.W
case R_ARM_THM_JUMP24:
// Encoding B T4, BL T1, BLX T2: Val = S:I1:I2:imm10:imm11:0
// FIXME: Use of I1 and I2 require v6T2ops
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32907.97948.patch
Type: text/x-patch
Size: 894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170505/24a20c6e/attachment.bin>
More information about the llvm-commits
mailing list