[PATCH] [mips] Add the following MIPS options that control gp-relative addressing of small data items: -mgpopt, -mlocal-sdata, -mextern-sdata.
Sasa Stankovic
Sasa.Stankovic at imgtec.com
Fri Aug 15 02:45:08 PDT 2014
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.
http://reviews.llvm.org/D4903
More information about the llvm-commits
mailing list