// string.
NT_GNU_GOLD_VERSION = 4,
// Program property note, as described in "Linux Extensions to the gABI".
- NT_GNU_PROPERTY_TYPE_0 = 5
+ NT_GNU_PROPERTY_TYPE_0 = 5,
+ // FDO .note.package notes as defined on https://systemd.io/ELF_PACKAGE_METADATA/
+ FDO_PACKAGING_METADATA = 0xcafe1a7e
};
// The OS values which may appear in word 0 of a NT_GNU_ABI_TAG note.
THREADLIBS = @PTHREAD_LIBS@
AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS)
-AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS)
+AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS) $(JANSSON_CFLAGS)
AM_LDFLAGS = $(THREADFLAGS)
AM_CPPFLAGS = \
sources_var = main.cc
deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
ldflags_var = $(GOLD_LDFLAGS)
ld_new_SOURCES = $(sources_var)
incremental_dump_DEPENDENCIES = $(TARGETOBJS) libgold.a $(LIBIBERTY) \
$(LIBINTL_DEP)
incremental_dump_LDADD = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
dwp_SOURCES = dwp.cc
dwp_DEPENDENCIES = libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADLIBS) \
- $(LIBDL) $(ZLIB)
+ $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
dwp_LDFLAGS = $(GOLD_LDFLAGS)
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/pkg.m4 \
$(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) libgold.a $(LIBIBERTY) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
ld_new_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(ld_new_LDFLAGS) \
$(LDFLAGS) -o $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@am_ld1_OBJECTS = $(am__objects_4)
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
+JANSSON_CFLAGS = @JANSSON_CFLAGS@
+JANSSON_LIBS = @JANSSON_LIBS@
LDFLAGS = @LDFLAGS@
LFS_CFLAGS = @LFS_CFLAGS@
LIBINTL = @LIBINTL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POSUB = @POSUB@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
THREADFLAGS = @PTHREAD_CFLAGS@
THREADLIBS = @PTHREAD_LIBS@
AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS)
-AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS)
+AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS) $(JANSSON_CFLAGS)
AM_LDFLAGS = $(THREADFLAGS)
AM_CPPFLAGS = \
-I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
sources_var = main.cc
deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
ldflags_var = $(GOLD_LDFLAGS)
ld_new_SOURCES = $(sources_var)
$(LIBINTL_DEP)
incremental_dump_LDADD = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
dwp_SOURCES = dwp.cc
dwp_DEPENDENCIES = libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADLIBS) \
- $(LIBDL) $(ZLIB)
+ $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
dwp_LDFLAGS = $(GOLD_LDFLAGS)
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
m4_include([../config/lead-dot.m4])
m4_include([../config/nls.m4])
m4_include([../config/override.m4])
+m4_include([../config/pkg.m4])
m4_include([../config/plugins.m4])
m4_include([../config/po.m4])
m4_include([../config/progtest.m4])
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* The jansson library is to be used */
+#undef HAVE_JANSSON
+
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
HAVE_NO_USE_LINKER_PLUGIN_TRUE
HAVE_PUBNAMES_FALSE
HAVE_PUBNAMES_TRUE
+JANSSON_LIBS
+JANSSON_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
THREADS_FALSE
THREADS_TRUE
PTHREAD_CFLAGS
with_gold_ldadd
with_system_zlib
enable_threads
+enable_jansson
enable_maintainer_mode
'
ac_precious_vars='build_alias
CCC
YACC
YFLAGS
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+JANSSON_CFLAGS
+JANSSON_LIBS
CXXCPP'
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings
--enable-threads[=ARG] multi-threaded linking [ARG={auto,yes,no}]
+ --enable-jansson enable jansson [default=no]
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
YFLAGS The list of arguments that will be passed by default to $YACC.
This script will default YFLAGS to the empty string to avoid a
default value of `-d' given by some make applications.
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ JANSSON_CFLAGS
+ C compiler flags for JANSSON, overriding pkg-config
+ JANSSON_LIBS
+ linker flags for JANSSON, overriding pkg-config
CXXCPP C++ preprocessor
Use these variables to override the choices made by `configure' or to help
fi
+# Used to validate --package-metadata= input. Disabled by default.
+# Check whether --enable-jansson was given.
+if test "${enable_jansson+set}" = set; then :
+ enableval=$enable_jansson; enable_jansson=$enableval
+else
+ enable_jansson="no"
+fi
+
+
+if test "x$enable_jansson" != "xno"; then
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
+ if test -n "$PKG_CONFIG"; then :
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jansson" >&5
+$as_echo_n "checking for jansson... " >&6; }
+
+if test -n "$JANSSON_CFLAGS"; then
+ pkg_cv_JANSSON_CFLAGS="$JANSSON_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "jansson") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_JANSSON_CFLAGS=`$PKG_CONFIG --cflags "jansson" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$JANSSON_LIBS"; then
+ pkg_cv_JANSSON_LIBS="$JANSSON_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "jansson") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_JANSSON_LIBS=`$PKG_CONFIG --libs "jansson" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+if test $pkg_failed = no; then
+ pkg_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $pkg_cv_JANSSON_LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+ pkg_failed=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$pkg_save_LDFLAGS
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ JANSSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jansson" 2>&1`
+ else
+ JANSSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jansson" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$JANSSON_PKG_ERRORS" >&5
+
+
+ as_fn_error $? "Cannot find jansson library" "$LINENO" 5
+
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ as_fn_error $? "Cannot find jansson library" "$LINENO" 5
+
+else
+ JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS
+ JANSSON_LIBS=$pkg_cv_JANSSON_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+$as_echo "#define HAVE_JANSSON 1" >>confdefs.h
+
+
+
+
+fi
+
+else
+
+ as_fn_error $? "Cannot find pkg-config" "$LINENO" 5
+
+fi
+fi
+
ac_fn_c_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default"
if test "x$ac_cv_have_decl_basename" = xyes; then :
ac_have_decl=1
fi
AM_CONDITIONAL(THREADS, test "$threads" = "yes")
+# Used to validate --package-metadata= input. Disabled by default.
+AC_ARG_ENABLE([jansson],
+ [AS_HELP_STRING([--enable-jansson],
+ [enable jansson [default=no]])],
+ [enable_jansson=$enableval],
+ [enable_jansson="no"])
+
+if test "x$enable_jansson" != "xno"; then
+ PKG_PROG_PKG_CONFIG
+ AS_IF([test -n "$PKG_CONFIG"],
+ [
+ PKG_CHECK_MODULES(JANSSON, [jansson],
+ [
+ AC_DEFINE(HAVE_JANSSON, 1, [The jansson library is to be used])
+ AC_SUBST([JANSSON_CFLAGS])
+ AC_SUBST([JANSSON_LIBS])
+ ],
+ [
+ AC_MSG_ERROR([Cannot find jansson library])
+ ])
+ ],
+ [
+ AC_MSG_ERROR([Cannot find pkg-config])
+ ])
+fi
+
dnl We have to check these in C, not C++, because autoconf generates
dnl tests which have no type information, and current glibc provides
dnl multiple declarations of functions like basename when compiling
#include <windows.h>
#include <rpcdce.h>
#endif
+#ifdef HAVE_JANSSON
+#include <jansson.h>
+#endif
#include "parameters.h"
#include "options.h"
this->create_gold_note();
this->create_stack_segment();
this->create_build_id();
+ this->create_package_metadata();
}
// Create the dynamic sections which are needed before we read the
}
}
+// If --package-metadata was used, set up the package metadata note.
+// https://systemd.io/ELF_PACKAGE_METADATA/
+
+void
+Layout::create_package_metadata()
+{
+ if (!parameters->options().user_set_package_metadata())
+ return;
+
+ const char* desc = parameters->options().package_metadata();
+ if (strcmp(desc, "") == 0)
+ return;
+
+#ifdef HAVE_JANSSON
+ json_error_t json_error;
+ json_t *json = json_loads(desc, 0, &json_error);
+ if (json)
+ json_decref(json);
+ else
+ {
+ gold_fatal(_("error: --package-metadata=%s does not contain valid "
+ "JSON: %s\n"),
+ desc, json_error.text);
+ }
+#endif
+
+ // Create the note.
+ size_t trailing_padding;
+ // Ensure the trailing NULL byte is always included, as per specification.
+ size_t descsz = strlen(desc) + 1;
+ Output_section* os = this->create_note("FDO", elfcpp::FDO_PACKAGING_METADATA,
+ ".note.package", descsz, true,
+ &trailing_padding);
+ if (os == NULL)
+ return;
+
+ Output_section_data* posd = new Output_data_const(desc, descsz, 4);
+ os->add_output_section_data(posd);
+
+ if (trailing_padding != 0)
+ {
+ posd = new Output_data_zero_fill(trailing_padding, 0);
+ os->add_output_section_data(posd);
+ }
+}
+
// If we have both .stabXX and .stabXXstr sections, then the sh_link
// field of the former should point to the latter. I'm not sure who
// started this, but the GNU linker does it, and some tools depend
void
create_build_id();
+ // Create a package metadata note if needed.
+ void
+ create_package_metadata();
+
// Link .stab and .stabstr sections.
void
link_stabs_sections();
Gdb_index* gdb_index_data_;
// The space for the build ID checksum if there is one.
Output_section_data* build_id_note_;
+ // The space for the package metadata JSON if there is one.
+ Output_section_data* package_metadata_note_;
// The output section containing dwarf abbreviations
Output_reduced_debug_abbrev_section* debug_abbrev_;
// The output section containing the dwarf debug info tree
DEFINE_bool(p, options::ONE_DASH, 'p', false,
N_("Ignored for ARM compatibility"), NULL);
+ DEFINE_optional_string(package_metadata, options::TWO_DASHES, '\0', NULL,
+ N_("Generate package metadata note"),
+ N_("[=JSON]"));
+
DEFINE_bool(pie, options::ONE_DASH, '\0', false,
N_("Create a position independent executable"),
N_("Do not create a position independent executable"));
object_unittest_SOURCES = object_unittest.cc
object_unittest_LDFLAGS = $(THREADFLAGS)
object_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
check_PROGRAMS += binary_unittest
binary_unittest_SOURCES = binary_unittest.cc
binary_unittest_LDFLAGS = $(THREADFLAGS)
binary_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
check_PROGRAMS += leb128_unittest
leb128_unittest_SOURCES = leb128_unittest.cc
leb128_unittest_LDFLAGS = $(THREADFLAGS)
leb128_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
check_PROGRAMS += overflow_unittest
overflow_unittest_SOURCES = overflow_unittest.cc
overflow_unittest_LDFLAGS = $(THREADFLAGS)
overflow_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
overflow_unittest.o: overflow_unittest.cc
$(CXXCOMPILE) -O3 -c -o $@ $<
$(TEST_AS) -o $@ $<
endif DEFAULT_TARGET_X86_64
+
+check_PROGRAMS += package_metadata_test
+package_metadata_test.o: package_metadata_main.c
+ $(COMPILE) -c -o $@ $<
+package_metadata_test$(EXEEXT): package_metadata_test.o gcctestdir/ld
+ $(CXXLINK) package_metadata_test.o -Wl,--package-metadata='{"foo":"bar"}'
+ $(TEST_READELF) --notes $@ | grep -q '{"foo":"bar"}'
$(am__EXEEXT_37) $(am__EXEEXT_38) $(am__EXEEXT_39) \
$(am__EXEEXT_40) $(am__EXEEXT_41) $(am__EXEEXT_42) \
$(am__EXEEXT_43) $(am__EXEEXT_44) $(am__EXEEXT_45) \
- $(am__EXEEXT_46) $(am__EXEEXT_47)
+ $(am__EXEEXT_46) $(am__EXEEXT_47) \
+ package_metadata_test$(EXEEXT)
@NATIVE_OR_CROSS_LINKER_TRUE@am__append_1 = object_unittest \
@NATIVE_OR_CROSS_LINKER_TRUE@ binary_unittest leb128_unittest \
@NATIVE_OR_CROSS_LINKER_TRUE@ overflow_unittest
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/pkg.m4 \
$(top_srcdir)/../config/plugins.m4 \
$(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
+@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1)
binary_unittest_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(binary_unittest_LDFLAGS) $(LDFLAGS) -o $@
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
+@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1)
leb128_unittest_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(leb128_unittest_LDFLAGS) $(LDFLAGS) -o $@
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
+@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1)
object_unittest_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(object_unittest_LDFLAGS) $(LDFLAGS) -o $@
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
+@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1) \
@NATIVE_OR_CROSS_LINKER_TRUE@ $(am__DEPENDENCIES_1)
overflow_unittest_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(overflow_unittest_LDFLAGS) $(LDFLAGS) -o $@
+package_metadata_test_SOURCES = package_metadata_test.c
+package_metadata_test_OBJECTS = package_metadata_test.$(OBJEXT)
+package_metadata_test_LDADD = $(LDADD)
permission_test_SOURCES = permission_test.c
permission_test_OBJECTS = permission_test.$(OBJEXT)
permission_test_LDADD = $(LDADD)
$(large_symbol_alignment_SOURCES) $(leb128_unittest_SOURCES) \
local_labels_test.c many_sections_r_test.c \
$(many_sections_test_SOURCES) $(object_unittest_SOURCES) \
- $(overflow_unittest_SOURCES) permission_test.c \
- $(pie_copyrelocs_test_SOURCES) plugin_test_1.c \
- plugin_test_10.c plugin_test_11.c plugin_test_12.c \
- plugin_test_2.c plugin_test_3.c plugin_test_4.c \
- plugin_test_5.c plugin_test_6.c plugin_test_7.c \
- plugin_test_8.c plugin_test_defsym.c plugin_test_start_lib.c \
- plugin_test_tls.c plugin_test_wrap_symbols.c pr17704a_test.c \
+ $(overflow_unittest_SOURCES) package_metadata_test.c \
+ permission_test.c $(pie_copyrelocs_test_SOURCES) \
+ plugin_test_1.c plugin_test_10.c plugin_test_11.c \
+ plugin_test_12.c plugin_test_2.c plugin_test_3.c \
+ plugin_test_4.c plugin_test_5.c plugin_test_6.c \
+ plugin_test_7.c plugin_test_8.c plugin_test_defsym.c \
+ plugin_test_start_lib.c plugin_test_tls.c \
+ plugin_test_wrap_symbols.c pr17704a_test.c \
$(pr20216a_test_SOURCES) $(pr20216b_test_SOURCES) \
$(pr20216c_test_SOURCES) $(pr20216d_test_SOURCES) \
$(pr20216e_test_SOURCES) $(pr20308a_test_SOURCES) \
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
+JANSSON_CFLAGS = @JANSSON_CFLAGS@
+JANSSON_LIBS = @JANSSON_LIBS@
LDFLAGS = @LDFLAGS@
LFS_CFLAGS = @LFS_CFLAGS@
LIBINTL = @LIBINTL@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POSUB = @POSUB@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
@NATIVE_OR_CROSS_LINKER_TRUE@object_unittest_SOURCES = object_unittest.cc
@NATIVE_OR_CROSS_LINKER_TRUE@object_unittest_LDFLAGS = $(THREADFLAGS)
@NATIVE_OR_CROSS_LINKER_TRUE@object_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
-@NATIVE_OR_CROSS_LINKER_TRUE@ $(THREADLIBS) $(LIBDL) $(ZLIB)
+@NATIVE_OR_CROSS_LINKER_TRUE@ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
@NATIVE_OR_CROSS_LINKER_TRUE@binary_unittest_SOURCES = binary_unittest.cc
@NATIVE_OR_CROSS_LINKER_TRUE@binary_unittest_LDFLAGS = $(THREADFLAGS)
@NATIVE_OR_CROSS_LINKER_TRUE@binary_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
-@NATIVE_OR_CROSS_LINKER_TRUE@ $(THREADLIBS) $(LIBDL) $(ZLIB)
+@NATIVE_OR_CROSS_LINKER_TRUE@ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
@NATIVE_OR_CROSS_LINKER_TRUE@leb128_unittest_SOURCES = leb128_unittest.cc
@NATIVE_OR_CROSS_LINKER_TRUE@leb128_unittest_LDFLAGS = $(THREADFLAGS)
@NATIVE_OR_CROSS_LINKER_TRUE@leb128_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
-@NATIVE_OR_CROSS_LINKER_TRUE@ $(THREADLIBS) $(LIBDL) $(ZLIB)
+@NATIVE_OR_CROSS_LINKER_TRUE@ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
@NATIVE_OR_CROSS_LINKER_TRUE@overflow_unittest_SOURCES = overflow_unittest.cc
@NATIVE_OR_CROSS_LINKER_TRUE@overflow_unittest_LDFLAGS = $(THREADFLAGS)
@NATIVE_OR_CROSS_LINKER_TRUE@overflow_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
-@NATIVE_OR_CROSS_LINKER_TRUE@ $(THREADLIBS) $(LIBDL) $(ZLIB)
+@NATIVE_OR_CROSS_LINKER_TRUE@ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@large_symbol_alignment_SOURCES = large_symbol_alignment.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/many_sections_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overflow_unittest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/package_metadata_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/permission_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pie_copyrelocs_test-pie_copyrelocs_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_1.Po@am__quote@
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+package_metadata_test.log: package_metadata_test$(EXEEXT)
+ @p='package_metadata_test$(EXEEXT)'; \
+ b='package_metadata_test'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; \
$(am__set_b); \
@DEFAULT_TARGET_X86_64_TRUE@ ../ld-new -pie -e _start --gc-sections -o $@ retain_2.o
@DEFAULT_TARGET_X86_64_TRUE@retain_2.o: retain_2.s
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $<
+package_metadata_test.o: package_metadata_main.c
+ $(COMPILE) -c -o $@ $<
+package_metadata_test$(EXEEXT): package_metadata_test.o gcctestdir/ld
+ $(CXXLINK) package_metadata_test.o -Wl,--package-metadata='{"foo":"bar"}'
+ $(TEST_READELF) --notes $@ | grep -q '{"foo":"bar"}'
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
--- /dev/null
+int
+main(void)
+{
+ return 0;
+}