340 lines · plain
1RUN: dsymutil -accelerator=Pub -o - %p/../Inputs/basic.macho.i386 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK322RUN: dsymutil -accelerator=Pub -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK643 4This test checks that the dSYM companion binaries generated in 32 and 64 bits5are correct. The check are pretty strict (we check even the offsets and sizes6of the sections) in order to test the VM address layout algorithm. As the7debug sections are generated, this is a bit risky, but I don't expect8dsymutil's output to change much for these tiny C programs so this should9be OK.10The 32bits version doesn't have object files, thus it has basically no debug11sections.12 13CHECK32: Format: Mach-O 32-bit i38614CHECK32: Arch: i38615CHECK32: AddressSize: 32bit16CHECK64: Format: Mach-O 64-bit x86-6417CHECK64: Arch: x86_6418CHECK64: AddressSize: 64bit19CHECK: MachHeader {20CHECK32: Magic: Magic (0xFEEDFACE)21CHECK32: CpuType: X86 (0x7)22CHECK32: CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)23CHECK64: Magic: Magic64 (0xFEEDFACF)24CHECK64: CpuType: X86-64 (0x1000007)25CHECK64: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)26CHECK: FileType: DWARFSymbol (0xA)27CHECK: NumOfLoadCommands: 728CHECK: Flags [ (0x0)29CHECK: }30CHECK: Sections [31CHECK: Section {32CHECK: Name: __text33CHECK: Segment: __TEXT34CHECK32: Address: 0x1E9035CHECK32: Size: 0x11A36CHECK64: Address: 0x100000EA037CHECK64: Size: 0x10938CHECK: Offset: 039CHECK: Alignment: 440CHECK: RelocationOffset: 0x041CHECK: RelocationCount: 042CHECK: Type: Regular (0x0)43CHECK: Attributes [ (0x800004)44CHECK: PureInstructions (0x800000)45CHECK: SomeInstructions (0x4)46CHECK: ]47CHECK: Reserved1: 0x048CHECK: Reserved2: 0x049CHECK: }50CHECK: Section {51CHECK: Name: __unwind_info52CHECK: Segment: __TEXT53CHECK32: Address: 0x1FAC54CHECK64: Address: 0x100000FAC55CHECK: Size: 0x4856CHECK: Offset: 057CHECK: Alignment: 258CHECK: RelocationOffset: 0x059CHECK: RelocationCount: 060CHECK: Type: Regular (0x0)61CHECK: Attributes [ (0x0)62CHECK: ]63CHECK: Reserved1: 0x064CHECK: Reserved2: 0x065CHECK: }66CHECK32: Section {67CHECK32: Name: __nl_symbol_ptr68CHECK32: Segment: __DATA69CHECK32: Address: 0x200070CHECK32: Size: 0x471CHECK32: Offset: 072CHECK32: Alignment: 273CHECK32: RelocationOffset: 0x074CHECK32: RelocationCount: 075CHECK32: Type: NonLazySymbolPointers (0x6)76CHECK32: Attributes [ (0x0)77CHECK32: ]78CHECK32: Reserved1: 0x079CHECK32: Reserved2: 0x080CHECK32: }81CHECK: Section {82CHECK: Name: __data83CHECK: Segment: __DATA84CHECK32: Address: 0x200485CHECK64: Address: 0x10000100086CHECK: Size: 0x487CHECK: Offset: 088CHECK: Alignment: 289CHECK: RelocationOffset: 0x090CHECK: RelocationCount: 091CHECK: Type: Regular (0x0)92CHECK: Attributes [ (0x0)93CHECK: ]94CHECK: Reserved1: 0x095CHECK: Reserved2: 0x096CHECK: }97CHECK: Section {98CHECK: Name: __common99CHECK: Segment: __DATA100CHECK32: Address: 0x2008101CHECK64: Address: 0x100001004102CHECK: Size: 0x4103CHECK: Offset: 0104CHECK: Alignment: 2105CHECK: RelocationOffset: 0x0106CHECK: RelocationCount: 0107CHECK: Type: ZeroFill (0x1)108CHECK: Attributes [ (0x0)109CHECK: ]110CHECK: Reserved1: 0x0111CHECK: Reserved2: 0x0112CHECK: }113CHECK: Section {114CHECK: Name: __bss115CHECK: Segment: __DATA116CHECK32: Address: 0x200C117CHECK64: Address: 0x100001008118CHECK: Size: 0x4119CHECK: Offset: 0120CHECK: Alignment: 2121CHECK: RelocationOffset: 0x0122CHECK: RelocationCount: 0123CHECK: Type: ZeroFill (0x1)124CHECK: Attributes [ (0x0)125CHECK: ]126CHECK: Reserved1: 0x0127CHECK: Reserved2: 0x0128CHECK: }129CHECK64: Section {130CHECK64: Name: __debug_line131CHECK64: Segment: __DWARF132CHECK64: Address: 0x100003000133CHECK64: Size: 0xEA134CHECK64: Offset: 8192135CHECK64: Alignment: 0136CHECK64: RelocationOffset: 0x0137CHECK64: RelocationCount: 0138CHECK64: Type: Regular (0x0)139CHECK64: Attributes [ (0x0)140CHECK64: ]141CHECK64: Reserved1: 0x0142CHECK64: Reserved2: 0x0143CHECK64: }144CHECK64: Section {145CHECK64: Name: __debug_pubnames146CHECK64: Segment: __DWARF147CHECK64: Address: 0x1000030EA148CHECK64: Size: 0x7F149CHECK64: Offset: 8426150CHECK64: Alignment: 0151CHECK64: RelocationOffset: 0x0152CHECK64: RelocationCount: 0153CHECK64: Type: Regular (0x0)154CHECK64: Attributes [ (0x0)155CHECK64: ]156CHECK64: Reserved1: 0x0157CHECK64: Reserved2: 0x0158CHECK64: }159CHECK64: Section {160CHECK64: Name: __debug_pubtypes161CHECK64: Segment: __DWARF162CHECK64: Address: 0x100003169163CHECK64: Size: 0x57164CHECK64: Offset: 8553165CHECK64: Alignment: 0166CHECK64: RelocationOffset: 0x0167CHECK64: RelocationCount: 0168CHECK64: Type: Regular (0x0)169CHECK64: Attributes [ (0x0)170CHECK64: ]171CHECK64: Reserved1: 0x0172CHECK64: Reserved2: 0x0173CHECK64: }174CHECK64: Section {175CHECK64: Name: __debug_aranges176CHECK64: Segment: __DWARF177CHECK64: Address: 0x1000031C0178CHECK64: Size: 0xB0179CHECK64: Offset: 8640180CHECK64: Alignment: 0181CHECK64: RelocationOffset: 0x0182CHECK64: RelocationCount: 0183CHECK64: Type: Regular (0x0)184CHECK64: Attributes [ (0x0)185CHECK64: ]186CHECK64: Reserved1: 0x0187CHECK64: Reserved2: 0x0188CHECK64: }189CHECK64: Section {190CHECK64: Name: __debug_info191CHECK64: Segment: __DWARF192CHECK64: Address: 0x100003270193CHECK64: Size: 0x1BC194CHECK64: Offset: 8816195CHECK64: Alignment: 0196CHECK64: RelocationOffset: 0x0197CHECK64: RelocationCount: 0198CHECK64: Type: Regular (0x0)199CHECK64: Attributes [ (0x0)200CHECK64: ]201CHECK64: Reserved1: 0x0202CHECK64: Reserved2: 0x0203CHECK64: }204CHECK: Section {205CHECK: Name: __debug_abbrev206CHECK: Segment: __DWARF207CHECK32: Address: 0x4000208CHECK32: Size: 0x1209CHECK32: Offset: 8192210CHECK64: Address: 0x10000342C211CHECK64: Size: 0x8F212CHECK64: Offset: 9260213CHECK: Alignment: 0214CHECK: RelocationOffset: 0x0215CHECK: RelocationCount: 0216CHECK: Type: Regular (0x0)217CHECK: Attributes [ (0x0)218CHECK: ]219CHECK: Reserved1: 0x0220CHECK: Reserved2: 0x0221CHECK: }222CHECK: Section {223CHECK: Name: __debug_str224CHECK: Segment: __DWARF225CHECK32: Address: 0x4001226CHECK32: Size: 0x1227CHECK32: Offset: 8193228CHECK64: Address: 0x1000034BB229CHECK64: Size: 0x9F230CHECK64: Offset: 9403231CHECK: Alignment: 0232CHECK: RelocationOffset: 0x0233CHECK: RelocationCount: 0234CHECK: Type: Regular (0x0)235CHECK: Attributes [ (0x0)236CHECK: ]237CHECK: Reserved1: 0x0238CHECK: Reserved2: 0x0239CHECK: }240CHECK: ]241CHECK: Symbols [242CHECK: Symbol {243CHECK: Name: _inc (2)244CHECK: Type: Section (0xE)245CHECK: Section: __text246CHECK: RefType: UndefinedNonLazy (0x0)247CHECK: Flags [ (0x0)248CHECK: ]249CHECK32: Value: 0x1F20250CHECK64: Value: 0x100000F20251CHECK: }252CHECK: Symbol {253CHECK: Name: _inc (2)254CHECK: Type: Section (0xE)255CHECK: Section: __text256CHECK: RefType: UndefinedNonLazy (0x0)257CHECK: Flags [ (0x0)258CHECK: ]259CHECK32: Value: 0x1F90260CHECK64: Value: 0x100000F90261CHECK: }262CHECK: Symbol {263CHECK: Name: _baz (7)264CHECK: Type: Section (0xE)265CHECK: Section: __data266CHECK: RefType: UndefinedNonLazy (0x0)267CHECK: Flags [ (0x0)268CHECK: ]269CHECK32: Value: 0x2004270CHECK64: Value: 0x100001000271CHECK: }272CHECK: Symbol {273CHECK: Name: _private_int (12)274CHECK: Type: Section (0xE)275CHECK: Section: __bss276CHECK: RefType: UndefinedNonLazy (0x0)277CHECK: Flags [ (0x0)278CHECK: ]279CHECK32: Value: 0x200C280CHECK64: Value: 0x100001008281CHECK: }282CHECK: Symbol {283CHECK: Name: __mh_execute_header (25)284CHECK: Extern285CHECK: Type: Section (0xE)286CHECK: Section: __text287CHECK: RefType: UndefinedNonLazy (0x0)288CHECK: Flags [ (0x10)289CHECK: ReferencedDynamically (0x10)290CHECK: ]291CHECK32: Value: 0x1000292CHECK64: Value: 0x100000000293CHECK: }294CHECK: Symbol {295CHECK: Name: _bar (45)296CHECK: Extern297CHECK: Type: Section (0xE)298CHECK: Section: __text299CHECK: RefType: UndefinedNonLazy (0x0)300CHECK: Flags [ (0x0)301CHECK: ]302CHECK32: Value: 0x1F40303CHECK64: Value: 0x100000F40304CHECK: }305CHECK: Symbol {306CHECK: Name: _foo (50)307CHECK: Extern308CHECK: Type: Section (0xE)309CHECK: Section: __text310CHECK: RefType: UndefinedNonLazy (0x0)311CHECK: Flags [ (0x0)312CHECK: ]313CHECK32: Value: 0x1EC0314CHECK64: Value: 0x100000ED0315CHECK: }316CHECK: Symbol {317CHECK: Name: _main (55)318CHECK: Extern319CHECK: Type: Section (0xE)320CHECK: Section: __text321CHECK: RefType: UndefinedNonLazy (0x0)322CHECK: Flags [ (0x0)323CHECK: ]324CHECK32: Value: 0x1E90325CHECK64: Value: 0x100000EA0326CHECK: }327CHECK: Symbol {328CHECK: Name: _val (61)329CHECK: Extern330CHECK: Type: Section (0xE)331CHECK: Section: __common332CHECK: RefType: UndefinedNonLazy (0x0)333CHECK: Flags [ (0x0)334CHECK: ]335CHECK32: Value: 0x2008336CHECK64: Value: 0x100001004337CHECK: }338CHECK: ]339 340