[Darwin] Remove unnecessary target hook.

Message ID EB32CF43-A347-41D8-B32A-076987512AD5@sandoe.co.uk
State New
Headers show
Series
  • [Darwin] Remove unnecessary target hook.
Related show

Commit Message

Iain Sandoe Aug. 13, 2018, 8:55 p.m.
Hi

For Darwin when we switch between text sections a linker-visible symbol is
required to preserve the linker’s  “atom model”.  Some time ago we implemented
TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS to provide this.

A suitable symbol is now emitted directly from final.c so the target hook version
needs to be removed to avoid multiple symbols at the same address.

OK for trunk?
open branches?

Iain

gcc:
	* config/darwin.c
	 (darwin_function_switched_text_sections): Delete.
	* gcc/config/darwin.h
	 (TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS): Likewise.
---
 gcc/config/darwin.c | 15 ---------------
 gcc/config/darwin.h |  4 ----
 2 files changed, 19 deletions(-)

-- 
2.17.1

Comments

Mike Stump Aug. 14, 2018, 8:15 p.m. | #1
On Aug 13, 2018, at 1:55 PM, Iain Sandoe <iain@sandoe.co.uk> wrote:
> For Darwin when we switch between text sections a linker-visible symbol is

> required to preserve the linker’s  “atom model”.  Some time ago we implemented

> TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS to provide this.

> 

> A suitable symbol is now emitted directly from final.c so the target hook version

> needs to be removed to avoid multiple symbols at the same address.

> 

> OK for trunk?

> open branches?


Ok.

Patch

diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 3a08aea07b..a31cb08b60 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3711,19 +3711,4 @@  default_function_sections:
 		    : text_section;
 }
 
-/* When a function is partitioned between sections, we need to insert a label
-   at the start of each new chunk - so that it may become a valid 'atom' for
-   eh and debug purposes.  Without this the linker will emit warnings if one 
-   tries to add line location information (since the switched fragment will 
-   be anonymous).  */
-
-void
-darwin_function_switched_text_sections (FILE *fp, tree decl, bool new_is_cold)
-{
-  /* Make sure we pick up all the relevant quotes etc.  */
-  assemble_name_raw (fp, new_is_cold ? "__cold_sect_of_" : "__hot_sect_of_");
-  assemble_name_raw (fp, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
-  fputs (":\n", fp);
-}
-
 #include "gt-darwin.h"
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 980ad9b405..a65ae441a0 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -708,10 +708,6 @@  extern GTY(()) section * darwin_sections[NUM_DARWIN_SECTIONS];
 #undef	TARGET_ASM_FUNCTION_SECTION
 #define TARGET_ASM_FUNCTION_SECTION darwin_function_section
 
-#undef	TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS
-#define TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS \
-	darwin_function_switched_text_sections
-
 #undef	TARGET_ASM_SELECT_RTX_SECTION
 #define TARGET_ASM_SELECT_RTX_SECTION machopic_select_rtx_section
 #undef  TARGET_ASM_UNIQUE_SECTION