Rafael Espíndola via llvm-dev
2016-May-30 23:56 UTC
[llvm-dev] [cfe-dev] How to debug if LTO generate wrong code?
On 30 May 2016 at 19:55, Mehdi Amini <mehdi.amini at apple.com> wrote:> > > Sent from my iPhone > >> On May 30, 2016, at 4:52 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote: >> >>> On 30 May 2016 at 16:56, Mehdi Amini <mehdi.amini at apple.com> wrote: >>> >>> >>> On 05/30/16 01:34 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote: >>> >>> We don't use cl::opt in gold, instead we parse the -plugin-opts that >>> gold passes the plugin (see process_plugin_option). >>> >>> What about that: >>> >>> $ grep ParseCommandLineOptions tools/gold/gold-plugin.cpp >>> >>> // ParseCommandLineOptions() expects argv[0] to be program name. >>> Lazily >>> >>> cl::ParseCommandLineOptions(NumOpts, &options::extra[0]); >> >> >> That is for the options that the gold plugin itself doesn't understand >> and just passes to llvm. This allows you to do things like >> --plugin-opt=-debug-pass=Arguments. > > This is what I expected, so my cl:opt should work, right? I don't really get your original point?Just that the gold plugin itself never defines a cl::opt. It just forwards the llvm ones. Cheers, Rafael
Shi, Steven via llvm-dev
2016-May-31 08:08 UTC
[llvm-dev] [cfe-dev] How to debug if LTO generate wrong code?
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
Rafael Espíndola via llvm-dev
2016-May-31 13:21 UTC
[llvm-dev] [cfe-dev] How to debug if LTO generate wrong code?
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 retq Which should also be able to run at any address. Cheers, Rafael