aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 46ed741..b63d08b 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1854,6 +1854,23 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
outs() << SectionName << ":\n";
}
+ if (Obj->isELF() && Obj->getArch() == Triple::amdgcn) {
+ if (Symbols[SI].Type == ELF::STT_AMDGPU_HSA_KERNEL) {
+ // skip amd_kernel_code_t at the begining of kernel symbol (256 bytes)
+ Start += 256;
+ }
+ if (SI == SE - 1 ||
+ Symbols[SI + 1].Type == ELF::STT_AMDGPU_HSA_KERNEL) {
+ // cut trailing zeroes at the end of kernel
+ // cut up to 256 bytes
+ const uint64_t EndAlign = 256;
+ const auto Limit = End - (std::min)(EndAlign, End - Start);
+ while (End > Limit &&
+ *reinterpret_cast<const support::ulittle32_t*>(&Bytes[End - 4]) == 0)
+ End -= 4;
+ }
+ }
+
outs() << '\n';
if (!NoLeadingAddr)
outs() << format(Is64Bits ? "%016" PRIx64 " " : "%08" PRIx64 " ",