Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-objdump][XCOFF] Use symbol index+symbol name + storage mapping …
…class as label for -D SUMMARY: For the llvm-objdump -D, the symbol name is used as a label in the disassembly for the specific address (when a symbol address is equal to the virtual address in the dump). In XCOFF, multiple symbols may have the same name, being differentiated by their storage mapping class. It is helpful to print the QualName and not just the name when forming the output label for a csect symbol. The symbol index further removes any ambiguity caused by duplicate names. To maintain compatibility with the binutils objdump, the XCOFF-specific --symbol-description option is added to enable the enhanced format. Reviewers: hubert.reinterpretcast, James Henderson, Jason Liu ,daltenty Subscribers: wuzish, nemanjai, hiraditya Differential Revision: https://reviews.llvm.org/D72973
- Loading branch information
diggerlin
committed
Apr 6, 2020
1 parent
9072df8
commit a26a441
Showing
10 changed files
with
287 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
llvm/test/tools/llvm-objdump/XCOFF/disassemble-symbol-description.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# REQUIRES: powerpc-registered-target | ||
|
||
# RUN: llvm-objdump -D %p/Inputs/xcoff-section-headers.o | \ | ||
# RUN: FileCheck --check-prefixes=COMMON,PLAIN %s | ||
|
||
# RUN: llvm-objdump -D --symbol-description %p/Inputs/xcoff-section-headers.o | \ | ||
# RUN: FileCheck --check-prefixes=COMMON,DESC %s | ||
|
||
# xcoff-section-headers.o Compiled with IBM XL C/C++ for AIX, V16.1.0 | ||
# compiler command: xlc -qtls -o xcoff-section-headers.o -c test.c | ||
|
||
## test.c: | ||
## int a; | ||
## int b = 12345; | ||
## __thread int c; | ||
## __thread double d = 3.14159; | ||
## | ||
## int func(void) { | ||
## return a; | ||
## } | ||
|
||
COMMON: Inputs/xcoff-section-headers.o: file format aixcoff-rs6000 | ||
COMMON: Disassembly of section .text: | ||
PLAIN: 00000000 <.text>: | ||
DESC: 00000000 (idx: 4) .text: | ||
COMMON-NEXT: 0: 80 62 00 04 lwz 3, 4(2) | ||
COMMON-NEXT: 4: 80 63 00 00 lwz 3, 0(3) | ||
COMMON-NEXT: 8: 4e 80 00 20 blr | ||
COMMON-NEXT: c: 00 00 00 00 <unknown> | ||
COMMON-NEXT: 10: 00 00 20 40 <unknown> | ||
COMMON-NEXT: 14: 00 00 00 01 <unknown> | ||
COMMON-NEXT: 18: 00 00 00 0c <unknown> | ||
COMMON-NEXT: 1c: 00 04 66 75 <unknown> | ||
COMMON-NEXT: 20: 6e 63 00 00 xoris 3, 19, 0 | ||
COMMON-NEXT: ... | ||
COMMON: Disassembly of section .data: | ||
PLAIN: 00000080 <func>: | ||
DESC: 00000080 (idx: 22) func[TC]: | ||
COMMON-NEXT: 80: 00 00 00 94 <unknown> | ||
PLAIN: 00000084 <a>: | ||
DESC: 00000084 (idx: 26) a[TC]: | ||
COMMON-NEXT: 84: 00 00 00 a4 <unknown> | ||
PLAIN: 00000088 <b>: | ||
DESC: 00000088 (idx: 30) b[TC]: | ||
COMMON-NEXT: 88: 00 00 00 a0 <unknown> | ||
PLAIN: 0000008c <c>: | ||
DESC: 0000008c (idx: 34) c[TC]: | ||
COMMON-NEXT: 8c: 00 00 00 08 <unknown> | ||
PLAIN: 00000090 <d>: | ||
DESC: 00000090 (idx: 38) d[TC]: | ||
COMMON-NEXT: 90: 00 00 00 00 <unknown> | ||
PLAIN: 00000094 <func>: | ||
DESC: 00000094 (idx: 20) func[DS]: | ||
COMMON-NEXT: 94: 00 00 00 00 <unknown> | ||
COMMON-NEXT: 98: 00 00 00 80 <unknown> | ||
COMMON-NEXT: 9c: 00 00 00 00 <unknown> | ||
PLAIN: 000000a0 <b>: | ||
DESC: 000000a0 (idx: 28) b[RW]: | ||
COMMON-NEXT: a0: 00 00 30 39 <unknown> | ||
COMMON: Disassembly of section .bss: | ||
PLAIN: 000000a4 <a>: | ||
DESC: 000000a4 (idx: 24) a[RW]: | ||
COMMON-NEXT: ... | ||
COMMON: Disassembly of section .tdata: | ||
PLAIN: 00000000 <d>: | ||
DESC: 00000000 (idx: 36) d[TL]: | ||
COMMON-NEXT: 0: 40 09 21 f9 bdnzfl 9, 0x21f8 | ||
COMMON-NEXT: 4: f0 1b 86 6e <unknown> | ||
COMMON: Disassembly of section .tbss: | ||
PLAIN: 00000008 <c>: | ||
DESC: 00000008 (idx: 32) c[UL]: | ||
COMMON-NEXT: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//===-- XCOFFDump.h ---------------------------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_TOOLS_LLVM_OBJDUMP_XCOFFDUMP_H | ||
#define LLVM_TOOLS_LLVM_OBJDUMP_XCOFFDUMP_H | ||
|
||
#include "llvm/Object/XCOFFObjectFile.h" | ||
|
||
namespace llvm { | ||
|
||
class SymbolInfoTy; | ||
|
||
namespace objdump { | ||
Optional<XCOFF::StorageMappingClass> | ||
getXCOFFSymbolCsectSMC(const object::XCOFFObjectFile *Obj, | ||
const object::SymbolRef &Sym); | ||
|
||
bool isLabel(const object::XCOFFObjectFile *Obj, const object::SymbolRef &Sym); | ||
|
||
void printXCOFFSymbolDescription(const SymbolInfoTy &SymbolInfo, | ||
StringRef SymbolName); | ||
|
||
Error getXCOFFRelocationValueString(const object::XCOFFObjectFile *Obj, | ||
const object::RelocationRef &RelRef, | ||
llvm::SmallVectorImpl<char> &Result); | ||
} // namespace objdump | ||
} // namespace llvm | ||
#endif |
Oops, something went wrong.