summaryrefslogtreecommitdiffstats
path: root/src/Makefile.housekeeping
diff options
context:
space:
mode:
authorMichael Brown2013-07-16 00:08:50 +0200
committerMichael Brown2013-07-16 00:50:54 +0200
commitca319873bf43d5d955cc3d8770b5b2415798907d (patch)
tree8168679666b92de3de4ab5f4453c8383b22bc103 /src/Makefile.housekeeping
parent[legal] Add missing FILE_LICENCE declarations (diff)
downloadipxe-ca319873bf43d5d955cc3d8770b5b2415798907d.tar.gz
ipxe-ca319873bf43d5d955cc3d8770b5b2415798907d.tar.xz
ipxe-ca319873bf43d5d955cc3d8770b5b2415798907d.zip
[build] Fix %.licence build target
Our use of --gc-sections causes the linker to discard the symbols defined by FILE_LICENCE(), meaning that the resulting licence determination is incomplete. We must use the KEEP() directive in the linker script to force the linker to not discard the licence symbols. Using KEEP(*(COMMON)) would be undesirable, since there are some symbols in COMMON which we may wish to discard. Fix by placing symbols defined by PROVIDE_SYMBOL() (which is used by FILE_LICENCE()) into a special ".provided" section, which we then mark with KEEP(). All such symbols are zero-length, so there is no cost in terms of the final binary size. Since the symbols are no longer in COMMON, the linker will reject symbols with the same name coming from multiple objects. We therefore append the object name to the licence symbol, to ensure that it is unique. Reported-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r--src/Makefile.housekeeping11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 80b70f5c..8603bfd6 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -1011,15 +1011,20 @@ $(BIN)/%.nodeps : $(BIN)/%.tmp
# Get licensing verdict for the specified target
#
define licensable_deps_list
- $(filter-out config/local/%.h,$(call deps_list,$(1)))
+ $(filter-out config/local/%.h,\
+ $(filter-out $(BIN)/.%.list,\
+ $(call deps_list,$(1))))
endef
define unlicensed_deps_list
$(shell grep -L FILE_LICENCE $(call licensable_deps_list,$(1)))
endef
define licence_list
- $(patsubst __licence_%,%,\
- $(filter __licence_%,$(shell $(NM) $(1) | cut -d" " -f3)))
+ $(sort $(foreach LICENCE,\
+ $(filter __licence__%,$(shell $(NM) $(1) | cut -d" " -f3)),\
+ $(word 2,$(subst __, ,$(LICENCE)))))
endef
+$(BIN)/%.licence_list : $(BIN)/%.tmp
+ $(Q)$(ECHO) $(call licence_list,$<)
$(BIN)/%.licence : $(BIN)/%.tmp
$(QM)$(ECHO) " [LICENCE] $@"
$(Q)$(if $(strip $(call unlicensed_deps_list,$<)),\