diff options
| author | Tim Northover <Tim.Northover@arm.com> | 2013-01-22 12:01:43 +0000 | 
|---|---|---|
| committer | Tim Northover <Tim.Northover@arm.com> | 2013-01-22 12:01:43 +0000 | 
| commit | 984b4721613cffa339c4721b4f4dfc43b231b5c1 (patch) | |
| tree | dbbb256f40c1dfb9e1272d5a4831cd2386c427ed | |
| parent | 0b8206029ba79c78022881130ccb69862eaf60f2 (diff) | |
| download | bcm5719-llvm-984b4721613cffa339c4721b4f4dfc43b231b5c1.tar.gz bcm5719-llvm-984b4721613cffa339c4721b4f4dfc43b231b5c1.zip  | |
Fix truncation of relocation types in Support/ELF.h
This is a follow-up to r171845, which fixes the same issue in the Support code.
Only targets with >256 relocations (principally AArch64) should be affected.
llvm-svn: 173151
| -rw-r--r-- | llvm/include/llvm/Support/ELF.h | 28 | 
1 files changed, 14 insertions, 14 deletions
diff --git a/llvm/include/llvm/Support/ELF.h b/llvm/include/llvm/Support/ELF.h index 4b04c819c1b..005b3adcf71 100644 --- a/llvm/include/llvm/Support/ELF.h +++ b/llvm/include/llvm/Support/ELF.h @@ -1111,14 +1111,14 @@ struct Elf64_Rel {    // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,    // and ELF64_R_INFO macros defined in the ELF specification: -  Elf64_Xword getSymbol() const { return (r_info >> 32); } -  unsigned char getType() const { -    return (unsigned char) (r_info & 0xffffffffL); +  Elf64_Word getSymbol() const { return (r_info >> 32); } +  Elf64_Word getType() const { +    return (Elf64_Word) (r_info & 0xffffffffL);    } -  void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); } -  void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); } -  void setSymbolAndType(Elf64_Xword s, unsigned char t) { -    r_info = (s << 32) + (t&0xffffffffL); +  void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); } +  void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); } +  void setSymbolAndType(Elf64_Word s, Elf64_Word t) { +    r_info = ((Elf64_Xword)s << 32) + (t&0xffffffffL);    }  }; @@ -1130,14 +1130,14 @@ struct Elf64_Rela {    // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,    // and ELF64_R_INFO macros defined in the ELF specification: -  Elf64_Xword getSymbol() const { return (r_info >> 32); } -  unsigned char getType() const { -    return (unsigned char) (r_info & 0xffffffffL); +  Elf64_Word getSymbol() const { return (r_info >> 32); } +  Elf64_Word getType() const { +    return (Elf64_Word) (r_info & 0xffffffffL);    } -  void setSymbol(Elf64_Xword s) { setSymbolAndType(s, getType()); } -  void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); } -  void setSymbolAndType(Elf64_Xword s, unsigned char t) { -    r_info = (s << 32) + (t&0xffffffffL); +  void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); } +  void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); } +  void setSymbolAndType(Elf64_Word s, Elf64_Word t) { +    r_info = ((Elf64_Xword)s << 32) + (t&0xffffffffL);    }  };  | 

