; Test the --syms option for xcoff object files. ; Also test the --symbol-description option for xcoff object files, when specified with --syms. ; RUN: llc -mtriple powerpc-ibm-aix -mcpu=pwr4 -filetype=obj -o %t.o < %s ; RUN: llvm-objdump --syms %t.o | FileCheck --check-prefix=SYM %s ; RUN: llvm-objdump --syms --symbol-description %t.o | FileCheck --check-prefix=SYM-DES %s ;; The IR below is generated by the following source code. ;; bash> cat test.c ;; const char* con= "Test for --symbols"; ;; int i; ;; char c ; ;; char *ap; ;; float f; ;; long long ll; ;; static int si; ;; extern int ei; ;; int bar(const char *v) { ;; si = 1; ;; return (int)v[0] + (int)v[2] + si + ei; ;; } ;; ;; void foo() { ;; bar(con); ;; } ;; ;; __attribute__ ((weak)) int wi=2; @.str = private unnamed_addr constant [19 x i8] c"Test for --symbols\00", align 1 @con = global i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i32 0, i32 0), align 4 @si = internal global i32 0, align 4 @ei = external global i32, align 4 @wi = weak global i32 2, align 4 @i = global i32 0, align 4 @c = global i8 0, align 1 @ap = global i8* null, align 4 @f = global float 0.000000e+00, align 4 @ll = global i64 0, align 8 define i32 @bar(i8* %v) { entry: %v.addr = alloca i8*, align 4 store i8* %v, i8** %v.addr, align 4 store i32 1, i32* @si, align 4 %0 = load i8*, i8** %v.addr, align 4 %arrayidx = getelementptr inbounds i8, i8* %0, i32 0 %1 = load i8, i8* %arrayidx, align 1 %conv = zext i8 %1 to i32 %2 = load i8*, i8** %v.addr, align 4 %arrayidx1 = getelementptr inbounds i8, i8* %2, i32 2 %3 = load i8, i8* %arrayidx1, align 1 %conv2 = zext i8 %3 to i32 %add = add nsw i32 %conv, %conv2 %4 = load i32, i32* @si, align 4 %add3 = add nsw i32 %add, %4 %5 = load i32, i32* @ei, align 4 %add4 = add nsw i32 %add3, %5 ret i32 %add4 } define void @foo() { entry: %0 = load i8*, i8** @con, align 4 %call = call i32 @bar(i8* %0) ret void } ; SYM: SYMBOL TABLE: ; SYM-NEXT: 00000000 df *DEBUG* 00000000 <stdin> ; SYM-NEXT: 00000000 *UND* 00000000 ei ; SYM-NEXT: 00000000 l .text 00000091 .text ; SYM-NEXT: 00000000 g F .text (csect: .text) 00000000 .bar ; SYM-NEXT: 00000050 g F .text (csect: .text) 00000000 .foo ; SYM-NEXT: 00000094 l .text 00000013 .rodata.str1.1L...str ; SYM-NEXT: 000000a8 g O .data 00000004 con ; SYM-NEXT: 000000ac w O .data 00000004 wi ; SYM-NEXT: 000000b0 g O .data 00000004 i ; SYM-NEXT: 000000b4 g O .data 00000001 c ; SYM-NEXT: 000000b8 g O .data 00000004 ap ; SYM-NEXT: 000000bc g O .data 00000004 f ; SYM-NEXT: 000000c0 g O .data 00000008 ll ; SYM-NEXT: 000000c8 g O .data 0000000c bar ; SYM-NEXT: 000000d4 g O .data 0000000c foo ; SYM-NEXT: 000000e0 l .data 00000000 TOC ; SYM-NEXT: 000000e0 l O .data 00000004 si ; SYM-NEXT: 000000e4 l O .data 00000004 ei ; SYM-NEXT: 000000e8 l O .data 00000004 con ; SYM-NEXT: 000000ec l O *COM* 00000004 si ; SYM-DES: SYMBOL TABLE: ; SYM-DES-NEXT: 00000000 df *DEBUG* 00000000 (idx: 0) <stdin> ; SYM-DES-NEXT: 00000000 *UND* 00000000 (idx: 1) ei[UA] ; SYM-DES-NEXT: 00000000 l .text 00000091 (idx: 3) .text[PR] ; SYM-DES-NEXT: 00000000 g F .text (csect: (idx: 3) .text[PR]) 00000000 (idx: 5) .bar ; SYM-DES-NEXT: 00000050 g F .text (csect: (idx: 3) .text[PR]) 00000000 (idx: 7) .foo ; SYM-DES-NEXT: 00000094 l .text 00000013 (idx: 9) .rodata.str1.1L...str[RO] ; SYM-DES-NEXT: 000000a8 g O .data 00000004 (idx: 11) con[RW] ; SYM-DES-NEXT: 000000ac w O .data 00000004 (idx: 13) wi[RW] ; SYM-DES-NEXT: 000000b0 g O .data 00000004 (idx: 15) i[RW] ; SYM-DES-NEXT: 000000b4 g O .data 00000001 (idx: 17) c[RW] ; SYM-DES-NEXT: 000000b8 g O .data 00000004 (idx: 19) ap[RW] ; SYM-DES-NEXT: 000000bc g O .data 00000004 (idx: 21) f[RW] ; SYM-DES-NEXT: 000000c0 g O .data 00000008 (idx: 23) ll[RW] ; SYM-DES-NEXT: 000000c8 g O .data 0000000c (idx: 25) bar[DS] ; SYM-DES-NEXT: 000000d4 g O .data 0000000c (idx: 27) foo[DS] ; SYM-DES-NEXT: 000000e0 l .data 00000000 (idx: 29) TOC[TC0] ; SYM-DES-NEXT: 000000e0 l O .data 00000004 (idx: 31) si[TC] ; SYM-DES-NEXT: 000000e4 l O .data 00000004 (idx: 33) ei[TC] ; SYM-DES-NEXT: 000000e8 l O .data 00000004 (idx: 35) con[TC] ; SYM-DES-NEXT: 000000ec l O *COM* 00000004 (idx: 37) si[BS]