summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/Makefile
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-06-02 10:53:51 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-06-03 10:03:33 +0200
commit54d47eb7e91274bb3edd8ac4b2e87db6d6f95c43 (patch)
treea45df645dca8a21b46a4653fd7d57afb55ad5fc8 /arch/sandbox/Makefile
parent5e4dfd408a55d38e59a6a3fd3cf43192a24ded24 (diff)
downloadbarebox-54d47eb7e91274bb3edd8ac4b2e87db6d6f95c43.tar.gz
barebox-54d47eb7e91274bb3edd8ac4b2e87db6d6f95c43.tar.xz
sandbox: support forcing 32-bit x86
If gcc supports multiple architectures, barebox uses only the default when compiling for ARCH=sandbox, this is e.g. the case with compilers that generate both 32- and 64-bit x86 executables. There can be good reasons to force 32-bit though, e.g. to reduce memory consumption while fuzzing or to temporarily avoid 32-to-64-bit warnings, while running the static analyzer. Add an option for this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/Makefile')
-rw-r--r--arch/sandbox/Makefile12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index 3917cade94..c08ea0cf83 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -52,11 +52,21 @@ ifeq ($(CONFIG_UBSAN),y)
SANITIZER_LIBS += -fsanitize=undefined
endif
-cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(BAREBOX_LDS) \
+ifeq ($(CONFIG_SANDBOX_LINUX_I386),y)
+KBUILD_CFLAGS += -m32
+KBUILD_LDFLAGS += -m elf_i386
+KBUILD_AFLAGS += -m32
+BAREBOX_LDFLAGS += -m32
+endif
+
+BAREBOX_LDFLAGS += \
+ -Wl,-T,$(BAREBOX_LDS) \
-Wl,--whole-archive $(BAREBOX_OBJS) -Wl,--no-whole-archive \
-lrt -lpthread $(SDL_LIBS) $(FTDI1_LIBS) \
$(SANITIZER_LIBS)
+cmd_barebox__ = $(CC) -o $@ $(BAREBOX_LDFLAGS)
+
common-y += $(BOARD) arch/sandbox/os/ arch/sandbox/lib/
common-$(CONFIG_OFTREE) += arch/sandbox/dts/