1*4882a593Smuzhiyun# 2*4882a593Smuzhiyun# (C) Copyright 2003 3*4882a593Smuzhiyun# Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4*4882a593Smuzhiyun# 5*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0+ 6*4882a593Smuzhiyun# 7*4882a593Smuzhiyun 8*4882a593Smuzhiyunifdef CONFIG_SYS_BIG_ENDIAN 9*4882a593Smuzhiyun32bit-emul := elf32btsmip 10*4882a593Smuzhiyun64bit-emul := elf64btsmip 11*4882a593Smuzhiyun32bit-bfd := elf32-tradbigmips 12*4882a593Smuzhiyun64bit-bfd := elf64-tradbigmips 13*4882a593SmuzhiyunPLATFORM_CPPFLAGS += -EB 14*4882a593SmuzhiyunPLATFORM_LDFLAGS += -EB 15*4882a593Smuzhiyunendif 16*4882a593Smuzhiyun 17*4882a593Smuzhiyunifdef CONFIG_SYS_LITTLE_ENDIAN 18*4882a593Smuzhiyun32bit-emul := elf32ltsmip 19*4882a593Smuzhiyun64bit-emul := elf64ltsmip 20*4882a593Smuzhiyun32bit-bfd := elf32-tradlittlemips 21*4882a593Smuzhiyun64bit-bfd := elf64-tradlittlemips 22*4882a593SmuzhiyunPLATFORM_CPPFLAGS += -EL 23*4882a593SmuzhiyunPLATFORM_LDFLAGS += -EL 24*4882a593Smuzhiyunendif 25*4882a593Smuzhiyun 26*4882a593Smuzhiyunifdef CONFIG_32BIT 27*4882a593SmuzhiyunPLATFORM_CPPFLAGS += -mabi=32 28*4882a593SmuzhiyunPLATFORM_LDFLAGS += -m $(32bit-emul) 29*4882a593SmuzhiyunOBJCOPYFLAGS += -O $(32bit-bfd) 30*4882a593Smuzhiyunendif 31*4882a593Smuzhiyun 32*4882a593Smuzhiyunifdef CONFIG_64BIT 33*4882a593SmuzhiyunPLATFORM_CPPFLAGS += -mabi=64 34*4882a593SmuzhiyunPLATFORM_LDFLAGS += -m$(64bit-emul) 35*4882a593SmuzhiyunOBJCOPYFLAGS += -O $(64bit-bfd) 36*4882a593Smuzhiyunendif 37*4882a593Smuzhiyun 38*4882a593SmuzhiyunPLATFORM_CPPFLAGS += -D__MIPS__ 39*4882a593SmuzhiyunPLATFORM_ELFENTRY = "__start" 40*4882a593SmuzhiyunPLATFORM_ELFFLAGS += -B mips $(OBJCOPYFLAGS) 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun# 43*4882a593Smuzhiyun# From Linux arch/mips/Makefile 44*4882a593Smuzhiyun# 45*4882a593Smuzhiyun# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel 46*4882a593Smuzhiyun# code since it only slows down the whole thing. At some point we might make 47*4882a593Smuzhiyun# use of global pointer optimizations but their use of $28 conflicts with 48*4882a593Smuzhiyun# the current pointer optimization. 49*4882a593Smuzhiyun# 50*4882a593Smuzhiyun# The DECStation requires an ECOFF kernel for remote booting, other MIPS 51*4882a593Smuzhiyun# machines may also. Since BFD is incredibly buggy with respect to 52*4882a593Smuzhiyun# crossformat linking we rely on the elf2ecoff tool for format conversion. 53*4882a593Smuzhiyun# 54*4882a593Smuzhiyun# cflags-y += -G 0 -mno-abicalls -fno-pic -pipe 55*4882a593Smuzhiyun# cflags-y += -msoft-float 56*4882a593Smuzhiyun# LDFLAGS_vmlinux += -G 0 -static -n -nostdlib 57*4882a593Smuzhiyun# MODFLAGS += -mlong-calls 58*4882a593Smuzhiyun# 59*4882a593Smuzhiyunifndef CONFIG_SPL_BUILD 60*4882a593SmuzhiyunOBJCOPYFLAGS += -j .got -j .rel -j .padding -j .dtb.init.rodata 61*4882a593SmuzhiyunLDFLAGS_FINAL += --emit-relocs 62*4882a593Smuzhiyunendif 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunPLATFORM_CPPFLAGS += -G 0 -mno-abicalls -fno-pic 65*4882a593SmuzhiyunPLATFORM_CPPFLAGS += -msoft-float 66*4882a593SmuzhiyunPLATFORM_LDFLAGS += -G 0 -static -n -nostdlib 67*4882a593SmuzhiyunPLATFORM_RELFLAGS += -ffunction-sections -fdata-sections 68*4882a593SmuzhiyunLDFLAGS_FINAL += --gc-sections 69*4882a593SmuzhiyunOBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list 70