History

Kbuild, lto: add ld-version and ld-ifversion macros

To check the linker version. Used by the LTO makefile.

Andi Kleen committed 12 years ago

Commit ccbef161 parent 7d02b492 files · +17 −0Browse files

Unified · Split

2 files
  1. scripts/Kbuild.include +9 −0
  2. scripts/ld-version.sh +8 −0
scripts/Kbuild.include+9−0
@@ -155,6 +155,15 @@ ld-option = $(call try-run,\ · 154 unmodified lines
155# Important: no spaces around options155# Important: no spaces around options
156ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))156ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
157 157
158# ld-version
159# Usage: $(call ld-version)
160# Note this is mainly for HJ Lu's 3 number binutil versions
161ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
162
163# ld-ifversion
164# Usage: $(call ld-ifversion, -ge, 22252, y)
165ld-ifversion = $(shell [ $(call ld-version) $(1) $(2) ] && echo $(3))
166
158######167######
159 168
160###169###
scripts/ld-version.sh+8−0
@@ -0,0 +1,8 @@
1#!/usr/bin/awk -f
2# extract linker version number from stdin and turn into single number
3 {
4 gsub(".*)", "");
5 split($1,a, ".");
6 print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5];
7 exit
8 }