bsd.linker.mk (83cff1f8e51a29aaef1a598af5589398bd64478e) bsd.linker.mk (cdd89b9897bab7002b3fdbe3977357e01dc8546d)
1# $FreeBSD$
2
3# Setup variables for the linker.
4#
5# LINKER_TYPE is the major type of linker. Currently binutils and lld support
6# automatic detection.
7#
8# LINKER_VERSION is a numeric constant equal to:
9# major * 10000 + minor * 100 + tiny
10# It too can be overridden on the command line.
11#
1# $FreeBSD$
2
3# Setup variables for the linker.
4#
5# LINKER_TYPE is the major type of linker. Currently binutils and lld support
6# automatic detection.
7#
8# LINKER_VERSION is a numeric constant equal to:
9# major * 10000 + minor * 100 + tiny
10# It too can be overridden on the command line.
11#
12# LINKER_FEATURES may contain one or more of the following, based on
13# linker support for that feature:
14#
15# - build-id : support for generating a Build-ID note
16#
12# These variables with an X_ prefix will also be provided if XLD is set.
13#
14# This file may be included multiple times, but only has effect the first time.
15#
16
17.if !target(__<bsd.linker.mk>__)
18__<bsd.linker.mk>__:
19
20.for ld X_ in LD $${_empty_var_} XLD X_
21.if ${ld} == "LD" || !empty(XLD)
22# Try to import LINKER_TYPE and LINKER_VERSION from parent make.
23# The value is only used/exported for the same environment that impacts
24# LD and LINKER_* settings here.
17# These variables with an X_ prefix will also be provided if XLD is set.
18#
19# This file may be included multiple times, but only has effect the first time.
20#
21
22.if !target(__<bsd.linker.mk>__)
23__<bsd.linker.mk>__:
24
25.for ld X_ in LD $${_empty_var_} XLD X_
26.if ${ld} == "LD" || !empty(XLD)
27# Try to import LINKER_TYPE and LINKER_VERSION from parent make.
28# The value is only used/exported for the same environment that impacts
29# LD and LINKER_* settings here.
25_exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION
30_exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION ${X_}LINKER_FEATURES
26${X_}_ld_hash= ${${ld}}${MACHINE}${PATH}
27${X_}_ld_hash:= ${${X_}_ld_hash:hash}
28# Only import if none of the vars are set somehow else.
29_can_export= yes
30.for var in ${_exported_vars}
31.if defined(${var})
32_can_export= no
33.endif

--- 20 unchanged lines hidden (view full) ---

54_v= ${_ld_version:[2]}
55.else
56.error Unknown linker from ${ld}=${${ld}}: ${_ld_version}
57.endif
58${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \
59 awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}'
60.undef _ld_version
61.undef _v
31${X_}_ld_hash= ${${ld}}${MACHINE}${PATH}
32${X_}_ld_hash:= ${${X_}_ld_hash:hash}
33# Only import if none of the vars are set somehow else.
34_can_export= yes
35.for var in ${_exported_vars}
36.if defined(${var})
37_can_export= no
38.endif

--- 20 unchanged lines hidden (view full) ---

59_v= ${_ld_version:[2]}
60.else
61.error Unknown linker from ${ld}=${${ld}}: ${_ld_version}
62.endif
63${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \
64 awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}'
65.undef _ld_version
66.undef _v
67${X_}LINKER_FEATURES=
68.if ${${X_}LINKER_TYPE} != "bfd" || ${${X_}LINKER_VERSION} > 21750
69${X_}LINKER_FEATURES+= build-id
62.endif
70.endif
71.endif
63.else
64# Use LD's values
65X_LINKER_TYPE= ${LINKER_TYPE}
66X_LINKER_VERSION= ${LINKER_VERSION}
72.else
73# Use LD's values
74X_LINKER_TYPE= ${LINKER_TYPE}
75X_LINKER_VERSION= ${LINKER_VERSION}
76X_LINKER_FEATURES= ${LINKER_FEATURES}
67.endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD})
68
69# Export the values so sub-makes don't have to look them up again, using the
70# hash key computed above.
71.for var in ${_exported_vars}
72${var}.${${X_}_ld_hash}:= ${${var}}
73.export-env ${var}.${${X_}_ld_hash}
74.undef ${var}.${${X_}_ld_hash}
75.endfor
76
77.endif # ${ld} == "LD" || !empty(XLD)
78.endfor # .for ld in LD XLD
79
80
81.endif # !target(__<bsd.linker.mk>__)
77.endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD})
78
79# Export the values so sub-makes don't have to look them up again, using the
80# hash key computed above.
81.for var in ${_exported_vars}
82${var}.${${X_}_ld_hash}:= ${${var}}
83.export-env ${var}.${${X_}_ld_hash}
84.undef ${var}.${${X_}_ld_hash}
85.endfor
86
87.endif # ${ld} == "LD" || !empty(XLD)
88.endfor # .for ld in LD XLD
89
90
91.endif # !target(__<bsd.linker.mk>__)