config.mk 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # (C) Copyright 2003
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # SPDX-License-Identifier: GPL-2.0+
  6. #
  7. ifdef CONFIG_SYS_BIG_ENDIAN
  8. 32bit-emul := elf32btsmip
  9. 64bit-emul := elf64btsmip
  10. 32bit-bfd := elf32-tradbigmips
  11. 64bit-bfd := elf64-tradbigmips
  12. PLATFORM_CPPFLAGS += -EB
  13. PLATFORM_LDFLAGS += -EB
  14. endif
  15. ifdef CONFIG_SYS_LITTLE_ENDIAN
  16. 32bit-emul := elf32ltsmip
  17. 64bit-emul := elf64ltsmip
  18. 32bit-bfd := elf32-tradlittlemips
  19. 64bit-bfd := elf64-tradlittlemips
  20. PLATFORM_CPPFLAGS += -EL
  21. PLATFORM_LDFLAGS += -EL
  22. endif
  23. ifdef CONFIG_32BIT
  24. PLATFORM_CPPFLAGS += -mabi=32
  25. PLATFORM_LDFLAGS += -m $(32bit-emul)
  26. OBJCOPYFLAGS += -O $(32bit-bfd)
  27. endif
  28. ifdef CONFIG_64BIT
  29. PLATFORM_CPPFLAGS += -mabi=64
  30. PLATFORM_LDFLAGS += -m$(64bit-emul)
  31. OBJCOPYFLAGS += -O $(64bit-bfd)
  32. endif
  33. cpuflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,-mips32
  34. cpuflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,-mips32r2
  35. cpuflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,-mips64
  36. cpuflags-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,-mips64r2
  37. PLATFORM_CPPFLAGS += $(cpuflags-y)
  38. PLATFORM_CPPFLAGS += -D__MIPS__
  39. #
  40. # From Linux arch/mips/Makefile
  41. #
  42. # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
  43. # code since it only slows down the whole thing. At some point we might make
  44. # use of global pointer optimizations but their use of $28 conflicts with
  45. # the current pointer optimization.
  46. #
  47. # The DECStation requires an ECOFF kernel for remote booting, other MIPS
  48. # machines may also. Since BFD is incredibly buggy with respect to
  49. # crossformat linking we rely on the elf2ecoff tool for format conversion.
  50. #
  51. # cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
  52. # cflags-y += -msoft-float
  53. # LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
  54. # MODFLAGS += -mlong-calls
  55. #
  56. # On the other hand, we want PIC in the U-Boot code to relocate it from ROM
  57. # to RAM. $28 is always used as gp.
  58. #
  59. PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic
  60. PLATFORM_CPPFLAGS += -msoft-float
  61. PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib
  62. PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
  63. LDFLAGS_FINAL += --gc-sections -pie
  64. OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .got
  65. OBJCOPYFLAGS += -j .u_boot_list -j .rel.dyn -j .padding