Skip to contentSkip to conversation

arc: No need in sections defined in sources with newer tools

PATCH New Alexey Brodkin 1 participant 2 messages Aug 4, 2016 – Aug 5, 2016 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arc: No need in sections defined in sources with newer tools

Starting from arc-2016.03 GNU tools linker properly works with symbols defined in linker script and so external declarations are no longer required, dump them.

---
 arch/arc/cpu/u-boot.lds         | 51 +++++++++++------------------------------
 arch/arc/include/asm/sections.h |  2 --
 arch/arc/lib/Makefile           |  1 -
 arch/arc/lib/relocate.c         |  5 +++-
 arch/arc/lib/sections.c         | 23 -------------------
 5 files changed, 18 insertions(+), 64 deletions(-)
 delete mode 100644 arch/arc/lib/sections.c
arch/arc/cpu/u-boot.lds +14 -37
index 693df74..d3d0a53 100644
@@ -4,38 +4,29 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#include <config.h>
+
 OUTPUT_FORMAT("elf32-littlearc", "elf32-littlearc", "elf32-littlearc")
 OUTPUT_ARCH(arc)
 ENTRY(_start)
 SECTIONS
 {
-	. = ALIGN(4);
+	. = CONFIG_SYS_TEXT_BASE;
+	__image_copy_start = .;
+	__text_start = .;
 	.text :	{
-		*(.__text_start)
-		*(.__image_copy_start)
 		arch/arc/lib/start.o (.text*)
 		*(.text*)
 	}
-
-	. = ALIGN(4);
-	.text_end :
-	{
-		*(.__text_end)
-	}
+	__text_end = .;
 
 	. = ALIGN(1024);
-	.ivt_start : {
-		*(.__ivt_start)
-	}
-
+	__ivt_start = .;
 	.ivt :
 	{
 		*(.ivt)
 	}
-
-	.ivt_end : {
-		*(.__ivt_end)
-	}
+	__ivt_end = .;
 
 	. = ALIGN(4);
 	.rodata : {
@@ -53,34 +44,20 @@ SECTIONS
 	}
 
 	. = ALIGN(4);
-	.rel_dyn_start : {
-		*(.__rel_dyn_start)
-	}
-
+	__rel_dyn_start = .;
 	.rela.dyn : {
 		*(.rela.dyn)
 	}
-
-	.rel_dyn_end : {
-		*(.__rel_dyn_end)
-	}
+	__rel_dyn_end = .;
 
 	. = ALIGN(4);
-	.bss_start : {
-		*(.__bss_start);
-	}
-
+	__bss_start = .;
 	.bss : {
 		*(.bss*)
 	}
-
-	.bss_end : {
-		*(.__bss_end);
-	}
+	__bss_end = .;
 
 	. = ALIGN(4);
-	.image_copy_end : {
-		*(.__image_copy_end)
-		*(.__init_end)
-	}
+	__image_copy_end = .;
+	__init_end = .;
 }
arch/arc/include/asm/sections.h +0 -2
index b8f2a85..00f1217 100644
@@ -9,9 +9,7 @@
 
 #include <asm-generic/sections.h>
 
-extern ulong __text_end;
 extern ulong __ivt_start;
 extern ulong __ivt_end;
-extern ulong __image_copy_start;
 
 #endif /* __ASM_ARC_SECTIONS_H */
arch/arc/lib/Makefile +0 -1
index e592802..eb62b3c 100644
@@ -9,7 +9,6 @@ head-y := start.o
 obj-y += cache.o
 obj-y += cpu.o
 obj-y += interrupts.o
-obj-y += sections.o
 obj-y += relocate.o
 obj-y += strchr-700.o
 obj-y += strcmp.o
arch/arc/lib/relocate.c +4 -1
index 7709633..7802f40 100644
@@ -6,7 +6,10 @@
 
 #include <common.h>
 #include <elf.h>
-#include <asm/sections.h>
+#include <asm-generic/sections.h>
+
+extern ulong __image_copy_start;
+extern ulong __ivt_end;
 
 DECLARE_GLOBAL_DATA_PTR;
 
arch/arc/lib/sections.c deleted +0 -23
deleted file mode 100644
index a72c694..0000000
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-/*
- * For some reason linker sets linker-generated symbols to zero in PIE mode.
- * A work-around is substitution of linker-generated symbols with
- * compiler-generated symbols which are properly handled by linker in PAE mode.
- */
-
-char __bss_start[0] __attribute__((section(".__bss_start")));
-char __bss_end[0] __attribute__((section(".__bss_end")));
-char __image_copy_start[0] __attribute__((section(".__image_copy_start")));
-char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
-char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
-char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
-char __text_start[0] __attribute__((section(".__text_start")));
-char __text_end[0] __attribute__((section(".__text_end")));
-char __init_end[0] __attribute__((section(".__init_end")));
-char __ivt_start[0] __attribute__((section(".__ivt_start")));
-char __ivt_end[0] __attribute__((section(".__ivt_end")));
Signature · 1 line
2.7.4
author Applied
#1 lore raw

PATCH 1/1 arc: No need in sections defined in sources with newer tools

Hi!

Quoted 5 lines · Alexey Brodkin

Starting from arc-2016.03 GNU tools linker properly works with symbols defined in linker script and so external declarations are no longer required, dump them.

Applied,
Thanks!

-Alexey