This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
NetBSD/ARM aout rework link specs
- From: Richard Earnshaw <rearnsha at buzzard dot freeserve dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org, thorpej at wasabisystems dot com
- Cc: Richard dot Earnshaw at buzzard dot freeserve dot co dot uk
- Date: Sat, 21 Sep 2002 10:53:19 +0100
- Subject: NetBSD/ARM aout rework link specs
- Reply-to: Richard dot Earnshaw at buzzard dot freeserve dot co dot uk
This patch reworks slightly the way that link specs work in NetBSD a.out
systems. Instead of directly defining LINK_SPEC in config/netbsd-aout.h
we instead define NETBSD_LINK_SPEC and then define LINK_SPEC in terms of
it. For ARM this enables us to use a subtarget spec to hold the common
NetBSD part and then override LINK_SPEC with the processor-specific
requirements, without having to duplicate the common part.
Bootstrapped on an ARM NetBSD 1.5 system.
Jason, are you ok with this?
R.
<date> Richard Earnshaw <rearnsha@arm.com>
* netbsd-aout.h (NETBSD_LINK_SPEC): New, takes old definition of
LINK_SPEC.
(LINK_SPEC): Define to NETBSD_LINK_SPEC.
* arm/netbsd.h (SUBTARGET_EXTRA_SEPCS): Add NETBSD_LINK_SPEC.
(LINK_SPEC): Rework to use NETBSD_LINK_SPEC).
Index: netbsd-aout.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/netbsd-aout.h,v
retrieving revision 1.6
diff -p -p -r1.6 netbsd-aout.h
*** netbsd-aout.h 28 Jul 2002 18:44:33 -0000 1.6
--- netbsd-aout.h 21 Sep 2002 09:46:06 -0000
*************** Boston, MA 02111-1307, USA. */
*** 58,65 ****
/* Provide a LINK_SPEC appropriate for NetBSD a.out. Here we provide
support for the special GCC options -static, -assert, and -nostdlib. */
! #undef LINK_SPEC
! #define LINK_SPEC \
"%{nostdlib:-nostdlib} \
%{!shared: \
%{!nostdlib: \
--- 58,65 ----
/* Provide a LINK_SPEC appropriate for NetBSD a.out. Here we provide
support for the special GCC options -static, -assert, and -nostdlib. */
! #undef NETBSD_LINK_SPEC
! #define NETBSD_LINK_SPEC \
"%{nostdlib:-nostdlib} \
%{!shared: \
%{!nostdlib: \
*************** Boston, MA 02111-1307, USA. */
*** 71,76 ****
--- 71,79 ----
%{R*} \
%{assert*}"
+ /* Default LINK_SPEC. */
+ #undef LINK_SPEC
+ #define LINK_SPEC NETBSD_LINK_SPEC
/* Some imports from svr4.h in support of shared libraries. */
Index: arm/netbsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/arm/netbsd.h,v
retrieving revision 1.21
diff -p -p -r1.21 netbsd.h
*** arm/netbsd.h 15 Sep 2002 18:24:04 -0000 1.21
--- arm/netbsd.h 21 Sep 2002 09:46:07 -0000
*************** Boston, MA 02111-1307, USA. */
*** 54,60 ****
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
! { "netbsd_cpp_spec", NETBSD_CPP_SPEC },
#undef CPP_SPEC
#define CPP_SPEC "\
--- 54,61 ----
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
! { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
! { "netbsd_link_spec", NETBSD_LINK_SPEC },
#undef CPP_SPEC
#define CPP_SPEC "\
*************** Boston, MA 02111-1307, USA. */
*** 71,80 ****
/* Pass -X to the linker so that it will strip symbols starting with 'L' */
#undef LINK_SPEC
! #define LINK_SPEC "\
! -X %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} \
! %{static:-Bstatic}} %{shared} %{assert*} \
! "
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
--- 72,78 ----
/* Pass -X to the linker so that it will strip symbols starting with 'L' */
#undef LINK_SPEC
! #define LINK_SPEC "-X %(netbsd_link_spec)"
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"