--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -98,6 +98,18 @@ ldelf_after_parse (void)
 	fatal (_("%P: common page size (0x%v) > maximum page size (0x%v)\n"),
 	       link_info.commonpagesize, link_info.maxpagesize);
     }
+
+  if (!ldelf_emit_note_fdo_package_metadata)
+    {
+      char *package_metadata = getenv("ELF_PACKAGE_METADATA");
+
+      if (package_metadata)
+	{
+	  char * const p = xmalloc (strlen (package_metadata) + 1);
+	  strcpy (p, package_metadata);
+	  ldelf_emit_note_fdo_package_metadata = (const char *)p;
+	}
+    }
 }
 
 /* Handle the generation of DT_NEEDED tags.  */
--- a/Makefile.in
+++ b/Makefile.in
@@ -2823,6 +2823,8 @@ do-check:
 	@: $(MAKE); $(unstage)
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Unset ELF_PACKAGE_METADATA for tests"; \
+	export -n ELF_PACKAGE_METADATA; \
 	$(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
 
 # Automated reporting of test results.
@@ -4328,6 +4330,7 @@ check-bfd:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/bfd && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -5468,6 +5471,7 @@ check-opcodes:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/opcodes && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -6608,6 +6612,7 @@ check-binutils:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/binutils && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -7533,6 +7538,7 @@ check-cgen:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/cgen && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -8001,6 +8007,7 @@ check-dejagnu:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/dejagnu && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -8469,6 +8476,7 @@ check-etc:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/etc && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -10094,6 +10102,7 @@ check-fixincludes:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/fixincludes && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -11674,6 +11683,7 @@ check-gas:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gas && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -12823,6 +12833,7 @@ check-gcc:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gcc && \
 	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -13972,6 +13983,7 @@ check-gmp:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gmp && \
 	  $(MAKE) $(FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -15109,6 +15121,7 @@ check-mpfr:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/mpfr && \
 	  $(MAKE) $(FLAGS_TO_PASS) AM_CFLAGS="-DNO_ASM" $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -16246,6 +16259,7 @@ check-mpc:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/mpc && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -17383,6 +17397,7 @@ check-isl:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/isl && \
 	  $(MAKE) $(FLAGS_TO_PASS) V=1 $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -18511,6 +18526,7 @@ check-gold:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gold && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -18965,6 +18981,7 @@ check-gprof:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gprof && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -19433,6 +19450,7 @@ check-gprofng:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gprofng && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -20596,6 +20614,7 @@ check-gettext:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gettext && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -20899,6 +20918,7 @@ check-tcl:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/tcl && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -21352,6 +21372,7 @@ check-itcl:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/itcl && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -22506,6 +22527,7 @@ check-ld:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/ld && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -23646,6 +23668,7 @@ check-libbacktrace:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libbacktrace && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -24786,6 +24809,7 @@ check-libcpp:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libcpp && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -25926,6 +25950,7 @@ check-libcody:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libcody && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -26915,6 +26940,7 @@ check-libdecnumber:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libdecnumber && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -27354,6 +27380,7 @@ check-libgui:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libgui && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -28517,6 +28544,7 @@ check-libiberty:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libiberty && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -29666,6 +29694,7 @@ check-libiberty-linker-plugin:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libiberty-linker-plugin && \
 	  $(MAKE) $(FLAGS_TO_PASS) @extra_linker_plugin_flags@ $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -30815,6 +30844,7 @@ check-libiconv:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libiconv && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -31164,6 +31194,7 @@ check-m4:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/m4 && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -31632,6 +31663,7 @@ check-readline:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/readline && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -32100,6 +32132,7 @@ check-sid:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/sid && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -32568,6 +32601,7 @@ check-sim:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/sim && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -33036,6 +33070,7 @@ check-texinfo:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/texinfo && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -34623,6 +34658,7 @@ check-gnulib:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gnulib && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -35091,6 +35127,7 @@ check-gdbsupport:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gdbsupport && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -35559,6 +35596,7 @@ check-gdbserver:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gdbserver && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -36027,6 +36065,7 @@ check-gdb:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gdb && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -36495,6 +36534,7 @@ check-expect:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/expect && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -36963,6 +37003,7 @@ check-guile:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/guile && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -37431,6 +37472,7 @@ check-tk:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/tk && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -38763,6 +38805,7 @@ check-c++tools:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/c++tools && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -39215,6 +39258,7 @@ check-gnattools:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gnattools && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -40378,6 +40422,7 @@ check-lto-plugin:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/lto-plugin && \
 	  $(MAKE) $(FLAGS_TO_PASS) @extra_linker_plugin_flags@ $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -40832,6 +40877,7 @@ check-libcc1:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libcc1 && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -41300,6 +41346,7 @@ check-gotools:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/gotools && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
@@ -42454,6 +42501,7 @@ check-libctf:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libctf && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -43594,6 +43642,7 @@ check-libsframe:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libsframe && \
 	  $(MAKE) $(FLAGS_TO_PASS)  $(EXTRA_BOOTSTRAP_FLAGS) check)
 
@@ -44048,6 +44097,7 @@ check-libgrust:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS)  \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/libgrust && \
 	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -1008,6 +1008,8 @@ do-check:
 	@: $(MAKE); $(unstage)
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Unset ELF_PACKAGE_METADATA for tests"; \
+	export -n ELF_PACKAGE_METADATA; \
 	$(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
 
 # Automated reporting of test results.
@@ -1389,6 +1391,7 @@ check-[+module+]:
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
 	ENDIF bootstrap +] \
+	export -n ELF_PACKAGE_METADATA; \
 	(cd $(HOST_SUBDIR)/[+module+] && \
 	  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
 	  IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
