From: Chao-ying Fu <c...@wavecomp.com> Cherry-picked 3c800e0a3278de913ccefa7eed6eb070d4f7c558 from https://github.com/MIPS/gcc
Signed-off-by: Jaydeep Patil <jaydeep.pa...@imgtec.com> Signed-off-by: Faraz Shahbazker <fshahbaz...@wavecomp.com> Signed-off-by: Chao-ying Fu <c...@mips.com> Signed-off-by: Aleksandar Rakic <aleksandar.ra...@htecgroup.com> --- gcc/config/mips/mips-opts.h | 7 +++++++ gcc/config/mips/mips.h | 10 ++++++++-- gcc/config/mips/mips.opt | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/gcc/config/mips/mips-opts.h b/gcc/config/mips/mips-opts.h index 4b0c2c09a3d..0d0b757dc08 100644 --- a/gcc/config/mips/mips-opts.h +++ b/gcc/config/mips/mips-opts.h @@ -60,4 +60,11 @@ enum mips_explicit_relocs { MIPS_EXPLICIT_RELOCS_BASE, MIPS_EXPLICIT_RELOCS_PCREL }; + +/* Enumerates the setting of the -mclib= option. */ +enum mips_lib_setting { + MIPS_LIB_NEWLIB, + MIPS_LIB_SMALL, + MIPS_LIB_TINY +}; #endif diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index fb696ed9957..cf3a4e04880 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -609,6 +609,12 @@ struct mips_cpu_info { if (mips_nan == MIPS_IEEE_754_2008) \ builtin_define ("__mips_nan2008"); \ \ + if (mips_c_lib == MIPS_LIB_SMALL) \ + builtin_define ("__mips_clib_small"); \ + \ + if (mips_c_lib == MIPS_LIB_TINY) \ + builtin_define ("__mips_clib_tiny"); \ + \ if (TARGET_BIG_ENDIAN) \ { \ builtin_define_std ("MIPSEB"); \ @@ -879,8 +885,8 @@ struct mips_cpu_info { /* Infer a -mnan=2008 setting from a -mips argument. */ #define MIPS_ISA_NAN2008_SPEC \ - "%{mnan*:;mips32r6|mips64r6:-mnan=2008;march=m51*: \ - %{!msoft-float:-mnan=2008}}" + "%{mnan*:;mips32r6|mips64r6:-mnan=2008; \ + march=m51*|mclib=small|mclib=tiny:%{!msoft-float:-mnan=2008}}" #if (MIPS_ABI_DEFAULT == ABI_O64 \ || MIPS_ABI_DEFAULT == ABI_N32 \ diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt index 99fe9301900..c04a3d9dbfa 100644 --- a/gcc/config/mips/mips.opt +++ b/gcc/config/mips/mips.opt @@ -508,3 +508,20 @@ Use Loongson EXTension (EXT) instructions. mloongson-ext2 Target Var(TARGET_LOONGSON_EXT2) Use Loongson EXTension R2 (EXT2) instructions. + +mclib= +Target RejectNegative Joined Var(mips_c_lib) ToLower Enum(mips_lib_setting) Init(MIPS_LIB_NEWLIB) +Specify the C library to use with this application. + +Enum +Name(mips_lib_setting) Type(enum mips_lib_setting) +Known MIPS C libraries (for use with the -mclib= option): + +EnumValue +Enum(mips_lib_setting) String(newlib) Value(MIPS_LIB_NEWLIB) + +EnumValue +Enum(mips_lib_setting) String(small) Value(MIPS_LIB_SMALL) + +EnumValue +Enum(mips_lib_setting) String(tiny) Value(MIPS_LIB_TINY) -- 2.34.1