sorry, i copied wrong objdump in my previous mail, i just retested, below are
before/after change of objdump:
objdump before change:
$ objdump -d minimal_test
minimal_test: file format elf64-x86-64
Disassembly of section .text:
00000000006009c0 <main@@Base-0x35>:
6009c0: f3 0f 1e fa endbr64
6009c4: 31 ed xor %ebp,%ebp
6009c6: 49 89 d1 mov %rdx,%r9
6009c9: 5e pop %rsi
6009ca: 48 89 e2 mov %rsp,%rdx
6009cd: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
6009d1: 50 push %rax
6009d2: 54 push %rsp
6009d3: 45 31 c0 xor %r8d,%r8d
6009d6: 31 c9 xor %ecx,%ecx
6009d8: 48 8b 3d d1 02 40 00 mov 0x4002d1(%rip),%rdi #
a00cb0 <main@@Base+0x4002bb>
6009df: ff 15 d3 02 40 00 call *0x4002d3(%rip) # a00cb8
<main@@Base+0x4002c3>
6009e5: f4 hlt
6009e6: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
6009ed: 00 00 00
6009f0: f3 0f 1e fa endbr64
6009f4: c3 ret
00000000006009f5 <main@@Base>:
6009f5: 31 c0 xor %eax,%eax
...
6009ff: 00 c3 add %al,%bl
Disassembly of section .init:
0000000000600a04 <.init>:
600a04: f3 0f 1e fa endbr64
600a08: 48 83 ec 08 sub $0x8,%rsp
600a0c: 48 8b 05 ad 02 40 00 mov 0x4002ad(%rip),%rax #
a00cc0 <__gmon_start__@Base>
600a13: 48 85 c0 test %rax,%rax
600a16: 74 02 je 600a1a <main@@Base+0x25>
600a18: ff d0 call *%rax
600a1a: 48 83 c4 08 add $0x8,%rsp
600a1e: c3 ret
Disassembly of section .fini:
0000000000600a20 <.fini>:
600a20: f3 0f 1e fa endbr64
600a24: 48 83 ec 08 sub $0x8,%rsp
600a28: 48 83 c4 08 add $0x8,%rsp
600a2c: c3 ret
objdump after change:
$ objdump -d minimal_test
minimal_test: file format elf64-x86-64
Disassembly of section .text:
00000000006009c0 <main@@Base-0x35>:
6009c0: f3 0f 1e fa endbr64
6009c4: 31 ed xor %ebp,%ebp
6009c6: 49 89 d1 mov %rdx,%r9
6009c9: 5e pop %rsi
6009ca: 48 89 e2 mov %rsp,%rdx
6009cd: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
6009d1: 50 push %rax
6009d2: 54 push %rsp
6009d3: 45 31 c0 xor %r8d,%r8d
6009d6: 31 c9 xor %ecx,%ecx
6009d8: 48 8b 3d d1 02 40 00 mov 0x4002d1(%rip),%rdi #
a00cb0 <main@@Base+0x4002bb>
6009df: ff 15 d3 02 40 00 call *0x4002d3(%rip) # a00cb8
<main@@Base+0x4002c3>
6009e5: f4 hlt
6009e6: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
6009ed: 00 00 00
6009f0: f3 0f 1e fa endbr64
6009f4: c3 ret
00000000006009f5 <main@@Base>:
6009f5: 31 c0 xor %eax,%eax
6009f7: 90 nop
6009f8: 90 nop
6009f9: 90 nop
6009fa: 90 nop
6009fb: 90 nop
6009fc: 90 nop
6009fd: 90 nop
6009fe: c3 ret
Disassembly of section .init:
0000000000600a00 <.init>:
600a00: f3 0f 1e fa endbr64
600a04: 48 83 ec 08 sub $0x8,%rsp
600a08: 48 8b 05 b1 02 40 00 mov 0x4002b1(%rip),%rax #
a00cc0 <__gmon_start__@Base>
600a0f: 48 85 c0 test %rax,%rax
600a12: 74 02 je 600a16 <main@@Base+0x21>
600a14: ff d0 call *%rax
600a16: 48 83 c4 08 add $0x8,%rsp
600a1a: c3 ret
Disassembly of section .fini:
0000000000600a1c <.fini>:
600a1c: f3 0f 1e fa endbr64
600a20: 48 83 ec 08 sub $0x8,%rsp
600a24: 48 83 c4 08 add $0x8,%rsp
600a28: c3 ret
Regards
Jerry
________________________________
发件人: [email protected]
<[email protected]> 代表 grischka via
Tinycc-devel <[email protected]>
发送时间: Tuesday, May 5, 2026 6:25:51 PM
收件人: [email protected] <[email protected]>
抄送: grischka <[email protected]>
主题: Re: [Tinycc-devel] [patch]fix asm parse directive zero pad logic
On 05.05.2026 13:38, Jerry Jin wrote:
> xorl %eax, %eax
> .p2align 4 # replacing .p2align with .align with specific sizes would also
> lead to broken binary
> ret
> 00000000006009f5 <main@@Base>:
> 6009f5: 31 c0 xor %eax,%eax
> 6009f7: c3 ret
So, where can I see the alignment with 'nop's from your patch here?
-- gr
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel