* [U-Boot] [PATCH 0/3] MIPS: fix building and linking of standalone programs
@ 2018-09-23 17:15 Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE Daniel Schwierzeck
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-09-23 17:15 UTC (permalink / raw)
To: u-boot
This series fixes the long-time broken support of standalone
programs on MIPS. All MIPS standalone programs now use the
main MIPS linker script and all available code size optimizations.
Finally the deprecated Makefiles arch/mips/cpu/mips[32,64]/config.mk
could be removed.
The series also improves the passing of additional linker flags
to standalone programs by introducing a Makefile variable
LDFLAGS_STANDALONE. Currently the variable CONFIG_STANDALONE_LOAD_ADDR
is misused on some archs to pass the path to the linker script. The
variable LDFLAGS_STANDALONE now provides a cleaner way to do that.
Furthermore it is now possible to migrate CONFIG_STANDALONE_LOAD_ADDR
to Kconfig as a hex symbol.
Sample test session with Malta board in Qemu:
U-Boot 2018.09-00270-g19936da8bc (Sep 23 2018 - 18:43:17 +0200)
Board: MIPS Malta CoreLV
DRAM: 256 MiB
Flash: 4 MiB
*** Warning - bad CRC, using default environment
In: serial at 3f8
Out: serial at 3f8
Err: serial at 3f8
Net: pcnet#0
IDE: Bus 0: not available
malta #
malta #
malta # dhcp 80200000 hello_world.bin
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (3 ms)
Using pcnet#0 device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'hello_world.bin'.
Load address: 0x80200000
Loading: ###
32.2 MiB/s
done
Bytes transferred = 33784 (83f8 hex)
malta # go 80200000
Example expects ABI version 9
Actual U-Boot ABI version 9
Hello World
argc = 1
argv[0] = "80200000"
argv[1] = "<NULL>"
Hit any key to exit ...
malta # go 80200000 666
Example expects ABI version 9
Actual U-Boot ABI version 9
Hello World
argc = 2
argv[0] = "80200000"
argv[1] = "666"
argv[2] = "<NULL>"
Hit any key to exit ...
Daniel Schwierzeck (3):
Kbuild: add LDFLAGS_STANDALONE
Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS
MIPS: fix linking of standalone programs
arch/mips/config.mk | 5 ++++
arch/mips/cpu/mips32/config.mk | 7 ------
arch/mips/cpu/mips64/config.mk | 7 ------
arch/nds32/config.mk | 4 ++--
arch/riscv/config.mk | 4 ++--
arch/sh/config.mk | 2 +-
config.mk | 2 ++
examples/standalone/Makefile | 8 ++++---
examples/standalone/mips.lds | 42 ----------------------------------
examples/standalone/mips64.lds | 42 ----------------------------------
10 files changed, 17 insertions(+), 106 deletions(-)
delete mode 100644 arch/mips/cpu/mips32/config.mk
delete mode 100644 arch/mips/cpu/mips64/config.mk
delete mode 100644 examples/standalone/mips.lds
delete mode 100644 examples/standalone/mips64.lds
--
2.19.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE
2018-09-23 17:15 [U-Boot] [PATCH 0/3] MIPS: fix building and linking of standalone programs Daniel Schwierzeck
@ 2018-09-23 17:15 ` Daniel Schwierzeck
2018-10-28 20:12 ` Daniel Schwierzeck
2018-11-02 22:28 ` Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 3/3] MIPS: fix linking of standalone programs Daniel Schwierzeck
2 siblings, 2 replies; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-09-23 17:15 UTC (permalink / raw)
To: u-boot
Introduce a new Makefile variable for passing LDFLAGS to standalone
programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
misued on some archs to pass a specific linker script.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
arch/mips/cpu/mips32/config.mk | 4 ++--
arch/mips/cpu/mips64/config.mk | 4 ++--
arch/nds32/config.mk | 4 ++--
arch/riscv/config.mk | 4 ++--
arch/sh/config.mk | 2 +-
config.mk | 2 ++
examples/standalone/Makefile | 4 +++-
7 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index a0247596f5..662e4f8fc8 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -3,5 +3,5 @@
# (C) Copyright 2003
# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
-CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \
- -T $(srctree)/examples/standalone/mips.lds
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000
+LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/mips.lds
diff --git a/arch/mips/cpu/mips64/config.mk b/arch/mips/cpu/mips64/config.mk
index cd96bbcce9..6a53976b5c 100644
--- a/arch/mips/cpu/mips64/config.mk
+++ b/arch/mips/cpu/mips64/config.mk
@@ -3,5 +3,5 @@
# (C) Copyright 2003
# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
-CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 \
- -T $(srctree)/examples/standalone/mips64.lds
+CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000
+LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/mips64.lds
diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk
index cb3d8b35b5..0a93fd428d 100644
--- a/arch/nds32/config.mk
+++ b/arch/nds32/config.mk
@@ -12,8 +12,8 @@ ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := nds32le-linux-
endif
-CONFIG_STANDALONE_LOAD_ADDR = 0x300000 \
- -T $(srctree)/examples/standalone/nds32.lds
+CONFIG_STANDALONE_LOAD_ADDR = 0x300000
+LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/nds32.lds
PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax
PLATFORM_RELFLAGS += -gdwarf-2
diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk
index 219e66683d..d0b7e8e88b 100644
--- a/arch/riscv/config.mk
+++ b/arch/riscv/config.mk
@@ -27,8 +27,8 @@ PLATFORM_LDFLAGS += -m $(64bit-emul)
EFI_LDS := elf_riscv64_efi.lds
endif
-CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \
- -T $(srctree)/examples/standalone/riscv.lds
+CONFIG_STANDALONE_LOAD_ADDR = 0x00000000
+LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/riscv.lds
PLATFORM_CPPFLAGS += -ffixed-gp -fpic
PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 -ffunction-sections
diff --git a/arch/sh/config.mk b/arch/sh/config.mk
index 92abee17ad..6ef44638ab 100644
--- a/arch/sh/config.mk
+++ b/arch/sh/config.mk
@@ -9,7 +9,7 @@ endif
CONFIG_STANDALONE_LOAD_ADDR ?= 0x8C000000
ifeq ($(CPU),sh2)
-CONFIG_STANDALONE_LOAD_ADDR += -EB
+LDFLAGS_STANDALONE += -EB
endif
PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
diff --git a/config.mk b/config.mk
index b4e4618982..caf0dd9b81 100644
--- a/config.mk
+++ b/config.mk
@@ -15,6 +15,7 @@ PLATFORM_CPPFLAGS :=
PLATFORM_LDFLAGS :=
LDFLAGS :=
LDFLAGS_FINAL :=
+LDFLAGS_STANDALONE :=
OBJCOPYFLAGS :=
# clear VENDOR for tcsh
VENDOR :=
@@ -75,4 +76,5 @@ LDFLAGS_FINAL += -Bstatic
export PLATFORM_CPPFLAGS
export RELFLAGS
export LDFLAGS_FINAL
+export LDFLAGS_STANDALONE
export CONFIG_STANDALONE_LOAD_ADDR
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 09364d84a0..abe1bf1883 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -45,6 +45,8 @@ endif
# source file.
ccflags-y += $(call cc-option,-fno-toplevel-reorder)
+LDFLAGS_STANDALONE += -Ttext $(CONFIG_STANDALONE_LOAD_ADDR)
+
#########################################################################
quiet_cmd_link_lib = LD $@
@@ -54,7 +56,7 @@ $(LIB): $(LIBOBJS) FORCE
$(call if_changed,link_lib)
quiet_cmd_link_elf = LD $@
- cmd_link_elf = $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
+ cmd_link_elf = $(LD) $(LDFLAGS) $(LDFLAGS_STANDALONE) -g \
-o $@ -e $(SYM_PREFIX)$(@F) $< $(LIB) $(PLATFORM_LIBGCC)
$(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE
--
2.19.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS
2018-09-23 17:15 [U-Boot] [PATCH 0/3] MIPS: fix building and linking of standalone programs Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE Daniel Schwierzeck
@ 2018-09-23 17:15 ` Daniel Schwierzeck
2018-10-28 20:13 ` Daniel Schwierzeck
2018-11-02 22:29 ` Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 3/3] MIPS: fix linking of standalone programs Daniel Schwierzeck
2 siblings, 2 replies; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-09-23 17:15 UTC (permalink / raw)
To: u-boot
Currently the OBJCOPYFLAGS are cleared when assigning "-O srec"
or "-O binary" for standalone programs. All flags set by arch-specific
Makefiles are lost. This is bad if an arch demands arch-specific
flags for the objcopy step.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
examples/standalone/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index abe1bf1883..f01816f24f 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -62,11 +62,11 @@ quiet_cmd_link_elf = LD $@
$(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE
$(call if_changed,link_elf)
-$(obj)/%.srec: OBJCOPYFLAGS := -O srec
+$(obj)/%.srec: OBJCOPYFLAGS += -O srec
$(obj)/%.srec: $(obj)/% FORCE
$(call if_changed,objcopy)
-$(obj)/%.bin: OBJCOPYFLAGS := -O binary
+$(obj)/%.bin: OBJCOPYFLAGS += -O binary
$(obj)/%.bin: $(obj)/% FORCE
$(call if_changed,objcopy)
--
2.19.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 3/3] MIPS: fix linking of standalone programs
2018-09-23 17:15 [U-Boot] [PATCH 0/3] MIPS: fix building and linking of standalone programs Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS Daniel Schwierzeck
@ 2018-09-23 17:15 ` Daniel Schwierzeck
2018-11-02 22:30 ` Daniel Schwierzeck
2 siblings, 1 reply; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-09-23 17:15 UTC (permalink / raw)
To: u-boot
Use the global MIPS specific u-boot.lds for linking standalone programs
instead of the outdated ones in examples/standalone/. Also pass --gc-sections
in LDFLAGS_STANDALONE to optimize the size of standalone programs.
Finally remove the deprecated config.mk files in arch/mips/cpu/mips[32,64]/.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
arch/mips/config.mk | 5 ++++
arch/mips/cpu/mips32/config.mk | 7 ------
arch/mips/cpu/mips64/config.mk | 7 ------
examples/standalone/mips.lds | 42 ----------------------------------
examples/standalone/mips64.lds | 42 ----------------------------------
5 files changed, 5 insertions(+), 98 deletions(-)
delete mode 100644 arch/mips/cpu/mips32/config.mk
delete mode 100644 arch/mips/cpu/mips64/config.mk
delete mode 100644 examples/standalone/mips.lds
delete mode 100644 examples/standalone/mips64.lds
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 8aa45fc45c..1ae8bf7b71 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -25,12 +25,14 @@ ifdef CONFIG_32BIT
PLATFORM_CPPFLAGS += -mabi=32
PLATFORM_LDFLAGS += -m $(32bit-emul)
OBJCOPYFLAGS += -O $(32bit-bfd)
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000
endif
ifdef CONFIG_64BIT
PLATFORM_CPPFLAGS += -mabi=64
PLATFORM_LDFLAGS += -m$(64bit-emul)
OBJCOPYFLAGS += -O $(64bit-bfd)
+CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000
endif
PLATFORM_CPPFLAGS += -D__MIPS__
@@ -65,3 +67,6 @@ PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
LDFLAGS_FINAL += --gc-sections
OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list
+
+LDFLAGS_STANDALONE += -T $(srctree)/arch/mips/cpu/u-boot.lds
+LDFLAGS_STANDALONE += --gc-sections
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
deleted file mode 100644
index 662e4f8fc8..0000000000
--- a/arch/mips/cpu/mips32/config.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2003
-# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
-
-CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000
-LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/mips.lds
diff --git a/arch/mips/cpu/mips64/config.mk b/arch/mips/cpu/mips64/config.mk
deleted file mode 100644
index 6a53976b5c..0000000000
--- a/arch/mips/cpu/mips64/config.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# (C) Copyright 2003
-# Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
-
-CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000
-LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/mips64.lds
diff --git a/examples/standalone/mips.lds b/examples/standalone/mips.lds
deleted file mode 100644
index 163d6efefd..0000000000
--- a/examples/standalone/mips.lds
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2003
- * Wolfgang Denk Engineering, <wd@denx.de>
- */
-
-/*
-OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
-*/
-OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")
-OUTPUT_ARCH(mips)
-SECTIONS
-{
- .text :
- {
- *(.text*)
- }
-
- . = ALIGN(4);
- .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
-
- . = ALIGN(4);
- .data : { *(.data*) }
-
- . = .;
- _gp = ALIGN(16) + 0x7ff0;
-
- .got : {
- __got_start = .;
- *(.got)
- __got_end = .;
- }
-
- .sdata : { *(.sdata*) }
-
- . = ALIGN(4);
- __bss_start = .;
- .sbss (NOLOAD) : { *(.sbss*) }
- .bss (NOLOAD) : { *(.bss*) . = ALIGN(4); }
-
- _end = .;
-}
diff --git a/examples/standalone/mips64.lds b/examples/standalone/mips64.lds
deleted file mode 100644
index d67396ab71..0000000000
--- a/examples/standalone/mips64.lds
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2003
- * Wolfgang Denk Engineering, <wd@denx.de>
- */
-
-/*
-OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
-*/
-OUTPUT_FORMAT("elf64-tradbigmips", "elf64-tradbigmips", "elf64-tradlittlemips")
-OUTPUT_ARCH(mips)
-SECTIONS
-{
- .text :
- {
- *(.text*)
- }
-
- . = ALIGN(4);
- .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
-
- . = ALIGN(4);
- .data : { *(.data*) }
-
- . = .;
- _gp = ALIGN(16) + 0x7ff0;
-
- .got : {
- __got_start = .;
- *(.got)
- __got_end = .;
- }
-
- .sdata : { *(.sdata*) }
-
- . = ALIGN(4);
- __bss_start = .;
- .sbss (NOLOAD) : { *(.sbss*) }
- .bss (NOLOAD) : { *(.bss*) . = ALIGN(4); }
-
- _end = .;
-}
--
2.19.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE
2018-09-23 17:15 ` [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE Daniel Schwierzeck
@ 2018-10-28 20:12 ` Daniel Schwierzeck
2018-10-29 13:34 ` Tom Rini
2018-11-02 22:28 ` Daniel Schwierzeck
1 sibling, 1 reply; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-10-28 20:12 UTC (permalink / raw)
To: u-boot
Am 23.09.18 um 19:15 schrieb Daniel Schwierzeck:
> Introduce a new Makefile variable for passing LDFLAGS to standalone
> programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
> misued on some archs to pass a specific linker script.
are there any objections or can I apply this to u-boot-mips/next? Thanks.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
>
> arch/mips/cpu/mips32/config.mk | 4 ++--
> arch/mips/cpu/mips64/config.mk | 4 ++--
> arch/nds32/config.mk | 4 ++--
> arch/riscv/config.mk | 4 ++--
> arch/sh/config.mk | 2 +-
> config.mk | 2 ++
> examples/standalone/Makefile | 4 +++-
> 7 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
> index a0247596f5..662e4f8fc8 100644
> --- a/arch/mips/cpu/mips32/config.mk
> +++ b/arch/mips/cpu/mips32/config.mk
> @@ -3,5 +3,5 @@
> # (C) Copyright 2003
> # Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
>
> -CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \
> - -T $(srctree)/examples/standalone/mips.lds
> +CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000
> +LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/mips.lds
> diff --git a/arch/mips/cpu/mips64/config.mk b/arch/mips/cpu/mips64/config.mk
> index cd96bbcce9..6a53976b5c 100644
> --- a/arch/mips/cpu/mips64/config.mk
> +++ b/arch/mips/cpu/mips64/config.mk
> @@ -3,5 +3,5 @@
> # (C) Copyright 2003
> # Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
>
> -CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 \
> - -T $(srctree)/examples/standalone/mips64.lds
> +CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000
> +LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/mips64.lds
> diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk
> index cb3d8b35b5..0a93fd428d 100644
> --- a/arch/nds32/config.mk
> +++ b/arch/nds32/config.mk
> @@ -12,8 +12,8 @@ ifeq ($(CROSS_COMPILE),)
> CROSS_COMPILE := nds32le-linux-
> endif
>
> -CONFIG_STANDALONE_LOAD_ADDR = 0x300000 \
> - -T $(srctree)/examples/standalone/nds32.lds
> +CONFIG_STANDALONE_LOAD_ADDR = 0x300000
> +LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/nds32.lds
>
> PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax
> PLATFORM_RELFLAGS += -gdwarf-2
> diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk
> index 219e66683d..d0b7e8e88b 100644
> --- a/arch/riscv/config.mk
> +++ b/arch/riscv/config.mk
> @@ -27,8 +27,8 @@ PLATFORM_LDFLAGS += -m $(64bit-emul)
> EFI_LDS := elf_riscv64_efi.lds
> endif
>
> -CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \
> - -T $(srctree)/examples/standalone/riscv.lds
> +CONFIG_STANDALONE_LOAD_ADDR = 0x00000000
> +LDFLAGS_STANDALONE += -T $(srctree)/examples/standalone/riscv.lds
>
> PLATFORM_CPPFLAGS += -ffixed-gp -fpic
> PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 -ffunction-sections
> diff --git a/arch/sh/config.mk b/arch/sh/config.mk
> index 92abee17ad..6ef44638ab 100644
> --- a/arch/sh/config.mk
> +++ b/arch/sh/config.mk
> @@ -9,7 +9,7 @@ endif
>
> CONFIG_STANDALONE_LOAD_ADDR ?= 0x8C000000
> ifeq ($(CPU),sh2)
> -CONFIG_STANDALONE_LOAD_ADDR += -EB
> +LDFLAGS_STANDALONE += -EB
> endif
>
> PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
> diff --git a/config.mk b/config.mk
> index b4e4618982..caf0dd9b81 100644
> --- a/config.mk
> +++ b/config.mk
> @@ -15,6 +15,7 @@ PLATFORM_CPPFLAGS :=
> PLATFORM_LDFLAGS :=
> LDFLAGS :=
> LDFLAGS_FINAL :=
> +LDFLAGS_STANDALONE :=
> OBJCOPYFLAGS :=
> # clear VENDOR for tcsh
> VENDOR :=
> @@ -75,4 +76,5 @@ LDFLAGS_FINAL += -Bstatic
> export PLATFORM_CPPFLAGS
> export RELFLAGS
> export LDFLAGS_FINAL
> +export LDFLAGS_STANDALONE
> export CONFIG_STANDALONE_LOAD_ADDR
> diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
> index 09364d84a0..abe1bf1883 100644
> --- a/examples/standalone/Makefile
> +++ b/examples/standalone/Makefile
> @@ -45,6 +45,8 @@ endif
> # source file.
> ccflags-y += $(call cc-option,-fno-toplevel-reorder)
>
> +LDFLAGS_STANDALONE += -Ttext $(CONFIG_STANDALONE_LOAD_ADDR)
> +
> #########################################################################
>
> quiet_cmd_link_lib = LD $@
> @@ -54,7 +56,7 @@ $(LIB): $(LIBOBJS) FORCE
> $(call if_changed,link_lib)
>
> quiet_cmd_link_elf = LD $@
> - cmd_link_elf = $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
> + cmd_link_elf = $(LD) $(LDFLAGS) $(LDFLAGS_STANDALONE) -g \
> -o $@ -e $(SYM_PREFIX)$(@F) $< $(LIB) $(PLATFORM_LIBGCC)
>
> $(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE
>
--
- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181028/2593aef8/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS
2018-09-23 17:15 ` [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS Daniel Schwierzeck
@ 2018-10-28 20:13 ` Daniel Schwierzeck
2018-10-29 13:34 ` Tom Rini
2018-11-02 22:29 ` Daniel Schwierzeck
1 sibling, 1 reply; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-10-28 20:13 UTC (permalink / raw)
To: u-boot
Am 23.09.18 um 19:15 schrieb Daniel Schwierzeck:
> Currently the OBJCOPYFLAGS are cleared when assigning "-O srec"
> or "-O binary" for standalone programs. All flags set by arch-specific
> Makefiles are lost. This is bad if an arch demands arch-specific
> flags for the objcopy step.
are there any objections or can I apply this to u-boot-mips/next? Thanks.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
>
> examples/standalone/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
> index abe1bf1883..f01816f24f 100644
> --- a/examples/standalone/Makefile
> +++ b/examples/standalone/Makefile
> @@ -62,11 +62,11 @@ quiet_cmd_link_elf = LD $@
> $(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE
> $(call if_changed,link_elf)
>
> -$(obj)/%.srec: OBJCOPYFLAGS := -O srec
> +$(obj)/%.srec: OBJCOPYFLAGS += -O srec
> $(obj)/%.srec: $(obj)/% FORCE
> $(call if_changed,objcopy)
>
> -$(obj)/%.bin: OBJCOPYFLAGS := -O binary
> +$(obj)/%.bin: OBJCOPYFLAGS += -O binary
> $(obj)/%.bin: $(obj)/% FORCE
> $(call if_changed,objcopy)
>
>
--
- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181028/23e6b6b6/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE
2018-10-28 20:12 ` Daniel Schwierzeck
@ 2018-10-29 13:34 ` Tom Rini
[not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA3A3B5EC@ATCPCS16.andestech.com>
0 siblings, 1 reply; 12+ messages in thread
From: Tom Rini @ 2018-10-29 13:34 UTC (permalink / raw)
To: u-boot
On Sun, Oct 28, 2018 at 09:12:22PM +0100, Daniel Schwierzeck wrote:
>
>
> Am 23.09.18 um 19:15 schrieb Daniel Schwierzeck:
> > Introduce a new Makefile variable for passing LDFLAGS to standalone
> > programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
> > misued on some archs to pass a specific linker script.
>
> are there any objections or can I apply this to u-boot-mips/next? Thanks.
Go ahead:
Reviewed-by: Tom Rini <trini@konsulko.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181029/97e673f1/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS
2018-10-28 20:13 ` Daniel Schwierzeck
@ 2018-10-29 13:34 ` Tom Rini
0 siblings, 0 replies; 12+ messages in thread
From: Tom Rini @ 2018-10-29 13:34 UTC (permalink / raw)
To: u-boot
On Sun, Oct 28, 2018 at 09:13:04PM +0100, Daniel Schwierzeck wrote:
>
>
> Am 23.09.18 um 19:15 schrieb Daniel Schwierzeck:
> > Currently the OBJCOPYFLAGS are cleared when assigning "-O srec"
> > or "-O binary" for standalone programs. All flags set by arch-specific
> > Makefiles are lost. This is bad if an arch demands arch-specific
> > flags for the objcopy step.
>
> are there any objections or can I apply this to u-boot-mips/next? Thanks.
Go ahead:
Reviewed-by: Tom Rini <trini@konsulko.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181029/0f23b56b/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE
[not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA3A3B5EC@ATCPCS16.andestech.com>
@ 2018-10-30 1:40 ` Rick Chen
0 siblings, 0 replies; 12+ messages in thread
From: Rick Chen @ 2018-10-30 1:40 UTC (permalink / raw)
To: u-boot
> > > > Introduce a new Makefile variable for passing LDFLAGS to standalone
> > > > programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
> > > > misued on some archs to pass a specific linker script.
> > >
> > > are there any objections or can I apply this to u-boot-mips/next? Thanks.
> >
> > Go ahead:
> >
> > Reviewed-by: Tom Rini <trini@konsulko.com>
> >
Reviewed-by: Rick Chen <rick@andestech.com>
> > --
> > Tom
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE
2018-09-23 17:15 ` [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE Daniel Schwierzeck
2018-10-28 20:12 ` Daniel Schwierzeck
@ 2018-11-02 22:28 ` Daniel Schwierzeck
1 sibling, 0 replies; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-11-02 22:28 UTC (permalink / raw)
To: u-boot
Am 23.09.18 um 19:15 schrieb Daniel Schwierzeck:
> Introduce a new Makefile variable for passing LDFLAGS to standalone
> programs. Currently the variable CONFIG_STANDALONE_LOAD_ADDR is
> misued on some archs to pass a specific linker script.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
>
> arch/mips/cpu/mips32/config.mk | 4 ++--
> arch/mips/cpu/mips64/config.mk | 4 ++--
> arch/nds32/config.mk | 4 ++--
> arch/riscv/config.mk | 4 ++--
> arch/sh/config.mk | 2 +-
> config.mk | 2 ++
> examples/standalone/Makefile | 4 +++-
> 7 files changed, 14 insertions(+), 10 deletions(-)
>
applied to u-boot-mips/next
--
- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181102/feb424bc/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS
2018-09-23 17:15 ` [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS Daniel Schwierzeck
2018-10-28 20:13 ` Daniel Schwierzeck
@ 2018-11-02 22:29 ` Daniel Schwierzeck
1 sibling, 0 replies; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-11-02 22:29 UTC (permalink / raw)
To: u-boot
Am 23.09.18 um 19:15 schrieb Daniel Schwierzeck:
> Currently the OBJCOPYFLAGS are cleared when assigning "-O srec"
> or "-O binary" for standalone programs. All flags set by arch-specific
> Makefiles are lost. This is bad if an arch demands arch-specific
> flags for the objcopy step.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
>
> examples/standalone/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
applied to u-boot-mips/next
--
- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181102/06337b75/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 3/3] MIPS: fix linking of standalone programs
2018-09-23 17:15 ` [U-Boot] [PATCH 3/3] MIPS: fix linking of standalone programs Daniel Schwierzeck
@ 2018-11-02 22:30 ` Daniel Schwierzeck
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Schwierzeck @ 2018-11-02 22:30 UTC (permalink / raw)
To: u-boot
Am 23.09.18 um 19:15 schrieb Daniel Schwierzeck:
> Use the global MIPS specific u-boot.lds for linking standalone programs
> instead of the outdated ones in examples/standalone/. Also pass --gc-sections
> in LDFLAGS_STANDALONE to optimize the size of standalone programs.
> Finally remove the deprecated config.mk files in arch/mips/cpu/mips[32,64]/.
>
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
>
> ---
>
> arch/mips/config.mk | 5 ++++
> arch/mips/cpu/mips32/config.mk | 7 ------
> arch/mips/cpu/mips64/config.mk | 7 ------
> examples/standalone/mips.lds | 42 ----------------------------------
> examples/standalone/mips64.lds | 42 ----------------------------------
> 5 files changed, 5 insertions(+), 98 deletions(-)
> delete mode 100644 arch/mips/cpu/mips32/config.mk
> delete mode 100644 arch/mips/cpu/mips64/config.mk
> delete mode 100644 examples/standalone/mips.lds
> delete mode 100644 examples/standalone/mips64.lds
>
applied to u-boot-mips/next
--
- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181102/81e70a45/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-11-02 22:30 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-23 17:15 [U-Boot] [PATCH 0/3] MIPS: fix building and linking of standalone programs Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 1/3] Kbuild: add LDFLAGS_STANDALONE Daniel Schwierzeck
2018-10-28 20:12 ` Daniel Schwierzeck
2018-10-29 13:34 ` Tom Rini
[not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA3A3B5EC@ATCPCS16.andestech.com>
2018-10-30 1:40 ` Rick Chen
2018-11-02 22:28 ` Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 2/3] Kbuild: standalone: do not ignore platform-specific OBJCOPYFLAGS Daniel Schwierzeck
2018-10-28 20:13 ` Daniel Schwierzeck
2018-10-29 13:34 ` Tom Rini
2018-11-02 22:29 ` Daniel Schwierzeck
2018-09-23 17:15 ` [U-Boot] [PATCH 3/3] MIPS: fix linking of standalone programs Daniel Schwierzeck
2018-11-02 22:30 ` Daniel Schwierzeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox