1From beb526ca925983c7da229043790ecd552d910650 Mon Sep 17 00:00:00 2001
2From: Christian Stewart <christian@paral.in>
3Date: Thu, 4 Apr 2019 23:24:31 -0700
4Subject: [PATCH] Fix build with binutils note gnu property section
5
6This fixes the following build error with newer binutils:
7
8  objcopy -O binary mbr.elf mbr.bin
9  perl /build/syslinux/src/syslinux/mbr/checksize.pl mbr.bin
10  mbr.bin: too big (452 > 440)
11
12Corresponding bug reports:
13
14 - https://bugs.archlinux.org/task/60405
15 - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
16
17Strips the .note.gnu.property in the linker scripts for the MBRs.
18
19Signed-off-by: Christian Stewart <christian@paral.in>
20---
21 mbr/i386/mbr.ld   | 1 +
22 mbr/x86_64/mbr.ld | 1 +
23 2 files changed, 2 insertions(+)
24
25diff --git a/mbr/i386/mbr.ld b/mbr/i386/mbr.ld
26index d14ba802..53683461 100644
27--- a/mbr/i386/mbr.ld
28+++ b/mbr/i386/mbr.ld
29@@ -70,4 +70,5 @@ SECTIONS
30   .debug_typenames 0 : { *(.debug_typenames) }
31   .debug_varnames  0 : { *(.debug_varnames) }
32   /DISCARD/ : { *(.note.GNU-stack) }
33+  /DISCARD/ : { *(.note.gnu.property) }
34 }
35diff --git a/mbr/x86_64/mbr.ld b/mbr/x86_64/mbr.ld
36index ae27d49a..b8c0d895 100644
37--- a/mbr/x86_64/mbr.ld
38+++ b/mbr/x86_64/mbr.ld
39@@ -69,4 +69,5 @@ SECTIONS
40   .debug_typenames 0 : { *(.debug_typenames) }
41   .debug_varnames  0 : { *(.debug_varnames) }
42   /DISCARD/ : { *(.note.GNU-stack) }
43+  /DISCARD/ : { *(.note.gnu.property) }
44 }
45--
462.21.0
47
48