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