changes to fix Hexagon Relocation so that it accounts for the bitmask properly as documented in the ABI

llvm-svn: 171125
This commit is contained in:
Shankar Easwaran 2012-12-27 01:04:00 +00:00
parent 5350cd314b
commit b3cb257b8b
1 changed files with 2 additions and 2 deletions

View File

@ -67,7 +67,7 @@ int relocB15PCREL(uint8_t *location, uint64_t P, uint64_t S, uint64_t A) {
/// \brief Word32_LO: 0x00c03fff : (S + A) : Truncate /// \brief Word32_LO: 0x00c03fff : (S + A) : Truncate
int relocLO16(uint8_t *location, uint64_t P, uint64_t S, uint64_t A) { int relocLO16(uint8_t *location, uint64_t P, uint64_t S, uint64_t A) {
uint32_t result = (uint32_t)(S + A); uint32_t result = (uint32_t)(S + A);
result = ((result & 0x3fff) | ((result << 2) & 0x00c00000)); result = ((result & 0x3fff) | ((result << 8) & 0x00c00000));
*reinterpret_cast<llvm::support::ulittle32_t *>(location) = result | *reinterpret_cast<llvm::support::ulittle32_t *>(location) = result |
(uint32_t)*reinterpret_cast<llvm::support::ulittle32_t *>(location); (uint32_t)*reinterpret_cast<llvm::support::ulittle32_t *>(location);
return HexagonKindHandler::NoError; return HexagonKindHandler::NoError;
@ -76,7 +76,7 @@ int relocLO16(uint8_t *location, uint64_t P, uint64_t S, uint64_t A) {
/// \brief Word32_LO: 0x00c03fff : (S + A) >> 16 : Truncate /// \brief Word32_LO: 0x00c03fff : (S + A) >> 16 : Truncate
int relocHI16(uint8_t *location, uint64_t P, uint64_t S, uint64_t A) { int relocHI16(uint8_t *location, uint64_t P, uint64_t S, uint64_t A) {
uint32_t result = (uint32_t)((S + A)>>16); uint32_t result = (uint32_t)((S + A)>>16);
result = ((result & 0x3fff) | ((result << 2) & 0x00c00000)); result = ((result & 0x3fff) | ((result << 8) & 0x00c00000));
*reinterpret_cast<llvm::support::ulittle32_t *>(location) = result | *reinterpret_cast<llvm::support::ulittle32_t *>(location) = result |
(uint32_t)*reinterpret_cast<llvm::support::ulittle32_t *>(location); (uint32_t)*reinterpret_cast<llvm::support::ulittle32_t *>(location);
return HexagonKindHandler::NoError; return HexagonKindHandler::NoError;