[lld] r177970 - [ELF][Hexagon] add GOTREL/GOT relocations
Sean Silva
silvas at purdue.edu
Tue Mar 26 05:55:39 PDT 2013
+int relocHexGOTREL(uint8_t *location, uint64_t P, uint64_t S, uint64_t A,
+ uint64_t GOT, int shiftBits = 0) {
+ uint32_t result = (uint32_t)((S + A - GOT) >> shiftBits);
+ result = lld::scatterBits<uint32_t>(result, FINDV4BITMASK(location));
+ *reinterpret_cast<llvm::support::ulittle32_t *>(location) =
+ result |
+ (uint32_t) * reinterpret_cast<llvm::support::ulittle32_t
*>(location);
+ return 0;
+}
+
+int relocHexGOTREL_HILO16(uint8_t *location, uint64_t P, uint64_t S,
uint64_t A,
+ uint64_t GOT, int shiftBits = 0) {
+ uint32_t result = (uint32_t)((S + A - GOT) >> shiftBits);
+ result = lld::scatterBits<uint32_t>(result, 0x00c03fff);
+ *reinterpret_cast<llvm::support::ulittle32_t *>(location) =
+ result |
+ (uint32_t) * reinterpret_cast<llvm::support::ulittle32_t
*>(location);
+ return 0;
+}
+
+int relocHexGOTREL_32(uint8_t *location, uint64_t P, uint64_t S, uint64_t
A,
+ uint64_t GOT) {
+ uint32_t result = (uint32_t)(S + A - GOT);
+ *reinterpret_cast<llvm::support::ulittle32_t *>(location) =
+ result |
+ (uint32_t) * reinterpret_cast<llvm::support::ulittle32_t
*>(location);
+ return 0;
It would be a lot cleaner if you assigned
`reinterpret_cast<llvm::support::ulittle32_t
*>(location)` into a variable, instead of repeating it.
-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130326/22f8fba1/attachment.html>
More information about the llvm-commits
mailing list