1# 2# (C) Copyright 2000-2002 3# Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4# 5# SPDX-License-Identifier: GPL-2.0+ 6# 7 8CROSS_COMPILE ?= arm-linux- 9 10ifndef CONFIG_STANDALONE_LOAD_ADDR 11ifneq ($(CONFIG_OMAP_COMMON),) 12CONFIG_STANDALONE_LOAD_ADDR = 0x80300000 13else 14CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 15endif 16endif 17 18LDFLAGS_FINAL += --gc-sections 19PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections 20 21# Support generic board on ARM 22__HAVE_ARCH_GENERIC_BOARD := y 23 24PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__ 25 26# Choose between ARM/Thumb instruction sets 27ifeq ($(CONFIG_SYS_THUMB_BUILD),y) 28PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\ 29 $(call cc-option,-marm,)\ 30 $(call cc-option,-mno-thumb-interwork,)\ 31 ) 32else 33PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \ 34 $(call cc-option,-mno-thumb-interwork,) 35endif 36 37# Only test once 38ifneq ($(CONFIG_SPL_BUILD),y) 39ALL-$(CONFIG_SYS_THUMB_BUILD) += checkthumb 40endif 41 42# Try if EABI is supported, else fall back to old API, 43# i. e. for example: 44# - with ELDK 4.2 (EABI supported), use: 45# -mabi=aapcs-linux 46# - with ELDK 4.1 (gcc 4.x, no EABI), use: 47# -mabi=apcs-gnu 48# - with ELDK 3.1 (gcc 3.x), use: 49# -mapcs-32 50PF_CPPFLAGS_ABI := $(call cc-option,\ 51 -mabi=aapcs-linux,\ 52 $(call cc-option,\ 53 -mapcs-32,\ 54 $(call cc-option,\ 55 -mabi=apcs-gnu,\ 56 )\ 57 )\ 58 ) 59PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI) 60 61# For EABI, make sure to provide raise() 62ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS))) 63# This file is parsed many times, so the string may get added multiple 64# times. Also, the prefix needs to be different based on whether 65# CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry 66# before adding the correct one. 67ifdef CONFIG_SPL_BUILD 68PLATFORM_LIBS := $(SPLTREE)/arch/arm/lib/eabi_compat.o \ 69 $(filter-out %/arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS)) 70else 71PLATFORM_LIBS := $(OBJTREE)/arch/arm/lib/eabi_compat.o \ 72 $(filter-out %/arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS)) 73endif 74endif 75 76# needed for relocation 77LDFLAGS_u-boot += -pie 78 79# 80# FIXME: binutils versions < 2.22 have a bug in the assembler where 81# branches to weak symbols can be incorrectly optimized in thumb mode 82# to a short branch (b.n instruction) that won't reach when the symbol 83# gets preempted 84# 85# http://sourceware.org/bugzilla/show_bug.cgi?id=12532 86# 87ifeq ($(CONFIG_SYS_THUMB_BUILD),y) 88ifeq ($(GAS_BUG_12532),) 89export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \ 90 then echo y; else echo n; fi) 91endif 92ifeq ($(GAS_BUG_12532),y) 93PLATFORM_RELFLAGS += -fno-optimize-sibling-calls 94endif 95endif 96 97# check that only R_ARM_RELATIVE relocations are generated 98ifneq ($(CONFIG_SPL_BUILD),y) 99ALL-y += checkarmreloc 100endif 101