Skip to content

Instantly share code, notes, and snippets.

@yak1ex
Created April 22, 2017 21:12
Show Gist options
  • Save yak1ex/026a399436c2aa2c5646bf319cf3f515 to your computer and use it in GitHub Desktop.
Save yak1ex/026a399436c2aa2c5646bf319cf3f515 to your computer and use it in GitHub Desktop.
x86_64 clang suspection
.text
.def __cxx_global_var_init;
.scl 3;
.type 32;
.endef
.p2align 4, 0x90
__cxx_global_var_init: # @__cxx_global_var_init
.Ltmp0:
.seh_proc __cxx_global_var_init
# BB#0:
subq $40, %rsp
.Ltmp1:
.seh_stackalloc 40
.Ltmp2:
.seh_endprologue
movabsq $_ZStL8__ioinit, %rcx
callq _ZNSt8ios_base4InitC1Ev
movabsq $_ZNSt8ios_base4InitD1Ev, %rcx
movabsq $_ZStL8__ioinit, %rdx
movabsq $__dso_handle, %r8
callq __cxa_atexit
movl %eax, 36(%rsp) # 4-byte Spill
addq $40, %rsp
retq
.seh_handlerdata
.text
.Ltmp3:
.seh_endproc
.def _Z1fe;
.scl 2;
.type 32;
.endef
.globl _Z1fe
.p2align 4, 0x90
_Z1fe: # @_Z1fe
.Ltmp4:
.seh_proc _Z1fe
# BB#0:
subq $88, %rsp
.Ltmp5:
.seh_stackalloc 88
.Ltmp6:
.seh_endprologue
fldt 128(%rsp)
fld %st(0)
fstpt 64(%rsp)
movq %rsp, %rax
fstpt 32(%rax)
movabsq $_ZSt4cout, %rcx
callq _ZNSolsEe
movabsq $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %rdx
movq %rax, %rcx
callq _ZNSolsEPFRSoS_E
movq %rax, 56(%rsp) # 8-byte Spill
addq $88, %rsp
retq
.seh_handlerdata
.text
.Ltmp7:
.seh_endproc
.def main;
.scl 2;
.type 32;
.endef
.section .rdata,"dr"
.p2align 2
LCPI2_0:
.long 1103626240 # float 25
.text
.globl main
.p2align 4, 0x90
main: # @main
.Ltmp8:
.seh_proc main
# BB#0:
pushq %rbp
.Ltmp9:
.seh_pushreg 5
subq $80, %rsp
.Ltmp10:
.seh_stackalloc 80
leaq 80(%rsp), %rbp
.Ltmp11:
.seh_setframe 5, 80
.Ltmp12:
.seh_endprologue
callq __main
movl $0, -4(%rbp)
movabsq $LCPI2_0, %rax
flds (%rax)
fld %st(0)
fstpt -32(%rbp)
movq %rsp, %rax
fstpt 32(%rax)
callq _Z1fe
xorl %eax, %eax
addq $80, %rsp
popq %rbp
retq
.seh_handlerdata
.text
.Ltmp13:
.seh_endproc
.def _GLOBAL__sub_I_a.bug.cpp;
.scl 3;
.type 32;
.endef
.p2align 4, 0x90
_GLOBAL__sub_I_a.bug.cpp: # @_GLOBAL__sub_I_a.bug.cpp
.Ltmp14:
.seh_proc _GLOBAL__sub_I_a.bug.cpp
# BB#0:
subq $40, %rsp
.Ltmp15:
.seh_stackalloc 40
.Ltmp16:
.seh_endprologue
callq __cxx_global_var_init
nop
addq $40, %rsp
retq
.seh_handlerdata
.text
.Ltmp17:
.seh_endproc
.lcomm _ZStL8__ioinit,1 # @_ZStL8__ioinit
.section .ctors,"dw"
.p2align 3
.quad _GLOBAL__sub_I_a.bug.cpp
#include <iostream>
void f(long double v) { std::cout << v << std::endl; }
int main(void)
{
long double d = 25;
f(d);
return 0;
}
.file "a.bug.cpp"
.lcomm _ZStL8__ioinit,1,1
.text
.globl _Z1fe
.def _Z1fe; .scl 2; .type 32; .endef
.seh_proc _Z1fe
_Z1fe:
.LFB1023:
pushq %rbp
.seh_pushreg %rbp
pushq %rbx
.seh_pushreg %rbx
subq $72, %rsp
.seh_stackalloc 72
leaq 128(%rsp), %rbp
.seh_setframe %rbp, 128
.seh_endprologue
movq %rcx, %rbx
fldt (%rbx)
fstpt -80(%rbp)
fldt -80(%rbp)
fstpt -96(%rbp)
leaq -96(%rbp), %rax
movq %rax, %rdx
movq .refptr._ZSt4cout(%rip), %rcx
call _ZNSolsEe
movq .refptr._ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(%rip), %rdx
movq %rax, %rcx
call _ZNSolsEPFRSoS_E
nop
addq $72, %rsp
popq %rbx
popq %rbp
ret
.seh_endproc
.def __main; .scl 2; .type 32; .endef
.globl main
.def main; .scl 2; .type 32; .endef
.seh_proc main
main:
.LFB1024:
pushq %rbp
.seh_pushreg %rbp
movq %rsp, %rbp
.seh_setframe %rbp, 0
subq $64, %rsp
.seh_stackalloc 64
.seh_endprologue
call __main
fldt .LC1(%rip)
fstpt -16(%rbp)
fldt -16(%rbp)
fstpt -32(%rbp)
leaq -32(%rbp), %rax
movq %rax, %rcx
call _Z1fe
movl $0, %eax
addq $64, %rsp
popq %rbp
ret
.seh_endproc
.def _Z41__static_initialization_and_destruction_0ii; .scl 3; .type 32; .endef
.seh_proc _Z41__static_initialization_and_destruction_0ii
_Z41__static_initialization_and_destruction_0ii:
.LFB1031:
pushq %rbp
.seh_pushreg %rbp
movq %rsp, %rbp
.seh_setframe %rbp, 0
subq $32, %rsp
.seh_stackalloc 32
.seh_endprologue
movl %ecx, 16(%rbp)
movl %edx, 24(%rbp)
cmpl $1, 16(%rbp)
jne .L6
cmpl $65535, 24(%rbp)
jne .L6
leaq _ZStL8__ioinit(%rip), %rcx
call _ZNSt8ios_base4InitC1Ev
movq .refptr.__dso_handle(%rip), %r8
leaq _ZStL8__ioinit(%rip), %rdx
movq .refptr._ZNSt8ios_base4InitD1Ev(%rip), %rcx
call __cxa_atexit
.L6:
nop
addq $32, %rsp
popq %rbp
ret
.seh_endproc
.def _GLOBAL__sub_I__Z1fe; .scl 3; .type 32; .endef
.seh_proc _GLOBAL__sub_I__Z1fe
_GLOBAL__sub_I__Z1fe:
.LFB1032:
pushq %rbp
.seh_pushreg %rbp
movq %rsp, %rbp
.seh_setframe %rbp, 0
subq $32, %rsp
.seh_stackalloc 32
.seh_endprologue
movl $65535, %edx
movl $1, %ecx
call _Z41__static_initialization_and_destruction_0ii
nop
addq $32, %rsp
popq %rbp
ret
.seh_endproc
.section .ctors,"w"
.align 8
.quad _GLOBAL__sub_I__Z1fe
.section .rdata,"dr"
.align 16
.LC1:
.long 0
.long 3355443200
.long 16387
.long 0
.ident "GCC: (GNU) 5.4.0"
.def _ZNSolsEe; .scl 2; .type 32; .endef
.def _ZNSolsEPFRSoS_E; .scl 2; .type 32; .endef
.def _ZNSt8ios_base4InitC1Ev; .scl 2; .type 32; .endef
.def __cxa_atexit; .scl 2; .type 32; .endef
.section .rdata$.refptr._ZNSt8ios_base4InitD1Ev, "dr"
.globl .refptr._ZNSt8ios_base4InitD1Ev
.linkonce discard
.refptr._ZNSt8ios_base4InitD1Ev:
.quad _ZNSt8ios_base4InitD1Ev
.section .rdata$.refptr.__dso_handle, "dr"
.globl .refptr.__dso_handle
.linkonce discard
.refptr.__dso_handle:
.quad __dso_handle
.section .rdata$.refptr._ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, "dr"
.globl .refptr._ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.linkonce discard
.refptr._ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_:
.quad _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.section .rdata$.refptr._ZSt4cout, "dr"
.globl .refptr._ZSt4cout
.linkonce discard
.refptr._ZSt4cout:
.quad _ZSt4cout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment