This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Avoid bad ASM_SPEC specs for SPARC VxWorks and FreeBSD
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: rth at redhat dot com, davem at redhat dot com, jakub at redhat dot com, ebotcazou at libertysurf dot fr, Nathan Sidwell <nathan at codesourcery dot com>, ljrittle at acm dot org
- Date: Sat, 5 Feb 2011 00:41:50 +0000 (UTC)
- Subject: Avoid bad ASM_SPEC specs for SPARC VxWorks and FreeBSD
I previously proposed removal of various options from ASM_SPEC
<http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00891.html>
<http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00913.html>
<http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00914.html>, which was
approved except for sparc/sysv4.h.
This left specs in sparc/sysv4.h that accepted the -Ym, option, which
is not actually a valid assembler option for the GNU assembler
(although it is for the Solaris system assembler). This definition of
ASM_SPEC turns out to be used only for FreeBSD and VxWorks, where
non-GNU assemblers are irrelevant. Thus, this patch adds definitions
of ASM_SPEC without the irrelevant options for those targets.
(Consequently, the definition of ASM_SPEC in sparc/sysv4.h is unused
after this patch, but as per
<http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00935.html> is not
removed.)
Tested building cc1 and xgcc for crosses to sparc-wrs-vxworks and
sparc64-freebsd8. OK to commit?
2011-02-04 Joseph Myers <joseph@codesourcery.com>
* config/sparc/freebsd.h (ASM_SPEC): Define.
* config/sparc/vxworks.h (ASM_SPEC): Define.
Index: gcc/config/sparc/freebsd.h
===================================================================
--- gcc/config/sparc/freebsd.h (revision 169841)
+++ gcc/config/sparc/freebsd.h (working copy)
@@ -1,5 +1,5 @@
/* Definitions for Sun SPARC64 running FreeBSD using the ELF format
- Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2010
+ Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2010, 2011
Free Software Foundation, Inc.
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
@@ -30,6 +30,9 @@ along with GCC; see the file COPYING3.
#define CPP_CPU64_DEFAULT_SPEC \
"-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__"
+#undef ASM_SPEC
+#define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)"
+
#define LINK_SPEC "%(link_arch) \
%{!mno-relax:%{!r:-relax}} \
%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
Index: gcc/config/sparc/vxworks.h
===================================================================
--- gcc/config/sparc/vxworks.h (revision 169841)
+++ gcc/config/sparc/vxworks.h (working copy)
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler,
for SPARC targeting the VxWorks run time environment.
- Copyright (C) 2007, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -33,6 +33,9 @@ along with GCC; see the file COPYING3.
#undef CPP_SUBTARGET_SPEC
#define CPP_SUBTARGET_SPEC VXWORKS_ADDITIONAL_CPP_SPEC
+#undef ASM_SPEC
+#define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)"
+
#undef LIB_SPEC
#define LIB_SPEC VXWORKS_LIB_SPEC
#undef LINK_SPEC
--
Joseph S. Myers
joseph@codesourcery.com