[RFC,5/6] Also place entry points into .text.startup

Message ID 20230515144815.3939017-6-bugaevc@gmail.com
State New
Headers
Series .text.subsections for some questionable benefit |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-still_applies warning Patch no longer applies to master

Commit Message

Sergey Bugaev May 15, 2023, 2:48 p.m. UTC
  Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
 sysdeps/aarch64/dl-start.S              | 1 +
 sysdeps/aarch64/start.S                 | 2 +-
 sysdeps/alpha/dl-machine.h              | 2 +-
 sysdeps/alpha/start.S                   | 2 +-
 sysdeps/arc/dl-machine.h                | 2 +-
 sysdeps/arc/start.S                     | 1 +
 sysdeps/arm/dl-machine.h                | 2 +-
 sysdeps/arm/start.S                     | 2 +-
 sysdeps/csky/abiv2/start.S              | 2 +-
 sysdeps/csky/dl-machine.h               | 3 ++-
 sysdeps/hppa/dl-machine.h               | 3 ++-
 sysdeps/hppa/start.S                    | 2 +-
 sysdeps/i386/dl-machine.h               | 2 +-
 sysdeps/ia64/dl-machine.h               | 2 +-
 sysdeps/ia64/start.S                    | 1 +
 sysdeps/loongarch/dl-machine.h          | 2 +-
 sysdeps/loongarch/start.S               | 1 +
 sysdeps/m68k/dl-machine.h               | 2 +-
 sysdeps/mach/hurd/i386/static-start.S   | 2 +-
 sysdeps/mach/hurd/x86_64/static-start.S | 2 +-
 sysdeps/microblaze/dl-machine.h         | 2 +-
 sysdeps/microblaze/start.S              | 2 +-
 sysdeps/mips/dl-machine.h               | 4 ++--
 sysdeps/mips/start.S                    | 2 +-
 sysdeps/nios2/dl-machine.h              | 3 ++-
 sysdeps/nios2/start.S                   | 2 +-
 sysdeps/or1k/dl-start.S                 | 1 +
 sysdeps/or1k/start.S                    | 1 +
 sysdeps/powerpc/powerpc32/dl-start.S    | 1 +
 sysdeps/powerpc/powerpc32/start.S       | 2 +-
 sysdeps/powerpc/powerpc64/dl-machine.h  | 2 +-
 sysdeps/powerpc/powerpc64/start.S       | 2 +-
 sysdeps/riscv/dl-machine.h              | 2 +-
 sysdeps/riscv/start.S                   | 1 +
 sysdeps/s390/s390-32/dl-machine.h       | 3 ++-
 sysdeps/s390/s390-32/start.S            | 2 +-
 sysdeps/s390/s390-64/dl-machine.h       | 3 ++-
 sysdeps/s390/s390-64/start.S            | 2 +-
 sysdeps/sh/dl-machine.h                 | 2 +-
 sysdeps/sh/start.S                      | 2 +-
 sysdeps/sparc/sparc32/dl-machine.h      | 2 +-
 sysdeps/sparc/sparc32/start.S           | 2 +-
 sysdeps/sparc/sparc64/dl-machine.h      | 2 +-
 sysdeps/sparc/sparc64/start.S           | 2 +-
 sysdeps/x86_64/dl-machine.h             | 4 ++--
 sysdeps/x86_64/start.S                  | 1 +
 sysdeps/x86_64/x32/dl-machine.h         | 2 +-
 47 files changed, 54 insertions(+), 40 deletions(-)
  

Patch

diff --git a/sysdeps/aarch64/dl-start.S b/sysdeps/aarch64/dl-start.S
index dd9c0725..1b7e7ca2 100644
--- a/sysdeps/aarch64/dl-start.S
+++ b/sysdeps/aarch64/dl-start.S
@@ -19,6 +19,7 @@ 
 
 #include <sysdep.h>
 
+	.section .text.startup
 ENTRY (_start)
 	/* Create an initial frame with 0 LR and FP */
 	cfi_undefined (x30)
diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
index 9ec8e388..0f6f72ee 100644
--- a/sysdeps/aarch64/start.S
+++ b/sysdeps/aarch64/start.S
@@ -59,7 +59,7 @@ 
 					NULL
  */
 
