mh-darwin 1.3 KB

123456789101112131415161718192021222324252627282930
  1. # The -mdynamic-no-pic ensures that the compiler executable is built without
  2. # position-independent-code -- the usual default on Darwin. This fix speeds
  3. # compiles by 3-5%. Don't add it if the compiler doesn't also support
  4. # -mno-dynamic-no-pic to undo it.
  5. DARWIN_MDYNAMIC_NO_PIC := \
  6. `case ${host} in i?86-*-darwin* | powerpc-*-darwin*) \
  7. $(CC) -S -xc /dev/null -o /dev/null -mno-dynamic-no-pic 2>/dev/null \
  8. && echo -mdynamic-no-pic ;; esac`
  9. DARWIN_GCC_MDYNAMIC_NO_PIC := \
  10. `case ${host} in i?86-*-darwin* | powerpc-*-darwin*) \
  11. $(CC) -S -xc /dev/null -o /dev/null -mno-dynamic-no-pic 2>/dev/null \
  12. || echo -mdynamic-no-pic ;; esac`
  13. # ld on Darwin versions >= 10.7 defaults to PIE executables. Disable this for
  14. # gcc components, since it is incompatible with our pch implementation.
  15. DARWIN_NO_PIE := `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
  16. BOOT_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC)
  17. BOOT_LDFLAGS += $(DARWIN_NO_PIE)
  18. # Similarly, for cross-compilation.
  19. STAGE1_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC)
  20. STAGE1_LDFLAGS += $(DARWIN_NO_PIE)
  21. # Without -mno-dynamic-no-pic support, add -mdynamic-no-pic just to later
  22. # stages when we know it is built with gcc.
  23. STAGE2_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC)
  24. STAGE3_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC)
  25. STAGE4_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC)