Re: Injecting user defined opcode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019-06-30 05:42 +0000, Mahmood Naderan via gcc-help wrote:
> As I looked to the assembly code generated by -S, I see
> 
>         .file   "test.c"
>         .intel_syntax noprefix
>         .text
>         .globl  main
>         .type   main, @function
> main:
> .LFB0:
>         .cfi_startproc
>         push    rbp
>         .cfi_def_cfa_offset 16
>         .cfi_offset 6, -16
>         mov     rbp, rsp
>         .cfi_def_cfa_register 6
> #APP
> # 3 "test.c" 1
>         .byte 0x00
> # 0 "" 2
> #NO_APP
>         pop     rbp
>         .cfi_def_cfa 7, 8
>         ret
>         .cfi_endproc
> .LFE0:
>         .size   main, .-main
>         .ident  "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-16)"
>         .section        .note.GNU-stack,"",@progbits
> 
> 
> 
> It seems that in the machine code generation, gcc combines 00 with the next
> instruction.
> Any thought?

No.  That's not done by GCC or GNU as.

It's how Intel/AMD CPU parses the machine code.  There are no "delimeters" in
machine code so the CPU regards "00 5d c3" as an instruction.  objdump (from
Binutils) just emulates the behavior of CPU.
-- 
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux