laforge has uploaded this change for review.
firmware: -nostartfiles -nodefaultlibs are not flags of LD but flags of GCC
It seems that those flags have always been gcc flags, and not ld flags.
After decades of tolerating this, binutils 2.36.x no longer tolerates
those flags but prints an error:
arm-none-eabi-ld: Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?)
See also https://github.com/apache/nuttx/issues/3826 and the related
https://github.com/apache/nuttx/pull/3836 how this was solved in another
project - I adopted that solution here 1:1
Change-Id: Id199e4d03d5aae07a347c98f47791f42c12008c6
---
M src/target/firmware/Makefile.inc
1 file changed, 24 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/89/35089/1
diff --git a/src/target/firmware/Makefile.inc b/src/target/firmware/Makefile.inc
index 2be240d..86e8f3c 100644
--- a/src/target/firmware/Makefile.inc
+++ b/src/target/firmware/Makefile.inc
@@ -4,7 +4,7 @@
CROSS_COMPILE?=arm-none-eabi-
CC=gcc
-LD=ld
+LD=gcc
AR=ar
SIZE=size
OBJCOPY=objcopy
@@ -22,7 +22,7 @@
#ASFLAGS=--g$(DEBUGF) $(INCLUDES) -D__ASSEMBLY__
ASFLAGS=$(INCLUDES) -D__ASSEMBLY__
-LDFLAGS = -nostartfiles -nostdlib -nodefaultlibs --gc-sections --cref
+LDFLAGS = -nostartfiles -nostdlib -nodefaultlibs -Wl,--gc-sections -Wl,--cref
#### QUIET OUTPUT ####
@@ -99,8 +99,8 @@
# define compilation rule, also generates map file
board/$(2)/$(1).$(3).elf board/$(2)/$(1).$(3).map: $$($(1)_$(2)_$(3)_OBJS) $$($(1)_$(2)_$(3)_LIBS) $$(ENV_$(3)_LDS)
$$(Q_LD)$(CROSS_COMPILE)$(LD) $(LDFLAGS) -T $$(ENV_$(3)_LDS) -Bstatic \
- -Map board/$(2)/$(1).$(3).map -o board/$(2)/$(1).$(3).elf \
- --start-group $$($(1)_$(2)_$(3)_OBJS) $$($(1)_$(2)_$(3)_LIBS) --end-group
+ -Wl,-Map board/$(2)/$(1).$(3).map -o board/$(2)/$(1).$(3).elf \
+ -Wl,--start-group $$($(1)_$(2)_$(3)_OBJS) $$($(1)_$(2)_$(3)_LIBS) -Wl,--end-group
# define size rule
board/$(2)/$(1).$(3).size: board/$(2)/$(1).$(3).elf
To view, visit change 35089. To unsubscribe, or for help writing mail filters, visit settings.