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

Rafael EspĂ­ndola via llvm-dev llvm-dev at lists.llvm.org
Tue May 31 06:21:05 PDT 2016

On 31 May 2016 at 01:08, Shi, Steven <steven.shi at intel.com> wrote:
> 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.

Small, but PIC.

> For example if you read a global like this the compiler will generate this code.
> int constant = 0;
> int get_constant(void)
> {
>         return constant;
> }

Compiling for ELF with -FPIE -Os I get

get_constant:                           # @get_constant
# BB#0:                                 # %entry
        movl    constant(%rip), %eax

Which should also be able to run at any address.


More information about the llvm-dev mailing list