Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/gcc/config/sparc On sparc64 when comp...



details:   https://anonhg.NetBSD.org/src/rev/b5a99bbbba62
branches:  trunk
changeset: 791367:b5a99bbbba62
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Nov 14 12:21:05 2013 +0000

description:
On sparc64 when compiling 64bit binaries:
 - if proper "marker" objects exist, encode the code model in use in the
   binary
 - default to -mcmodel=medmid (instead of medlow)

diffstat:

 external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h |  24 ++++++++++++++++++-
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r 95c78b8f8c39 -r b5a99bbbba62 external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h
--- a/external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h      Thu Nov 14 12:19:34 2013 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h      Thu Nov 14 12:21:05 2013 +0000
@@ -112,7 +112,7 @@
    + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
 
 #undef SPARC_DEFAULT_CMODEL
-#define SPARC_DEFAULT_CMODEL CM_MEDLOW
+#define SPARC_DEFAULT_CMODEL CM_MEDMID
 
 #endif
 
@@ -158,6 +158,25 @@
       %{pg:-mcmodel=medlow}} " \
   NETBSD_CC1_AND_CC1PLUS_SPEC
 
+#if defined(SPARC_BI_ARCH) || defined(__arch64__)
+/* add code model specific object to the link line for 64bit */
+#define        LINK_SPEC_CODE_MODEL64  \
+       "%{!shared:"    \
+           "%{!mcmodel=*:%:if-exists(%R/usr/lib/sparc_mcmedmid.o)}"    \
+           "%{mcmodel=medlow:%:if-exists(%R/usr/lib/sparc_mcmedlow.o)}" \
+           "%{mcmodel=medmid:%:if-exists(%R/usr/lib/sparc_mcmedmid.o)}" \
+           "%{mcmodel=medany:%:if-exists(%R/usr/lib/sparc_mcmedany.o)}" \
+       "}"
+
+#ifdef SPARC_BI_ARCH
+#define LINK_SPEC_CODE_MODEL   "%{!m32:" LINK_SPEC_CODE_MODEL64 "}"
+#else
+#define        LINK_SPEC_CODE_MODEL    LINK_SPEC_CODE_MODEL64
+#endif
+#else
+#define        LINK_SPEC_CODE_MODEL    ""
+#endif
+
 /* Make sure we use the right output format.  Pick a default and then
    make sure -m32/-m64 switch to the right one.  */
 
@@ -174,7 +193,8 @@
 #define LINK_SPEC \
  "%(link_arch) \
   %{!mno-relax:%{!r:-relax}} \
-  %(netbsd_link_spec)"
+  %(netbsd_link_spec) " \
+  LINK_SPEC_CODE_MODEL
 
 #define NETBSD_ENTRY_POINT "__start"
 



Home | Main Index | Thread Index | Old Index