[llvm] r251117 - [llvm-readobj] Don't cast qualifiers away. Now gcc is happy again.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 09:52:23 PDT 2015
Author: davide
Date: Fri Oct 23 11:52:22 2015
New Revision: 251117
URL: http://llvm.org/viewvc/llvm-project?rev=251117&view=rev
Log:
[llvm-readobj] Don't cast qualifiers away. Now gcc is happy again.
Reported by: mikael.holmen at ericsson.com
Modified:
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=251117&r1=251116&r2=251117&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Fri Oct 23 11:52:22 2015
@@ -321,7 +321,7 @@ static void printVersionSymbolSection(EL
W.printNumber("Link", Sec->sh_link);
const typename ELFO::Elf_Shdr *DynSymSec = Dumper->getDotDynSymSec();
- uint8_t *P = (uint8_t *)Obj->base() + Sec->sh_offset;
+ const uint8_t *P = (const uint8_t *)Obj->base() + Sec->sh_offset;
ErrorOr<StringRef> StrTableOrErr =
Obj->getStringTableForSymtab(*DynSymSec);
error(StrTableOrErr.getError());
@@ -359,9 +359,10 @@ static void printVersionDefinitionSectio
if (Dyn.d_tag == DT_VERDEFNUM)
verdef_entries = Dyn.d_un.d_val;
}
- uint8_t *SecStartAddress = (uint8_t *)Obj->base() + Sec->sh_offset;
- uint8_t *SecEndAddress = SecStartAddress + Sec->sh_size;
- uint8_t *P = SecStartAddress;
+ const uint8_t *SecStartAddress =
+ (const uint8_t *)Obj->base() + Sec->sh_offset;
+ const uint8_t *SecEndAddress = SecStartAddress + Sec->sh_size;
+ const uint8_t *P = SecStartAddress;
ErrorOr<const typename ELFO::Elf_Shdr *> StrTabOrErr =
Obj->getSection(Sec->sh_link);
error(StrTabOrErr.getError());
@@ -378,9 +379,9 @@ static void printVersionDefinitionSectio
W.printNumber("Flags", VD->vd_flags);
W.printNumber("Index", VD->vd_ndx);
W.printNumber("Cnt", VD->vd_cnt);
- W.printString("Name", StringRef((char *)(
- Obj->base() + (*StrTabOrErr)->sh_offset +
- VD->getAux()->vda_name)));
+ W.printString("Name", StringRef((const char *)(Obj->base() +
+ (*StrTabOrErr)->sh_offset +
+ VD->getAux()->vda_name)));
P += VD->vd_next;
}
}
More information about the llvm-commits
mailing list