git: 6700e2d963ff - main - csu: add the "Retain" flag to notes sections flag

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 24 Jan 2025 13:36:53 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=6700e2d963ff0475cc5cd444e92ce40855643084

commit 6700e2d963ff0475cc5cd444e92ce40855643084
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-01-24 11:32:53 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-01-24 13:36:41 +0000

    csu: add the "Retain" flag to notes sections flag
    
    It should make the notes immune against --gc-sections.
    
    Reported and tested by: bapt
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 lib/csu/common/crtbrand.S         | 2 +-
 lib/csu/common/feature_note.S     | 2 +-
 lib/csu/common/ignore_init_note.S | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/csu/common/crtbrand.S b/lib/csu/common/crtbrand.S
index b59e2fd8056b..a06f72daa99d 100644
--- a/lib/csu/common/crtbrand.S
+++ b/lib/csu/common/crtbrand.S
@@ -36,7 +36,7 @@
  * for more information.
  */
 
-	.section .note.tag,"aG",%note,.freebsd.noteG,comdat
+	.section .note.tag,"aGR",%note,.freebsd.noteG,comdat
 	.p2align	2
 	.4byte		2f-1f
 	.4byte		4f-3f
diff --git a/lib/csu/common/feature_note.S b/lib/csu/common/feature_note.S
index 5c1d56d4cde1..fb9f6141699e 100644
--- a/lib/csu/common/feature_note.S
+++ b/lib/csu/common/feature_note.S
@@ -29,7 +29,7 @@
 #include <sys/elf_common.h>
 #include "notes.h"
 
-	.section .note.tag,"a",%note
+	.section .note.tag,"aR",%note
 	.p2align	2
 	.4byte		2f-1f
 	.4byte		4f-3f
diff --git a/lib/csu/common/ignore_init_note.S b/lib/csu/common/ignore_init_note.S
index 57fb4e8f4d51..d78be61f17a9 100644
--- a/lib/csu/common/ignore_init_note.S
+++ b/lib/csu/common/ignore_init_note.S
@@ -30,7 +30,7 @@
 
 #include "notes.h"
 
-	.section .note.tag,"a",%note
+	.section .note.tag,"aR",%note
 	.p2align	2
 	.4byte		2f-1f
 	.4byte		4f-3f