[PATCH] [mips] Add the following MIPS options that control gp-relative addressing of small data items: -mgpopt, -mlocal-sdata, -mextern-sdata.

Daniel Sanders daniel.sanders at imgtec.com
Tue Aug 19 05:32:14 PDT 2014


I'm not very familiar with the bare-metal side of things at the moment so I'll need to do some reading before I can review this patch properly. I wanted to ask a question about the defaults though.

>>! In D4903#6, @sstankovic wrote:
> Some notes about the patch. Patch is implemented so that if -mgpopt is not specified, then default value depends on the target - it is false for Linux and true for bare metal. gcc does it differently - -mgpopt is always true by default, and -G option actually controls gp-relative addressing - it is 0 by default on Linux, and 8 for bare metal. (On targets where -mabicalls is true by default (Linux), -G is 0 by default, and on targets where is -mabicalls is false by default (bare metal) -G is 8.). gcc does not generate gp-relative addressing for -mabicalls, and this is also implemented in the patch.
> 
> So in gcc, to use gp-relative addressing:
> 
> mips-linux-gnu-gcc -mno-abicalls -G 8 hello.c -o hello (Linux)
> mips-sde-elf-gcc hello.c -o hello (bare metal)
> 
> The equivalent to -G is named -mips-ssection-threshold in llc (added by some previous commit), and the patch doesn't change that.

I think I may be missing something here. If llvm's -mips-ssection-threshold is a direct equivalent to gcc's -G then why not treat the defaults for -mgpopt/-mips-ssection-threshold in llvm the same way as the defaults for -mgpopt/-G in gcc?

http://reviews.llvm.org/D4903






More information about the llvm-commits mailing list