mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-26 07:17:10 +00:00
sandbox: eliminate unused functions from binaries
The sandbox should closely mimic other architectures. Place each function or data in a separate section and let the linker eliminate unused ones. This will reduce the binary size. In the linker script mark that u_boot_sandbox_getopt are to be kept. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
a4ed4c8a51
commit
be6a249b41
2 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
||||||
# Copyright (c) 2011 The Chromium OS Authors.
|
# Copyright (c) 2011 The Chromium OS Authors.
|
||||||
|
|
||||||
PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE
|
PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE
|
||||||
PLATFORM_CPPFLAGS += -fPIC
|
PLATFORM_CPPFLAGS += -fPIC -ffunction-sections -fdata-sections
|
||||||
PLATFORM_LIBS += -lrt
|
PLATFORM_LIBS += -lrt
|
||||||
SDL_CONFIG ?= sdl2-config
|
SDL_CONFIG ?= sdl2-config
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ cmd_u-boot__ = $(CC) -o $@ -Wl,-T u-boot.lds $(u-boot-init) \
|
||||||
$(u-boot-main) \
|
$(u-boot-main) \
|
||||||
$(u-boot-keep-syms-lto) \
|
$(u-boot-keep-syms-lto) \
|
||||||
-Wl,--no-whole-archive \
|
-Wl,--no-whole-archive \
|
||||||
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map
|
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -Wl,--gc-sections
|
||||||
|
|
||||||
cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \
|
cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \
|
||||||
$(KBUILD_LDFLAGS:%=-Wl,%) \
|
$(KBUILD_LDFLAGS:%=-Wl,%) \
|
||||||
|
|
|
@ -15,7 +15,7 @@ SECTIONS
|
||||||
|
|
||||||
_u_boot_sandbox_getopt : {
|
_u_boot_sandbox_getopt : {
|
||||||
*(_u_boot_sandbox_getopt_start)
|
*(_u_boot_sandbox_getopt_start)
|
||||||
*(_u_boot_sandbox_getopt)
|
KEEP(*(_u_boot_sandbox_getopt))
|
||||||
*(_u_boot_sandbox_getopt_end)
|
*(_u_boot_sandbox_getopt_end)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue