aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kbuild/makefiles.txt14
-rw-r--r--scripts/Kbuild.include8
2 files changed, 21 insertions, 1 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 7847fce13bd6..71c602d61680 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -18,6 +18,7 @@ This document describes the Linux kernel Makefiles.
18 --- 3.9 Dependency tracking 18 --- 3.9 Dependency tracking
19 --- 3.10 Special Rules 19 --- 3.10 Special Rules
20 --- 3.11 $(CC) support functions 20 --- 3.11 $(CC) support functions
21 --- 3.12 $(LD) support functions
21 22
22 === 4 Host Program support 23 === 4 Host Program support
23 --- 4.1 Simple Host Program 24 --- 4.1 Simple Host Program
@@ -570,6 +571,19 @@ more details, with real examples.
570 endif 571 endif
571 endif 572 endif
572 573
574--- 3.12 $(LD) support functions
575
576 ld-option
577 ld-option is used to check if $(LD) supports the supplied option.
578 ld-option takes two options as arguments.
579 The second argument is an optional option that can be used if the
580 first option is not supported by $(LD).
581
582 Example:
583 #Makefile
584 LDFLAGS_vmlinux += $(call really-ld-option, -X)
585
586
573=== 4 Host Program support 587=== 4 Host Program support
574 588
575Kbuild supports building executables on the host for use during the 589Kbuild supports building executables on the host for use during the
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 94a4f682f385..b3452601b0b1 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -83,11 +83,12 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
83# is automatically cleaned up. 83# is automatically cleaned up.
84try-run = $(shell set -e; \ 84try-run = $(shell set -e; \
85 TMP="$(TMPOUT).$$$$.tmp"; \ 85 TMP="$(TMPOUT).$$$$.tmp"; \
86 TMPO="$(TMPOUT).$$$$.o"; \
86 if ($(1)) >/dev/null 2>&1; \ 87 if ($(1)) >/dev/null 2>&1; \
87 then echo "$(2)"; \ 88 then echo "$(2)"; \
88 else echo "$(3)"; \ 89 else echo "$(3)"; \
89 fi; \ 90 fi; \
90 rm -f "$$TMP") 91 rm -f "$$TMP" "$$TMPO")
91 92
92# as-option 93# as-option
93# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) 94# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
@@ -135,6 +136,11 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
135cc-ldoption = $(call try-run,\ 136cc-ldoption = $(call try-run,\
136 $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) 137 $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
137 138
139# ld-option
140# Usage: LDFLAGS += $(call ld-option, -X)
141ld-option = $(call try-run,\
142 $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
143
138###### 144######
139 145
140### 146###