diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2009-09-19 04:31:45 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2009-09-20 06:27:42 -0400 |
commit | 691ef3e7fdc1fe4dded169d9404f740987f67d66 (patch) | |
tree | 06e8842f0dd8bb015b678a96655e8c2f17baaaa5 /scripts | |
parent | f86fd306605287d7c7f4f0f8e8e2a9d49d28b396 (diff) |
kbuild: introduce ld-option
ld-option is used to check if $(LD) supports a specific option.
Based on patch from Andi Kleen.
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
First use is to check if option -X is supported (upcoming patch).
Theis is ne
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 8 |
1 files changed, 7 insertions, 1 deletions
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. |
84 | try-run = $(shell set -e; \ | 84 | try-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)) | |||
135 | cc-ldoption = $(call try-run,\ | 136 | cc-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) | ||
141 | ld-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 | ### |