summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/config/rs6000/linux64.h17
-rw-r--r--libgcc/config/rs6000/t-linux7
2 files changed, 19 insertions, 5 deletions
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 2ded3301282..5c9f8e3d7af 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -132,20 +132,29 @@ extern int dot_symbols;
if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \
{ \
rs6000_isa_flags |= OPTION_MASK_POWERPC64; \
- error ("%<-m64%> requires a PowerPC64 cpu"); \
+ error ("%<-m64%> requires a PowerPC64 cpu"); \
} \
+ if (!global_options_set.x_rs6000_current_cmodel) \
+ SET_CMODEL (CMODEL_MEDIUM); \
if ((rs6000_isa_flags_explicit \
& OPTION_MASK_MINIMAL_TOC) != 0) \
{ \
if (global_options_set.x_rs6000_current_cmodel \
&& rs6000_current_cmodel != CMODEL_SMALL) \
error ("%<-mcmodel incompatible with other toc options%>"); \
- SET_CMODEL (CMODEL_SMALL); \
+ if (TARGET_MINIMAL_TOC) \
+ SET_CMODEL (CMODEL_SMALL); \
+ else if (TARGET_PCREL \
+ || (PCREL_SUPPORTED_BY_OS \
+ && (rs6000_isa_flags_explicit \
+ & OPTION_MASK_PCREL) == 0)) \
+ /* Ignore -mno-minimal-toc. */ \
+ ; \
+ else \
+ SET_CMODEL (CMODEL_SMALL); \
} \
else \
{ \
- if (!global_options_set.x_rs6000_current_cmodel) \
- SET_CMODEL (CMODEL_MEDIUM); \
if (rs6000_current_cmodel != CMODEL_SMALL) \
{ \
if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \
diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
index 4f6d4c4a4d2..ed821947b66 100644
--- a/libgcc/config/rs6000/t-linux
+++ b/libgcc/config/rs6000/t-linux
@@ -1,3 +1,8 @@
SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
+HOST_LIBGCC2_CFLAGS += -mlong-double-128
+
+# This is a way of selecting -mcmodel=small for ppc64, which gives
+# smaller and faster libgcc code. Directly specifying -mcmodel=small
+# would need to take into account targets for which -mcmodel is invalid.
+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc