diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2019-03-29 17:20:16 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2019-03-29 17:20:16 +1100 |
commit | 5c3513f68921cc15231af7ae6806c1f61c517c7c (patch) | |
tree | a187cb60d7ad5bfbb2ddb13f65d0cb6b7efd24d7 | |
parent | 00f9febf9c16d932380243a3135ee5aed1adc410 (diff) | |
download | device-tree-compiler-5c3513f68921cc15231af7ae6806c1f61c517c7c.tar.gz |
Link tools and tests against libfdt shared library
Currently the libfdt based tools (fdtput, fdtget, etc.) and all the
test binaries using libfdt are linked against the static version of libfdt.
That's made it very easy in the past to forget to properly update the
version.lds file which is needed to make functions publicaly accessible
from the shared library.
To avoid problems like that in future, alter the build so that we link and
run the tests against the shared library version of libfdt.
That immediately points out several important symbols that are still
missing from the version.lds, so fix those as well.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | libfdt/.gitignore | 1 | ||||
-rw-r--r-- | libfdt/Makefile.libfdt | 2 | ||||
-rw-r--r-- | libfdt/version.lds | 3 | ||||
-rw-r--r-- | tests/Makefile.tests | 6 | ||||
-rwxr-xr-x | tests/run_tests.sh | 3 |
6 files changed, 17 insertions, 7 deletions
@@ -184,7 +184,7 @@ endif # LIBFDT_dir = libfdt LIBFDT_archive = $(LIBFDT_dir)/libfdt.a -LIBFDT_lib = $(LIBFDT_dir)/libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT) +LIBFDT_lib = $(LIBFDT_dir)/$(LIBFDT_LIB) LIBFDT_include = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_INCLUDES)) LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION)) @@ -199,6 +199,7 @@ $(LIBFDT_lib): $(addprefix $(LIBFDT_dir)/,$(LIBFDT_OBJS)) $(LIBFDT_version) @$(VECHO) LD $@ $(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS)$(LIBFDT_soname) -o $(LIBFDT_lib) \ $(addprefix $(LIBFDT_dir)/,$(LIBFDT_OBJS)) + ln -s $(LIBFDT_LIB) $(LIBFDT_dir)/$(LIBFDT_soname) ifneq ($(DEPTARGETS),) -include $(LIBFDT_OBJS:%.o=$(LIBFDT_dir)/%.d) @@ -250,11 +251,11 @@ convert-dtsv0: $(CONVERT_OBJS) fdtdump: $(FDTDUMP_OBJS) -fdtget: $(FDTGET_OBJS) $(LIBFDT_archive) +fdtget: $(FDTGET_OBJS) $(LIBFDT_lib) -fdtput: $(FDTPUT_OBJS) $(LIBFDT_archive) +fdtput: $(FDTPUT_OBJS) $(LIBFDT_lib) -fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_archive) +fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_lib) dist: git archive --format=tar --prefix=dtc-$(dtc_version)/ HEAD \ diff --git a/libfdt/.gitignore b/libfdt/.gitignore new file mode 100644 index 0000000..fed4603 --- /dev/null +++ b/libfdt/.gitignore @@ -0,0 +1 @@ +libfdt.so.1 diff --git a/libfdt/Makefile.libfdt b/libfdt/Makefile.libfdt index 3af3656..193da8c 100644 --- a/libfdt/Makefile.libfdt +++ b/libfdt/Makefile.libfdt @@ -9,7 +9,9 @@ LIBFDT_VERSION = version.lds LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c \ fdt_addresses.c fdt_overlay.c LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) +LIBFDT_LIB = libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT) libfdt_clean: @$(VECHO) CLEAN "(libfdt)" rm -f $(STD_CLEANFILES:%=$(LIBFDT_dir)/%) + rm -f $(LIBFDT_dir)/$(LIBFDT_soname) diff --git a/libfdt/version.lds b/libfdt/version.lds index fbee212..9a92652 100644 --- a/libfdt/version.lds +++ b/libfdt/version.lds @@ -71,6 +71,9 @@ LIBFDT_1.2 { fdt_check_full; fdt_setprop_placeholder; fdt_property_placeholder; + fdt_header_size_; + fdt_appendprop_addrrange; + fdt_setprop_inplace_namelen_partial; local: *; }; diff --git a/tests/Makefile.tests b/tests/Makefile.tests index b77f121..1f8feed 100644 --- a/tests/Makefile.tests +++ b/tests/Makefile.tests @@ -58,17 +58,17 @@ TESTS_CLEANDIRS = $(TESTS_CLEANDIRS_L:%=$(TESTS_PREFIX)%) .PHONY: tests tests: $(TESTS) $(TESTS_TREES) -$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive) +$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_lib) # Not necessary on all platforms; allow -ldl to be excluded instead of forcing # other platforms to patch it out. LIBDL = -ldl -$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive) +$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_lib) @$(VECHO) LD [libdl] $@ $(LINK.c) -o $@ $^ $(LIBDL) $(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o \ - util.o $(LIBFDT_archive) + util.o $(LIBFDT_lib) $(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o diff --git a/tests/run_tests.sh b/tests/run_tests.sh index e951959..489a3d2 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -18,6 +18,9 @@ if [ -z "$STATSZ" ]; then fi fi +# Help things find the libfdt shared object +export LD_LIBRARY_PATH=../libfdt + export QUIET_TEST=1 STOP_ON_FAIL=0 |