[committed,MSP430] Only add crtn.o to ENDFILE_SPEC if it exists

Message ID 20190724222142.0a97ff50@jozef-kubuntu
State New
Headers show
Series
  • [committed,MSP430] Only add crtn.o to ENDFILE_SPEC if it exists
Related show

Commit Message

Jozef Lawrynowicz July 24, 2019, 9:21 p.m.
A recent patch to Newlib (commit 884b05b54) removes crtn.o for msp430.
This patch wraps uses of crtn.o in ENDFILE_SPEC from config/msp430.h in
if-exists, so compatibility with new and old newlib is maintained.

Committed on trunk as obvious.

Patch

From 65a155eb552343a28861b9d5e04e59db28bd2743 Mon Sep 17 00:00:00 2001
From: jozefl <jozefl@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 24 Jul 2019 21:08:34 +0000
Subject: [PATCH] 2019-07-24  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/msp430/msp430.h (ENDFILE_SPEC): Wrap uses of crtn*.o in
	if-exists.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@273773 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog              | 5 +++++
 gcc/config/msp430/msp430.h | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5cd80e8c7a1..8ed57edef03 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@ 
+2019-07-24  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+	* config/msp430/msp430.h (ENDFILE_SPEC): Wrap uses of crtn*.o in
+	if-exists.
+
 2019-07-24  Martin Sebor  <msebor@redhat.com>
 
 	PR driver/80545
diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h
index 1288b1a263d..ca7cf20e1d7 100644
--- a/gcc/config/msp430/msp430.h
+++ b/gcc/config/msp430/msp430.h
@@ -49,7 +49,7 @@  extern bool msp430x;
 
 /* -lgcc is included because crtend.o needs __mspabi_func_epilog_1.  */
 #undef  ENDFILE_SPEC
-#define ENDFILE_SPEC "%{!minrt:crtend.o%s} %{minrt:crtn-minrt.o%s}%{!minrt:crtn.o%s} -lgcc"
+#define ENDFILE_SPEC "%{!minrt:crtend.o%s} %{minrt:%:if-exists(crtn-minrt.o%s)}%{!minrt:%:if-exists(crtn.o%s)} -lgcc"
 
 #define ASM_SPEC "-mP " /* Enable polymorphic instructions.  */ \
   "%{mcpu=*:-mcpu=%*}%{!mcpu=*:%{mmcu=*:-mmcu=%*}} " /* Pass the CPU type on to the assembler.  */ \
-- 
2.17.1