[llvm-dev] [cfe-dev] How to debug if LTO generate wrong code?

Shi, Steven via llvm-dev llvm-dev at lists.llvm.org
Tue May 31 01:08:14 PDT 2016


Hi Mehdi,
What's the default code model for x86_64 Mac OS X App?  Andrew showed me some example code of Mac OS X App as below, which looks to use the small code model but can run at  >4GB high address.

For example if you read a global like this the compiler will generate this code. 
int constant = 0;

int get_constant(void)
{
	return constant;
}

(lldb) dis -n get_constant -b 
a.out`get_constant:
a.out[0x100000f8c] <+0>:  55                           pushq  %rbp
a.out[0x100000f8d] <+1>:  48 89 e5                 movq   %rsp, %rbp
a.out[0x100000f90] <+4>:  8b 05 6a 00 00 00  movl   0x6a(%rip), %eax
a.out[0x100000f96] <+10>: 5d                          popq   %rbp
a.out[0x100000f97] <+11>: c3                          retq   


Steven Shi
Intel\SSG\STO\UEFI Firmware

Tel: +86 021-61166522
iNet: 821-6522



More information about the llvm-dev mailing list