[openwrt/openwrt] at91bootstrap: Fix compile with binutils 2.36

LEDE Commits lede-commits at lists.infradead.org
Fri Aug 20 15:11:22 PDT 2021


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/fcfeb47eb02faeca865ee8676776aa97e123fbda

commit fcfeb47eb02faeca865ee8676776aa97e123fbda
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Sat Aug 21 00:08:42 2021 +0200

    at91bootstrap: Fix compile with binutils 2.36
    
    This fixes a build problem seen after binutils 2.36 is used by default.
    
    Fixes: 3f41153b1c28 ("toolchain/binutils: switch to version 2.36.1 by default")
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 ...Makefile-Remove-nostartfiles-from-LDFLAGS.patch | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/package/boot/at91bootstrap/patches/001-Makefile-Remove-nostartfiles-from-LDFLAGS.patch b/package/boot/at91bootstrap/patches/001-Makefile-Remove-nostartfiles-from-LDFLAGS.patch
new file mode 100644
index 0000000000..9d48758bda
--- /dev/null
+++ b/package/boot/at91bootstrap/patches/001-Makefile-Remove-nostartfiles-from-LDFLAGS.patch
@@ -0,0 +1,38 @@
+From 59c8963d8e6a08222616d1b384e1009ba05e6b82 Mon Sep 17 00:00:00 2001
+From: Chris Elledge <celledge at digitallumensinc.com>
+Date: Tue, 8 Jun 2021 14:01:14 -0400
+Subject: Makefile: Remove -nostartfiles from LDFLAGS
+
+Binutils linker ld does not support the flag -nostartfiles.
+This is interpreted as "-n -o startfiles" which fortunately has no impact
+on the build process. Removing -nostartfiles has no impact on the build.
+
+Binutils 2.36 and later ld has improved flag parsing and throws an error if
+-nostartfiles is passed as an argument. Removing the flag fixes the problem.
+
+Details on the Binutils ML:
+https://sourceware.org/pipermail/binutils/2021-June/116826.html
+
+In our ld command line there are explicit
+-n -o $(BINDIR)/$(BOOT_NAME).elf options,
+hence removing -nostartfiles will not alter the build.
+
+Signed-off-by: Chris Elledge <celledge at digitallumensinc.com>
+Reviewed-by: Aubin Constans <aubin.constans at microchip.com>
+[eugen.hristev at microchip.com: ported to at91bootstrap4]
+Signed-off-by: Eugen Hristev <eugen.hristev at microchip.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -275,7 +275,7 @@ endif
+ #    --cref:    add cross reference to map file
+ #  -lc 	   : 	tells the linker to tie in newlib
+ #  -lgcc   : 	tells the linker to tie in newlib
+-LDFLAGS=-nostartfiles -Map=$(BINDIR)/$(BOOT_NAME).map --cref -static
++LDFLAGS=-Map=$(BINDIR)/$(BOOT_NAME).map --cref -static
+ LDFLAGS+=-T $(link_script) $(GC_SECTIONS) -Ttext $(LINK_ADDR)
+ 
+ ifneq ($(DATA_SECTION_ADDR),)



More information about the lede-commits mailing list