Module Name: src
Committed By: martin
Date: Thu Nov 14 12:21:05 UTC 2013
Modified Files:
src/external/gpl3/gcc/dist/gcc/config/sparc: netbsd-elf.h
Log Message:
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)
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h
diff -u src/external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h:1.5 src/external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h:1.6
--- src/external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h:1.5 Sun Apr 28 13:35:23 2013
+++ src/external/gpl3/gcc/dist/gcc/config/sparc/netbsd-elf.h Thu Nov 14 12:21:05 2013
@@ -112,7 +112,7 @@ along with GCC; see the file COPYING3.
+ 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 @@ along with GCC; see the file COPYING3.
%{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 @@ along with GCC; see the file COPYING3.
#define LINK_SPEC \
"%(link_arch) \
%{!mno-relax:%{!r:-relax}} \
- %(netbsd_link_spec)"
+ %(netbsd_link_spec) " \
+ LINK_SPEC_CODE_MODEL
#define NETBSD_ENTRY_POINT "__start"