Andrew Geissler | 9347dd4 | 2023-03-03 12:38:41 -0600 | [diff] [blame] | 1 | From f4d5cf4c3424598a2b3bb391717313b70c79ea28 Mon Sep 17 00:00:00 2001 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 2 | From: Jaxson Han <jaxson.han@arm.com> |
| 3 | Date: Tue, 28 Dec 2021 17:42:48 +0800 |
| 4 | Subject: [PATCH] Makefile: Add the libfdt to the Makefile system |
| 5 | |
| 6 | Add the libfdt into Makefile system. The libfdt uses const value and |
| 7 | thus gcc will enable the stack guard. The stack guard will fail the |
| 8 | compile. Add -fno-stack-protector to fix it. |
| 9 | |
| 10 | Issue-Id: SCM-3814 |
| 11 | Upstream-Status: Inappropriate [other] |
| 12 | Implementation pending further discussion |
| 13 | Signed-off-by: Jaxson Han <jaxson.han@arm.com> |
| 14 | Change-Id: I472bc28cdc5cde3b22461a4b7d7a3752ae382b4b |
| 15 | --- |
| 16 | Makefile.am | 11 +++++++++-- |
| 17 | 1 file changed, 9 insertions(+), 2 deletions(-) |
| 18 | |
| 19 | diff --git a/Makefile.am b/Makefile.am |
Andrew Geissler | 9347dd4 | 2023-03-03 12:38:41 -0600 | [diff] [blame] | 20 | index fc66662..ab2c3a9 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 21 | --- a/Makefile.am |
| 22 | +++ b/Makefile.am |
| 23 | @@ -36,6 +36,9 @@ PSCI_CPU_OFF := 0x84000002 |
| 24 | COMMON_SRC := common/ |
| 25 | COMMON_OBJ := boot.o bakery_lock.o platform.o lib.o |
| 26 | |
| 27 | +LIBFDT_SRC := common/libfdt/ |
| 28 | +LIBFDT_OBJS := fdt.o fdt_ro.o fdt_rw.o |
| 29 | + |
| 30 | ARCH_OBJ := boot.o stack.o utils.o |
| 31 | |
| 32 | if BOOTWRAPPER_32 |
Andrew Geissler | 9347dd4 | 2023-03-03 12:38:41 -0600 | [diff] [blame] | 33 | @@ -127,11 +130,12 @@ CFLAGS += -I$(top_srcdir)/include/ -I$(top_srcdir)/$(ARCH_SRC)/include/ |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 34 | CFLAGS += -Wall -fomit-frame-pointer |
Andrew Geissler | 9347dd4 | 2023-03-03 12:38:41 -0600 | [diff] [blame] | 35 | CFLAGS += -ffreestanding -nostdlib |
| 36 | CFLAGS += -fno-stack-protector |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 37 | +CFLAGS += -fno-stack-protector |
| 38 | CFLAGS += -ffunction-sections -fdata-sections |
| 39 | CFLAGS += -fno-pic -fno-pie |
| 40 | LDFLAGS += --gc-sections |
| 41 | |
| 42 | -OBJ := $(addprefix $(ARCH_SRC),$(ARCH_OBJ)) $(addprefix $(COMMON_SRC),$(COMMON_OBJ)) |
| 43 | +OBJ := $(addprefix $(ARCH_SRC),$(ARCH_OBJ)) $(addprefix $(COMMON_SRC),$(COMMON_OBJ)) $(addprefix $(LIBFDT_SRC),$(LIBFDT_OBJS)) |
| 44 | |
| 45 | # Don't lookup all prerequisites in $(top_srcdir), only the source files. When |
| 46 | # building outside the source tree $(ARCH_SRC) needs to be created. |
Andrew Geissler | 9347dd4 | 2023-03-03 12:38:41 -0600 | [diff] [blame] | 47 | @@ -152,10 +156,13 @@ $(ARCH_SRC): |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 48 | $(COMMON_SRC): |
| 49 | $(MKDIR_P) $@ |
| 50 | |
| 51 | +$(LIBFDT_SRC): |
| 52 | + $(MKDIR_P) $@ |
| 53 | + |
| 54 | %.o: %.S Makefile | $(ARCH_SRC) |
| 55 | $(CC) $(CPPFLAGS) -D__ASSEMBLY__ $(CFLAGS) $(DEFINES) -c -o $@ $< |
| 56 | |
| 57 | -%.o: %.c Makefile | $(COMMON_SRC) |
| 58 | +%.o: %.c Makefile | $(COMMON_SRC) $(LIBFDT_SRC) |
| 59 | $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c -o $@ $< |
| 60 | |
| 61 | model.lds: $(LD_SCRIPT) Makefile |