[PATCH] D44227: [ELF] Convert {read, write}*be to endianness-aware read/write.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 8 19:07:56 PST 2018
MaskRay added inline comments.
================
Comment at: ELF/Target.h:184
+// Endianness-aware read/write.
+inline uint16_t read16(const void *P) {
+ return llvm::support::endian::read16(P, Config->Endianness);
----------------
ruiu wrote:
> Please use `uint8_t *` instead of `void *` for P.
```
../projects/lld/ELF/SyntheticSections.cpp:1767:5: error: no matching function for call to 'write32'
write32(Buckets + I->BucketIdx, I->Sym->DynsymIndex);
^~~~~~~
../projects/lld/ELF/Target.h:200:13: note: candidate function not viable: no known conversion from 'uint32_t *' (aka 'unsigned int *') to 'uint8_t *' (aka 'unsigned char *') for 1st argument
inline void write32(uint8_t *P, uint32_t V) {
^
../projects/lld/ELF/SyntheticSections.cpp:1841:3: error: no matching function for call to 'write32'
write32(P++, NumSymbols); // nbucket
^~~~~~~
../projects/lld/ELF/Target.h:200:13: note: candidate function not viable: no known conversion from 'uint32_t *' (aka 'unsigned int *') to 'uint8_t *' (aka 'unsigned char *') for 1st argument
inline void write32(uint8_t *P, uint32_t V) {
^
../projects/lld/ELF/SyntheticSections.cpp:1842:3: error: no matching function for call to 'write32'
write32(P++, NumSymbols); // nchain
```
uint8_t* uint32_t* uint16_t* typed pointers are all used. `void *` is a common type they will accept.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D44227
More information about the llvm-commits
mailing list