[llvm-commits] [llvm] r171845 - /llvm/trunk/include/llvm/Object/ELF.h
Tim Northover
Tim.Northover at arm.com
Tue Jan 8 02:12:09 PST 2013
Author: tnorthover
Date: Tue Jan 8 04:12:09 2013
New Revision: 171845
URL: http://llvm.org/viewvc/llvm-project?rev=171845&view=rev
Log:
Allow ELF64 relocation type to be more than 8 bits.
Current targets don't have more than 256 relocations so they don't hit this
limit, but ELF64 actually allows more than 8 bits for a relocation type. These
were being truncated on AArch64.
Modified:
llvm/trunk/include/llvm/Object/ELF.h
Modified: llvm/trunk/include/llvm/Object/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=171845&r1=171844&r2=171845&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELF.h (original)
+++ llvm/trunk/include/llvm/Object/ELF.h Tue Jan 8 04:12:09 2013
@@ -387,14 +387,14 @@
// These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,
// and ELF64_R_INFO macros defined in the ELF specification:
- uint64_t getSymbol() const { return (r_info >> 32); }
- unsigned char getType() const {
- return (unsigned char) (r_info & 0xffffffffL);
+ uint32_t getSymbol() const { return (uint32_t) (r_info >> 32); }
+ uint32_t getType() const {
+ return (uint32_t) (r_info & 0xffffffffL);
}
- void setSymbol(uint64_t s) { setSymbolAndType(s, getType()); }
- void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); }
- void setSymbolAndType(uint64_t s, unsigned char t) {
- r_info = (s << 32) + (t&0xffffffffL);
+ void setSymbol(uint32_t s) { setSymbolAndType(s, getType()); }
+ void setType(uint32_t t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(uint32_t s, uint32_t t) {
+ r_info = ((uint64_t)s << 32) + (t&0xffffffffL);
}
};
@@ -1553,7 +1553,7 @@
::getRelocationTypeName(DataRefImpl Rel,
SmallVectorImpl<char> &Result) const {
const Elf_Shdr *sec = getSection(Rel.w.b);
- uint8_t type;
+ uint32_t type;
StringRef res;
switch (sec->sh_type) {
default :
More information about the llvm-commits
mailing list