Add code to llvm-objdump so the -section option with -macho will dump literal

sections with the Mach-O S_{4,8,16}BYTE_LITERALS section types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2015-02-06 23:25:38 +00:00
parent 8650883afb
commit 4e96e52cbe
3 changed files with 202 additions and 6 deletions

View File

@@ -94,6 +94,26 @@ inline signed long long getSwappedBytes(signed long long C) {
return SwapByteOrder_64(C);
}
inline float getSwappedBytes(float C) {
union {
uint32_t i;
float f;
} in, out;
in.f = C;
out.i = SwapByteOrder_32(in.i);
return out.f;
}
inline float getSwappedBytes(double C) {
union {
uint64_t i;
double d;
} in, out;
in.d = C;
out.i = SwapByteOrder_64(in.i);
return out.d;
}
template<typename T>
inline void swapByteOrder(T &Value) {
Value = getSwappedBytes(Value);