## Test --symtab-file with thin and fat Mach-O inputs. ## ## We reuse the existing fat Mach-O DWARF fixture as the debug-info input and ## create separate symbol-table-only Mach-O objects. The arm64 symtab slice ## intentionally has two function symbols so we can tell that the matching ## symtab slice was selected instead of the input file's own symbol table. # RUN: split-file %s %t # RUN: yaml2obj %S/fat-macho-dwarf.yaml -o %t/debug-fat.o # RUN: yaml2obj %t/armv7-symtab.yaml -o %t/armv7-symtab.o # RUN: yaml2obj %t/arm64-symtab.yaml -o %t/arm64-symtab.o # RUN: llvm-lipo %t/armv7-symtab.o %t/arm64-symtab.o -create -output %t/symtab-fat.o # RUN: llvm-lipo %t/debug-fat.o -thin arm64 -output %t/debug-arm64.o # RUN: llvm-lipo %t/symtab-fat.o -thin arm64 -output %t/symtab-arm64.o # RUN: llvm-lipo %t/armv7-symtab.o -create -output %t/symtab-armv7-only-fat.o # RUN: llvm-gsymutil --convert %t/debug-arm64.o --symtab-file=%t/symtab-fat.o -o %t/thin-from-fat.gsym 2>&1 | FileCheck %s --check-prefix=THIN-FAT # RUN: llvm-gsymutil --convert %t/debug-fat.o --symtab-file=%t/symtab-fat.o -o %t/fat-from-fat.gsym 2>&1 | FileCheck %s --check-prefix=FAT-FAT # RUN: llvm-gsymutil --convert %t/debug-fat.o --arch arm64 --symtab-file=%t/symtab-arm64.o -o %t/fat-from-thin.gsym 2>&1 | FileCheck %s --check-prefix=FAT-THIN # RUN: not llvm-gsymutil --convert %t/debug-fat.o --symtab-file=%t/symtab-arm64.o -o %t/fat-from-thin-error.gsym 2>&1 | FileCheck %s --check-prefix=FAT-THIN-ERR # RUN: not llvm-gsymutil --convert %t/debug-arm64.o --symtab-file=%t/symtab-armv7-only-fat.o -o %t/missing-arch.gsym 2>&1 | FileCheck %s --check-prefix=MISSING-ARCH # THIN-FAT: Input file: {{.*}}debug-arm64.o # THIN-FAT: Output file (arm64): {{.*}}thin-from-fat.gsym # THIN-FAT: Using symbol table file: {{.*}}symtab-fat.o # THIN-FAT: Loaded 2 functions from symbol table. # FAT-FAT: Input file: {{.*}}debug-fat.o # FAT-FAT: Output file (armv7): {{.*}}fat-from-fat.gsym.armv7 # FAT-FAT: Using symbol table file: {{.*}}symtab-fat.o # FAT-FAT: Loaded 1 functions from symbol table. # FAT-FAT: Output file (arm64): {{.*}}fat-from-fat.gsym.arm64 # FAT-FAT: Using symbol table file: {{.*}}symtab-fat.o # FAT-FAT: Loaded 2 functions from symbol table. # FAT-THIN: Input file: {{.*}}debug-fat.o # FAT-THIN: Output file (arm64): {{.*}}fat-from-thin.gsym # FAT-THIN: Using symbol table file: {{.*}}symtab-arm64.o # FAT-THIN: Loaded 2 functions from symbol table. # FAT-THIN-ERR: use --arch to select a single architecture # MISSING-ARCH: symbol table file '{{.*}}symtab-armv7-only-fat.o' does not contain architecture 'arm64' #--- armv7-symtab.yaml --- !mach-o FileHeader: magic: 0xFEEDFACE cputype: 0x0000000C cpusubtype: 0x00000009 filetype: 0x00000001 ncmds: 4 sizeofcmds: 312 flags: 0x00002000 LoadCommands: - cmd: LC_SEGMENT cmdsize: 192 segname: '' vmaddr: 49136 vmsize: 72 fileoff: 340 filesize: 72 maxprot: 7 initprot: 7 nsects: 2 flags: 0 Sections: - sectname: __text segname: __TEXT addr: 0x000000000000BFF0 size: 16 offset: 0x00000154 align: 4 reloff: 0x00000000 nreloc: 0 flags: 0x80000400 reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: 00000000000000000000000000000000 - sectname: __eh_frame segname: __TEXT addr: 0x000000000000C000 size: 52 offset: 0x00000164 align: 2 reloff: 0x00000000 nreloc: 0 flags: 0x6800000B reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - cmd: LC_VERSION_MIN_MACOSX cmdsize: 16 version: 656384 sdk: 0 - cmd: LC_SYMTAB cmdsize: 24 symoff: 412 nsyms: 1 stroff: 424 strsize: 8 - cmd: LC_DYSYMTAB cmdsize: 80 ilocalsym: 0 nlocalsym: 0 iextdefsym: 0 nextdefsym: 1 iundefsym: 1 nundefsym: 0 tocoff: 0 ntoc: 0 modtaboff: 0 nmodtab: 0 extrefsymoff: 0 nextrefsyms: 0 indirectsymoff: 0 nindirectsyms: 0 extreloff: 0 nextrel: 0 locreloff: 0 nlocrel: 0 LinkEditData: NameList: - n_strx: 1 n_type: 0x0F n_sect: 1 n_desc: 0 n_value: 49136 StringTable: - '' - _main - '' ... #--- arm64-symtab.yaml --- !mach-o FileHeader: magic: 0xFEEDFACF cputype: 0x0100000C cpusubtype: 0x00000000 filetype: 0x00000001 ncmds: 4 sizeofcmds: 352 flags: 0x00002000 reserved: 0x00000000 LoadCommands: - cmd: LC_SEGMENT_64 cmdsize: 232 segname: '' vmaddr: 4294999964 vmsize: 84 fileoff: 384 filesize: 80 maxprot: 7 initprot: 7 nsects: 2 flags: 0 Sections: - sectname: __text segname: __TEXT addr: 0x0000000100007F9C size: 16 offset: 0x00000180 align: 4 reloff: 0x00000000 nreloc: 0 flags: 0x80000400 reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: 00000000000000000000000000000000 - sectname: __eh_frame segname: __TEXT addr: 0x0000000100007FB0 size: 64 offset: 0x00000190 align: 3 reloff: 0x00000000 nreloc: 0 flags: 0x6800000B reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - cmd: LC_VERSION_MIN_MACOSX cmdsize: 16 version: 656384 sdk: 0 - cmd: LC_SYMTAB cmdsize: 24 symoff: 464 nsyms: 2 stroff: 496 strsize: 15 - cmd: LC_DYSYMTAB cmdsize: 80 ilocalsym: 0 nlocalsym: 0 iextdefsym: 0 nextdefsym: 2 iundefsym: 2 nundefsym: 0 tocoff: 0 ntoc: 0 modtaboff: 0 nmodtab: 0 extrefsymoff: 0 nextrefsyms: 0 indirectsymoff: 0 nindirectsyms: 0 extreloff: 0 nextrel: 0 locreloff: 0 nlocrel: 0 LinkEditData: NameList: - n_strx: 1 n_type: 0x0F n_sect: 1 n_desc: 0 n_value: 4294999964 - n_strx: 7 n_type: 0x0F n_sect: 1 n_desc: 0 n_value: 4294999976 StringTable: - '' - _main - _helper - '' ...