Index: lld/test/MachO/dso-handle.s =================================================================== --- lld/test/MachO/dso-handle.s +++ lld/test/MachO/dso-handle.s @@ -3,13 +3,13 @@ # RUN: %lld -lSystem %t.o -o %t # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s -# CHECK: leaq {{.*}} # 0x100000000 -# CHECK-NEXT: leaq {{.*}} # 0x100000000 +# CHECK: leaq {{.*}} ## 0x100000000 +# CHECK-NEXT: leaq {{.*}} ## 0x100000000 # RUN: %lld -dylib %t.o -o %t.dylib # RUN: llvm-objdump -d --no-show-raw-insn --rebase --section-headers %t.dylib | FileCheck %s --check-prefix=DYLIB-CHECK -# DYLIB-CHECK: leaq {{.*}} # 0x0 -# DYLIB-CHECK-NEXT: leaq {{.*}} # 0x0 +# DYLIB-CHECK: leaq {{.*}} ## 0x0 +# DYLIB-CHECK-NEXT: leaq {{.*}} ## 0x0 # DYLIB-LABEL: Sections: # DYLIB: __data 00000008 [[#%x,DATA:]] DATA Index: lld/test/MachO/dylink-ordinal.s =================================================================== --- lld/test/MachO/dylink-ordinal.s +++ lld/test/MachO/dylink-ordinal.s @@ -10,8 +10,8 @@ # CHECK: callq 0x[[#%x,FOO_OFF:]] # CHECK-NEXT: callq 0x[[#%x,BAR_OFF:]] -# CHECK: [[#%x,BAR_OFF]]: jmpq {{.*}} # 0x[[#%x,BAR_BIND:]] -# CHECK: [[#%x,FOO_OFF]]: jmpq {{.*}} # 0x[[#%x,FOO_BIND:]] +# CHECK: [[#%x,BAR_OFF]]: jmpq {{.*}} ## 0x[[#%x,BAR_BIND:]] +# CHECK: [[#%x,FOO_OFF]]: jmpq {{.*}} ## 0x[[#%x,FOO_BIND:]] # CHECK-LABEL: Lazy bind table: # CHECK-DAG: __DATA __la_symbol_ptr 0x[[#%x,FOO_BIND]] Foo _foo Index: lld/test/MachO/mattrs.ll =================================================================== --- lld/test/MachO/mattrs.ll +++ lld/test/MachO/mattrs.ll @@ -18,7 +18,8 @@ ; NO-FMA: <_foo>: ; NO-FMA-NEXT: vrcpss %xmm0, %xmm0, %xmm1 ; NO-FMA-NEXT: vmulss %xmm1, %xmm0, %xmm0 -; NO-FMA-NEXT: vmovss [[#]](%rip), %xmm2 +; NO-FMA-NEXT: vmovss [[#]](%rip), %xmm2 ## xmm2 = +; NO-FMA-NEXT: ## 0x ; NO-FMA-NEXT: vsubss %xmm0, %xmm2, %xmm0 ; NO-FMA-NEXT: vmulss %xmm0, %xmm1, %xmm0 ; NO-FMA-NEXT: vaddss %xmm0, %xmm1, %xmm0 Index: lld/test/MachO/static-link.s =================================================================== --- lld/test/MachO/static-link.s +++ lld/test/MachO/static-link.s @@ -15,7 +15,7 @@ # CHECK: Disassembly of section __TEXT,__text # CHECK-LABEL: <_main>: -# CHECK: leaq {{.*}}(%rip), %rsi # 0x[[ADDR]] <_goodbye_world> +# CHECK: leaq {{.*}}(%rip), %rsi ## 0x[[ADDR]] <_goodbye_world> .section __TEXT,__text .global _main Index: lld/test/MachO/tapi-link.s =================================================================== --- lld/test/MachO/tapi-link.s +++ lld/test/MachO/tapi-link.s @@ -14,7 +14,7 @@ # RUN: llvm-objdump --bind --no-show-raw-insn -d -r %t/with-reexport | FileCheck %s # CHECK: Disassembly of section __TEXT,__text: -# CHECK: movq {{.*}} # 0x[[ADDR:[0-9a-f]+]] +# CHECK: movq {{.*}} ## 0x[[ADDR:[0-9a-f]+]] # CHECK: Bind table: # CHECK-DAG: __DATA_CONST __got 0x[[ADDR]] pointer 0 libSystem ___nan Index: lld/test/MachO/tlv-dylib.s =================================================================== --- lld/test/MachO/tlv-dylib.s +++ lld/test/MachO/tlv-dylib.s @@ -17,9 +17,9 @@ # RUN: %lld -lSystem -L%t -ltlv %t/test.o -o %t/test # RUN: llvm-objdump --bind -d --no-show-raw-insn %t/test | FileCheck %s -# CHECK: movq [[#]](%rip), %rax # 0x[[#%x, FOO:]] -# CHECK-NEXT: movq [[#]](%rip), %rax # 0x[[#%x, BAR:]] -# CHECK-NEXT: movq [[#]](%rip), %rax # 0x[[#%x, BAZ:]] +# CHECK: movq [[#]](%rip), %rax ## 0x[[#%x, FOO:]] +# CHECK-NEXT: movq [[#]](%rip), %rax ## 0x[[#%x, BAR:]] +# CHECK-NEXT: movq [[#]](%rip), %rax ## 0x[[#%x, BAZ:]] # CHECK-LABEL: Bind table: # CHECK-DAG: __DATA __thread_ptrs 0x{{0*}}[[#%x, FOO]] pointer 0 libtlv _foo Index: lld/test/MachO/tlv.s =================================================================== --- lld/test/MachO/tlv.s +++ lld/test/MachO/tlv.s @@ -34,13 +34,13 @@ # HEADER: MH_HAS_TLV_DESCRIPTORS # REG: <_main>: -# REG-NEXT: leaq {{.*}}(%rip), %rax # {{.*}} <_foo> -# REG-NEXT: leaq {{.*}}(%rip), %rax # {{.*}} <_bar> +# REG-NEXT: leaq {{.*}}(%rip), %rax ## {{.*}} <_foo> +# REG-NEXT: leaq {{.*}}(%rip), %rax ## {{.*}} <_bar> # REG-NEXT: retq # TBSS: <_f>: -# TBSS-NEXT: leaq {{.*}}(%rip), %rax # {{.*}} <_baz> -# TBSS-NEXT: leaq {{.*}}(%rip), %rax # {{.*}} <_qux> +# TBSS-NEXT: leaq {{.*}}(%rip), %rax ## {{.*}} <_baz> +# TBSS-NEXT: leaq {{.*}}(%rip), %rax ## {{.*}} <_qux> # TBSS-NEXT: retq # REG-TLVP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Index: lld/test/MachO/weak-binding.s =================================================================== --- lld/test/MachO/weak-binding.s +++ lld/test/MachO/weak-binding.s @@ -19,12 +19,12 @@ # CHECK-NEXT: {{[0-9a-f]+}} {{[0-9a-f ]*[1-9a-f]+[0-9a-f ]*}} # CHECK: <_main>: -# CHECK-NEXT: movq [[#]](%rip), %rax # 0x[[#%X,WEAK_DY_GOT_ADDR:]] -# CHECK-NEXT: movq [[#]](%rip), %rax # 0x[[#%X,WEAK_EXT_GOT_ADDR:]] -# CHECK-NEXT: leaq [[#]](%rip), %rax # 0x[[#%X,WEAK_INT_GOT_ADDR:]] -# CHECK-NEXT: movq [[#]](%rip), %rax # 0x[[#%X,WEAK_TLV_ADDR:]] -# CHECK-NEXT: movq [[#]](%rip), %rax # 0x[[#%X,WEAK_DY_TLV_ADDR:]] -# CHECK-NEXT: leaq [[#]](%rip), %rax # 0x[[#%X,WEAK_INT_TLV_ADDR:]] +# CHECK-NEXT: movq [[#]](%rip), %rax ## 0x[[#%X,WEAK_DY_GOT_ADDR:]] +# CHECK-NEXT: movq [[#]](%rip), %rax ## 0x[[#%X,WEAK_EXT_GOT_ADDR:]] +# CHECK-NEXT: leaq [[#]](%rip), %rax ## 0x[[#%X,WEAK_INT_GOT_ADDR:]] +# CHECK-NEXT: movq [[#]](%rip), %rax ## 0x[[#%X,WEAK_TLV_ADDR:]] +# CHECK-NEXT: movq [[#]](%rip), %rax ## 0x[[#%X,WEAK_DY_TLV_ADDR:]] +# CHECK-NEXT: leaq [[#]](%rip), %rax ## 0x[[#%X,WEAK_INT_TLV_ADDR:]] # CHECK-NEXT: callq 0x{{[0-9a-f]*}} # CHECK-NEXT: callq 0x{{[0-9a-f]*}} # CHECK-NEXT: callq 0x{{[0-9a-f]*}} Index: lld/test/MachO/x86-64-reloc-got-load.s =================================================================== --- lld/test/MachO/x86-64-reloc-got-load.s +++ lld/test/MachO/x86-64-reloc-got-load.s @@ -6,7 +6,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o # RUN: %lld -o %t %t.o # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s -# CHECK: leaq [[#]](%rip), %rax # {{.*}} <_foo> +# CHECK: leaq [[#]](%rip), %rax ## {{.*}} <_foo> .globl _main, _foo Index: lld/test/MachO/x86-64-reloc-signed.s =================================================================== --- lld/test/MachO/x86-64-reloc-signed.s +++ lld/test/MachO/x86-64-reloc-signed.s @@ -12,18 +12,20 @@ # CHECK-LABEL: Disassembly of section # CHECK: <_main>: -# CHECK-NEXT: movl {{.*}} # 0x[[#S]] +# CHECK-NEXT: movl {{.*}} ## imm = +# CHECK-NEXT: ## 0x[[#S]] # CHECK-NEXT: callq {{.*}} -# CHECK-NEXT: movl {{.*}} # 0x[[#S + 2]] +# CHECK-NEXT: movl {{.*}} ## 0x[[#S + 2]] # CHECK-NEXT: callq {{.*}} -# CHECK-NEXT: movb {{.*}} # 0x[[#S]] +# CHECK-NEXT: movb {{.*}} ## 0x[[#S]] # CHECK-NEXT: callq {{.*}} # CHECK: <__not_text>: -# CHECK-NEXT: movl {{.*}} # 0x[[#FOO + 8]] +# CHECK-NEXT: movl {{.*}} ## imm = +# CHECK-NEXT: ## 0x[[#FOO + 8]] # CHECK-NEXT: callq {{.*}} -# CHECK-NEXT: movl {{.*}} # 0x[[#FOO + 8 + 2]] +# CHECK-NEXT: movl {{.*}} ## 0x[[#FOO + 8 + 2]] # CHECK-NEXT: callq {{.*}} -# CHECK-NEXT: movb {{.*}} # 0x[[#FOO + 8]] +# CHECK-NEXT: movb {{.*}} ## 0x[[#FOO + 8]] # CHECK-NEXT: callq {{.*}} .section __TEXT,__text Index: llvm/test/tools/llvm-objdump/X86/disassemble-align.s =================================================================== --- llvm/test/tools/llvm-objdump/X86/disassemble-align.s +++ llvm/test/tools/llvm-objdump/X86/disassemble-align.s @@ -10,14 +10,14 @@ # Instructions are expected to be aligned if the instruction in hex is not too long. # CHECK: 0: c3 |retq -# CHECK-NEXT: 1: 48 8b 05 56 34 12 00 |movq|0x123456(%rip), %rax # 0x12345e <.text+0x12345e> +# CHECK-NEXT: 1: 48 8b 05 56 34 12 00 |movq|0x123456(%rip), %rax # 0x12345e <.text+0x12345e> # CHECK-NEXT: 8: 48 b8 54 55 55 55 55 55 55 55|movabsq|$0x5555555555555554, %rax # imm = 0x5555555555555554 # CHECK-NEXT: 12: 8f ea 00 12 4c 02 40 00 00 00 00 |lwpval|$0x0, 0x40(%rdx,%rax), %r15d # CHECK-NEXT: 1d: 8f ea 00 12 04 25 f0 1c f0 1c 00 00 00 00 |lwpins|$0x0, 0x1cf01cf0, %r15d # CHECK-NEXT: 2b: ff ff | # NORAW: 0: |retq -# NORAW-NEXT: 1: |movq|0x123456(%rip), %rax # 0x12345e <.text+0x12345e> +# NORAW-NEXT: 1: |movq|0x123456(%rip), %rax # 0x12345e <.text+0x12345e> # NORAW-NEXT: 8: |movabsq|$0x5555555555555554, %rax # imm = 0x5555555555555554 # NORAW-NEXT: 12: |lwpval|$0x0, 0x40(%rdx,%rax), %r15d # NORAW-NEXT: 1d: |lwpins|$0x0, 0x1cf01cf0, %r15d Index: llvm/tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- llvm/tools/llvm-objdump/llvm-objdump.cpp +++ llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1433,6 +1433,8 @@ // address (jump target or memory operand address) and print it on the // right of the instruction. if (Disassembled && MIA) { + // Branch targets are printed just after the instructions. + llvm::raw_ostream *TargetOS = &FOS; uint64_t Target; bool PrintTarget = MIA->evaluateBranch(Inst, SectionAddr + Index, Size, Target); @@ -1443,8 +1445,11 @@ Target = *MaybeTarget; PrintTarget = true; // Do not print real address when symbolizing. - if (!SymbolizeOperands) - FOS << " # 0x" << Twine::utohexstr(Target); + if (!SymbolizeOperands) { + // Memory operand addresses are printed as comments. + TargetOS = &CommentStream; + *TargetOS << "0x" << Twine::utohexstr(Target); + } } if (PrintTarget) { // In a relocatable object, the target's section must reside in @@ -1503,22 +1508,26 @@ if (Demangle) TargetName = demangle(TargetName); - FOS << " <"; + *TargetOS << " <"; if (!Disp) { // Always Print the binary symbol precisely corresponding to // the target address. - FOS << TargetName; + *TargetOS << TargetName; } else if (!LabelAvailable) { // Always Print the binary symbol plus an offset if there's no // local label corresponding to the target address. - FOS << TargetName << "+0x" << Twine::utohexstr(Disp); + *TargetOS << TargetName << "+0x" << Twine::utohexstr(Disp); } else { - FOS << AllLabels[Target]; + *TargetOS << AllLabels[Target]; } - FOS << ">"; + *TargetOS << ">"; } else if (LabelAvailable) { - FOS << " <" << AllLabels[Target] << ">"; + *TargetOS << " <" << AllLabels[Target] << ">"; } + // By convention, each record in the comment stream should be + // terminated. + if (TargetOS == &CommentStream) + *TargetOS << "\n"; } } }