-	.text
+	.section .text.startup
 ENTRY(_start)
 	/* Create an initial frame with 0 LR and FP */
 	cfi_undefined (x30)
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index 5e748d2c..e003796c 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -135,7 +135,7 @@  elf_machine_runtime_setup (struct link_map *map, struct r_scope_elem *scope[],
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm ("\
-	.section .text						\n\
+	.section .text.startup					\n\
 	.set at							\n\
 	.globl _start						\n\
 	.ent _start						\n\
diff --git a/sysdeps/alpha/start.S b/sysdeps/alpha/start.S
index 80d0ac36..8fef02db 100644
--- a/sysdeps/alpha/start.S
+++ b/sysdeps/alpha/start.S
@@ -35,7 +35,7 @@ 
 
 #include <sysdep.h>
 
-	.text
+	.section .text.startup
 	.align 3
 	.globl _start
 	.ent _start, 0
diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h
index 4dc652a4..c640f81f 100644
--- a/sysdeps/arc/dl-machine.h
+++ b/sysdeps/arc/dl-machine.h
@@ -153,7 +153,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
     -calls into app main with address of finaliser.  */
 
 #define RTLD_START asm ("\
-.text									\n\
+.section .text.startup							\n\
 .globl __start								\n\
 .type __start, @function						\n\
 __start:								\n\
diff --git a/sysdeps/arc/start.S b/sysdeps/arc/start.S
index db3bab63..1af949be 100644
--- a/sysdeps/arc/start.S
+++ b/sysdeps/arc/start.S
@@ -50,6 +50,7 @@ 
         env[0...N]      environment variables (pointers)
         NULL.  */
 
+	.section .text.startup
 ENTRY (ENTRY_POINT)
 
 	/* Needed to make gdb backtraces stop here.  */
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 3825ec56..9484c033 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -122,7 +122,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm ("\
-.text\n\
+.section .text.startup\n\
 .globl _start\n\
 .type _start, %function\n\
 .globl _dl_start_user\n\
diff --git a/sysdeps/arm/start.S b/sysdeps/arm/start.S
index f53f4581..c607712e 100644
--- a/sysdeps/arm/start.S
+++ b/sysdeps/arm/start.S
@@ -69,7 +69,7 @@ 
 	.syntax unified
 #endif
 
-	.text
+	.section .text.startup
 	.globl _start
 	.type _start,#function
 _start:
diff --git a/sysdeps/csky/abiv2/start.S b/sysdeps/csky/abiv2/start.S
index 1edbd0bb..b39cd09b 100644
--- a/sysdeps/csky/abiv2/start.S
+++ b/sysdeps/csky/abiv2/start.S
@@ -41,7 +41,7 @@ 
 
 #include <sysdep.h>
 
-	.text
+	.section .text.startup
 	.globl _start;
 	.type _start,@function;
 	.align 4;
diff --git a/sysdeps/csky/dl-machine.h b/sysdeps/csky/dl-machine.h
index 6bbe5427..10b8ff89 100644
--- a/sysdeps/csky/dl-machine.h
+++ b/sysdeps/csky/dl-machine.h
@@ -98,7 +98,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
 #define RTLD_START asm ("\
-.text\n\
+.section .text.startup\n\
 .globl _start\n\
 .type _start, @function\n\
 .globl _dl_start_user\n\
@@ -135,6 +135,7 @@  _dl_start_user:\n\
 	lrw	a0, _dl_fini@GOTOFF\n\
 	addu	a0, gb\n\
 	jmp	r10\n\
+.previous\n\
 ");
 
 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
index 7af13bba..144f7b01 100644
--- a/sysdeps/hppa/dl-machine.h
+++ b/sysdeps/hppa/dl-machine.h
@@ -358,7 +358,7 @@  set_dp (struct link_map *map)						\
 }									\
 									\
 asm (									\
-"	.text\n"							\
+"	.section .text.startup\n"					\
 "	.globl _start\n"						\
 "	.type _start,@function\n"					\
 "_start:\n"								\
@@ -486,6 +486,7 @@  asm (									\
 "	ldw	4(%r3),%r19\n"	/* load the object's gp */		\
 "	bv	%r0(%r2)\n"						\
 "	depi	2,31,2,%r23\n"	/* delay slot */			\
+"	.text\n"							\
 );
 
 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
diff --git a/sysdeps/hppa/start.S b/sysdeps/hppa/start.S
index cfc22ab7..0d69f9c2 100644
--- a/sysdeps/hppa/start.S
+++ b/sysdeps/hppa/start.S
@@ -51,7 +51,7 @@ 
 .Lp__libc_start_main:
 	.word P%__libc_start_main
 
-	.text
+	.section .text.startup
 	.align 4
 	.globl _start
 	.export _start, ENTRY
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index d64494e7..c78c44f2 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -124,7 +124,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm ("\n\
-	.text\n\
+	.section .text.startup\n\
 	.align 16\n\
 0:	movl (%esp), %ebx\n\
 	ret\n\
diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h
index e1da3dad..941a7e74 100644
--- a/sysdeps/ia64/dl-machine.h
+++ b/sysdeps/ia64/dl-machine.h
@@ -156,7 +156,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm (						      \
-".text\n"								      \
+".section .text.startup\n"						      \
 "	.global _start#\n"						      \
 "	.proc _start#\n"						      \
 "_start:\n"								      \
diff --git a/sysdeps/ia64/start.S b/sysdeps/ia64/start.S
index e07304d3..50d0c1bd 100644
--- a/sysdeps/ia64/start.S
+++ b/sysdeps/ia64/start.S
@@ -47,6 +47,7 @@ 
  *	out6:	stack_end
  */
 
+	.section .text.startup
 	.align 32
 	.global _start
 
diff --git a/sysdeps/loongarch/dl-machine.h b/sysdeps/loongarch/dl-machine.h
index 1e07d124..41423bf9 100644
--- a/sysdeps/loongarch/dl-machine.h
+++ b/sysdeps/loongarch/dl-machine.h
@@ -83,7 +83,7 @@  static inline ElfW (Addr) elf_machine_dynamic (void)
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm (\
-	".text\n\
+	".section .text.startup\n\
 	" _RTLD_PROLOGUE (ENTRY_POINT) "\
 	.cfi_label .Ldummy   \n\
 	" CFI_UNDEFINED (1) "   \n\
diff --git a/sysdeps/loongarch/start.S b/sysdeps/loongarch/start.S
index e9d82033..5b2baaaf 100644
--- a/sysdeps/loongarch/start.S
+++ b/sysdeps/loongarch/start.S
@@ -52,6 +52,7 @@  __libc_start_main (int (*main) (int, char **, char **),
 		   void *stack_end);
  */
 
+	.section .text.startup
 ENTRY (ENTRY_POINT)
 
 /* Terminate call stack by noting ra is undefined.  Use a dummy
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index 5ee586b2..2376895e 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -127,7 +127,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm ("\
-	.text\n\
+	.section .text.startup\n\
 	.globl _start\n\
 	.type _start,@function\n\
 _start:\n\
diff --git a/sysdeps/mach/hurd/i386/static-start.S b/sysdeps/mach/hurd/i386/static-start.S
index c5d12645..3b8f9418 100644
--- a/sysdeps/mach/hurd/i386/static-start.S
+++ b/sysdeps/mach/hurd/i386/static-start.S
@@ -16,7 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-	.text
+	.section .text.startup
 	.globl _start
 _start:
 	call _hurd_stack_setup
diff --git a/sysdeps/mach/hurd/x86_64/static-start.S b/sysdeps/mach/hurd/x86_64/static-start.S
index cc8e2410..1b461a83 100644
--- a/sysdeps/mach/hurd/x86_64/static-start.S
+++ b/sysdeps/mach/hurd/x86_64/static-start.S
@@ -16,7 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-	.text
+	.section .text.startup
 	.globl _start
 _start:
 
diff --git a/sysdeps/microblaze/dl-machine.h b/sysdeps/microblaze/dl-machine.h
index da875b68..d6dec0c0 100644
--- a/sysdeps/microblaze/dl-machine.h
+++ b/sysdeps/microblaze/dl-machine.h
@@ -92,7 +92,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm ("\
-	.text\n\
+	.section .text.startup\n\
 	.globl _start\n\
 	.type _start,@function\n\
 _start:\n\
diff --git a/sysdeps/microblaze/start.S b/sysdeps/microblaze/start.S
index c35c4737..5f77e911 100644
--- a/sysdeps/microblaze/start.S
+++ b/sysdeps/microblaze/start.S
@@ -33,7 +33,7 @@ 
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-    .text
+    .section .text.startup
     .globl _start
     .type _start,@function
 _start:
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index a08e526a..73cccc1d 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -245,7 +245,7 @@  do {									\
 #  define LOAD_31 "addiupc $31, 0"
 # endif
 # define RTLD_START asm (\
-	".text\n\
+	".section .text.startup\n\
 	" _RTLD_PROLOGUE(ENTRY_POINT) "\
 	" STRINGXV(SETUP_GPX($25)) "\n\
 	" STRINGXV(SETUP_GPX64($18,$25)) "\n\
@@ -310,7 +310,7 @@  do {									\
    are to be supported.  */
 
 # define RTLD_START asm (\
-	".text\n\
+	".section .text.startup\n\
 	.set mips16\n\
 	" _RTLD_PROLOGUE (ENTRY_POINT) "\
 	# Construct GP value in $3.\n\
diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S
index c08991c2..01ed88fa 100644
--- a/sysdeps/mips/start.S
+++ b/sysdeps/mips/start.S
@@ -71,7 +71,7 @@ 
 		      void (*rtld_fini) (void), void *stack_end)
 */
 
-	.text
+	.section .text.startup
 	.globl ENTRY_POINT
 	.type ENTRY_POINT,@function
 #ifndef __mips16
diff --git a/sysdeps/nios2/dl-machine.h b/sysdeps/nios2/dl-machine.h
index 50c83df1..cc92de67 100644
--- a/sysdeps/nios2/dl-machine.h
+++ b/sysdeps/nios2/dl-machine.h
@@ -97,7 +97,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm ("\
-.text\n\
+.section .text.startup\n\
 .globl _start\n\
 .type _start, %function\n\
 _start:\n\
@@ -155,6 +155,7 @@  _start:\n\
 \n\
         /* Jump to the user's entry point.  */\n\
         jmp r16\n\
+.previous\n\
 ");
 
 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
diff --git a/sysdeps/nios2/start.S b/sysdeps/nios2/start.S
index 9179c330..33b2a128 100644
--- a/sysdeps/nios2/start.S
+++ b/sysdeps/nios2/start.S
@@ -65,7 +65,7 @@ 
 	value, terminated by an AT_NULL tag.
 */
 
-	.text
+	.section .text.startup
 	.globl _start
 	.type _start,%function
 _start:
diff --git a/sysdeps/or1k/dl-start.S b/sysdeps/or1k/dl-start.S
index 6024568c..77409b57 100644
--- a/sysdeps/or1k/dl-start.S
+++ b/sysdeps/or1k/dl-start.S
@@ -21,6 +21,7 @@ 
 /* Initial entry point code for the dynamic linker.
    The function _dl_start is the real entry point;
    it's return value is the user program's entry point.  */
+	.section .text.startup
 ENTRY (_start)
 	/* Count arguments in r11 */
 	l.ori	r3, r1, 0
diff --git a/sysdeps/or1k/start.S b/sysdeps/or1k/start.S
index 92d39323..0573e712 100644
--- a/sysdeps/or1k/start.S
+++ b/sysdeps/or1k/start.S
@@ -50,6 +50,7 @@ 
 #include <sysdep.h>
 #include <entry.h>
 
+	.section .text.startup
 ENTRY (ENTRY_POINT)
 
 	/* Setup Arguments to the __libc_start_main function.  */
diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S
index d42e8ded..dd358fab 100644
--- a/sysdeps/powerpc/powerpc32/dl-start.S
+++ b/sysdeps/powerpc/powerpc32/dl-start.S
@@ -21,6 +21,7 @@ 
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.	*/
+	.section ".text.startup"
 ENTRY(_start)
 /* We start with the following on the stack, from top:
    argc (4 bytes);
diff --git a/sysdeps/powerpc/powerpc32/start.S b/sysdeps/powerpc/powerpc32/start.S
index 644f6f53..e944cfbe 100644
--- a/sysdeps/powerpc/powerpc32/start.S
+++ b/sysdeps/powerpc/powerpc32/start.S
@@ -56,7 +56,7 @@  L(start_addresses):
 	.long 	0 /* Used to be fini.  */
 	ASM_SIZE_DIRECTIVE(L(start_addresses))
 
-	.section ".text"
+	.section ".text.startup"
 ENTRY(_start)
  /* Save the stack pointer, in case we're statically linked under Linux.  */
 	mr	r9,r1
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index a69ad0ed..36d53663 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -125,7 +125,7 @@  elf_machine_dynamic (void)
    `_dl_start' is the real entry point; its return value is the user
    program's entry point.  */
 #define RTLD_START \
-  asm (".pushsection \".text\"\n"					\
+  asm (".pushsection \".text.startup\"\n"					\
 "	.align	2\n"							\
 "	" ENTRY_2(_start) "\n"						\
 BODY_PREFIX "_start:\n"							\
diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S
index f86d400f..3dbbc8ac 100644
--- a/sysdeps/powerpc/powerpc64/start.S
+++ b/sysdeps/powerpc/powerpc64/start.S
@@ -61,7 +61,7 @@  L(start_addresses):
 	.section	".toc","aw"
 .L01:
 	.tc	L(start_addresses)[TC],L(start_addresses)
-	.section ".text"
+	.section ".text.startup"
 ENTRY (_start)
  /* Save the stack pointer, in case we're statically linked under Linux.  */
 	mr	r9,r1
diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h
index c0c9bd93..a5577e36 100644
--- a/sysdeps/riscv/dl-machine.h
+++ b/sysdeps/riscv/dl-machine.h
@@ -100,7 +100,7 @@  elf_machine_dynamic (void)
    its return value is the user program's entry point.  */
 
 #define RTLD_START asm (\
-	".text\n\
+	".section .text.startup\n\
 	" _RTLD_PROLOGUE (ENTRY_POINT) "\
 	mv a0, sp\n\
 	jal _dl_start\n\
diff --git a/sysdeps/riscv/start.S b/sysdeps/riscv/start.S
index 6dfe6527..f90928e8 100644
--- a/sysdeps/riscv/start.S
+++ b/sysdeps/riscv/start.S
@@ -42,6 +42,7 @@ 
    a0 contains the address of a function to be passed to atexit.
    __libc_start_main wants this in a5.  */
 
+	.section .text.startup
 ENTRY (ENTRY_POINT)
 	/* Terminate call stack by noting ra is undefined.  Use a dummy
 	   .cfi_label to force starting the FDE.  */
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index cf784ed8..288b2159 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -168,7 +168,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.  */
 
 #define RTLD_START __asm__ ("\n\
-.text\n\
+.section text.startup\n\
 .align 4\n\
 .globl _start\n\
 .globl _dl_start_user\n\
@@ -215,6 +215,7 @@  _dl_start_user:\n\
 .Ladr0: .long _GLOBAL_OFFSET_TABLE_-.Llit\n\
 .Ladr1: .long _dl_start-.Llit\n\
 .Ladr4: .long _dl_init@PLT-.Llit\n\
+.previous\n\
 ");
 
 #ifndef RTLD_START_SPECIAL_INIT
diff --git a/sysdeps/s390/s390-32/start.S b/sysdeps/s390/s390-32/start.S
index eb84e7ff..fb3a4b3b 100644
--- a/sysdeps/s390/s390-32/start.S
+++ b/sysdeps/s390/s390-32/start.S
@@ -54,7 +54,7 @@ 
 					NULL
 */
 
-	.text
+	.section .text.startup
 	.globl _start
 	.type _start,@function
 _start:
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index 6ab736c3..ea23c3bd 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -151,7 +151,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.	*/
 
 #define RTLD_START __asm__ ("\n\
-.text\n\
+.section .text.startup\n\
 .align 4\n\
 .globl _start\n\
 .globl _dl_start_user\n\
@@ -191,6 +191,7 @@  _dl_start_user:\n\
 	aghi  %r15,160\n\
 	# Jump to the user's entry point (saved in %r8).\n\
 	br    %r8\n\
+.previous\n\
 ");
 
 #ifndef RTLD_START_SPECIAL_INIT
diff --git a/sysdeps/s390/s390-64/start.S b/sysdeps/s390/s390-64/start.S
index 61720c34..52b6b25f 100644
--- a/sysdeps/s390/s390-64/start.S
+++ b/sysdeps/s390/s390-64/start.S
@@ -54,7 +54,7 @@ 
 					NULL
 */
 
-	.text
+	.section .text.startup
 	.globl _start
 	.type _start,@function
 _start:
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index f9492678..452dcd08 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -129,7 +129,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    its return value is the user program's entry point.	*/
 
 #define RTLD_START asm ("\
-.text\n\
+.section .text.startup\n\
 .globl _start\n\
 .globl _dl_start_user\n\
 _start:\n\
diff --git a/sysdeps/sh/start.S b/sysdeps/sh/start.S
index 6578eb40..e9d3e269 100644
--- a/sysdeps/sh/start.S
+++ b/sysdeps/sh/start.S
@@ -57,7 +57,7 @@ 
 					NULL
 */
 
-	.text
+	.section .text.startup
 	.globl _start
 	.type _start,@function
 _start:
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 9b57ae1a..7eb5a78d 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -176,7 +176,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
 	"ld	[" #pic_reg " + " #reg "], " #reg ", %gdop(" #symbol ")"
 
 #define RTLD_START __asm__ ("\
-	.text\n\
+	.section .text.startup\n\
 	.globl	_start\n\
 	.type	_start, @function\n\
 	.align	32\n\
diff --git a/sysdeps/sparc/sparc32/start.S b/sysdeps/sparc/sparc32/start.S
index a82cbf33..f3ac4c8a 100644
--- a/sysdeps/sparc/sparc32/start.S
+++ b/sysdeps/sparc/sparc32/start.S
@@ -36,7 +36,7 @@ 
 #include <sysdep.h>
 
 
-	.section ".text"
+	.section ".text.startup"
 	.align 4
 	.global _start
 	.type _start,#function
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index 2f04ac55..a08cc1f3 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -222,7 +222,7 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
 #define __S(x)	__S1(x)
 
 #define RTLD_START __asm__ ( "\n"					\
-"	.text\n"							\
+"	.section .text.startup\n"					\
 "	.global	_start\n"						\
 "	.type	_start, @function\n"					\
 "	.align	32\n"							\
diff --git a/sysdeps/sparc/sparc64/start.S b/sysdeps/sparc/sparc64/start.S
index 158c4aa0..a69d1e06 100644
--- a/sysdeps/sparc/sparc64/start.S
+++ b/sysdeps/sparc/sparc64/start.S
@@ -36,7 +36,7 @@ 
 #include <sysdep.h>
 
 
-	.section ".text"
+	.section ".text.startup"
 	.align 4
 	.global _start
 	.type _start,#function
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 34eb865e..4f85cae1 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -134,8 +134,8 @@  elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
 #define RTLD_START asm ("\n\
-.text\n\
-	.align 16\n\
+.section .text.startup\n\
+.align 16\n\
 .globl _start\n\
 .globl _dl_start_user\n\
 _start:\n\
diff --git a/sysdeps/x86_64/start.S b/sysdeps/x86_64/start.S
index 4cedc721..4a6676e5 100644
--- a/sysdeps/x86_64/start.S
+++ b/sysdeps/x86_64/start.S
@@ -54,6 +54,7 @@ 
 
 #include <sysdep.h>
 
+	.section .text.startup
 ENTRY (_start)
 	/* Clearing frame pointer is insufficient, use CFI.  */
 	cfi_undefined (rip)
diff --git a/sysdeps/x86_64/x32/dl-machine.h b/sysdeps/x86_64/x32/dl-machine.h
index 648a11f9..6f3164b1 100644
--- a/sysdeps/x86_64/x32/dl-machine.h
+++ b/sysdeps/x86_64/x32/dl-machine.h
@@ -35,7 +35,7 @@ 
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
 #define RTLD_START asm ("\n\
-.text\n\
+.section .text.startup\n\
 	.p2align 4\n\
 .globl _start\n\
 .globl _dl_start_user\n\