diff mbox

[uclibc-ng-devel] ARC: Implement .note.ABI-tag section in crt1.S

Message ID 1466617709-12330-1-git-send-email-Anton.Kolesov@synopsys.com
State Accepted
Headers show

Commit Message

Anton Kolesov June 22, 2016, 5:48 p.m. UTC
Linux Standard Base specifies section .note.ABI-tag that can be considered
as a marker for ELF files targeted to Linux systems. See
https://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB/noteabitag.html

This section, for example, is used by the GDB to identify Linux ELFs as
compared to baremetal ELFs that do not have this section.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
---
 libc/sysdeps/linux/arc/crt1.S | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Waldemar Brodkorb June 26, 2016, 9:55 a.m. UTC | #1
Hi Anton,
Anton Kolesov wrote,

> Linux Standard Base specifies section .note.ABI-tag that can be considered
> as a marker for ELF files targeted to Linux systems. See
> https://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB/noteabitag.html
> 
> This section, for example, is used by the GDB to identify Linux ELFs as
> compared to baremetal ELFs that do not have this section.
> 
> Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
> Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
> ---
>  libc/sysdeps/linux/arc/crt1.S | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)

Applied and pushed,
 thx
  Waldemar
diff mbox

Patch

diff --git a/libc/sysdeps/linux/arc/crt1.S b/libc/sysdeps/linux/arc/crt1.S
index 95c41f8..0fe3cf9 100644
--- a/libc/sysdeps/linux/arc/crt1.S
+++ b/libc/sysdeps/linux/arc/crt1.S
@@ -55,3 +55,18 @@  __start:
 	/* Should never get here....  */
 	flag    1
 .size __start,.-__start
+
+/* Implement a .note.ABI-tag section that is mandatory for Linux executables
+   according to LSB. See:
+   https://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB/noteabitag.html.
+   Also: libc/sysdeps/linux/avr32/crt1.S. */
+.section ".note.ABI-tag", "a"
+	.align 4
+	.long 1f - 0f		/* Name length */
+	.long 3f - 2f		/* Data length */
+	.long 1			/* Note type */
+0:	.asciz "GNU"		/* Vendor name */
+1:	.align 4
+2:	.long 0			/* Note data: Linux executable */
+	.long 3,9,0		/* Earliest compatible kernel */
+3:	.align 4		/* Pad out section */