Browse Source

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>
main
David Gibson 6 years ago
parent
commit
5c3513f689
  1. 9
      Makefile
  2. 1
      libfdt/.gitignore
  3. 2
      libfdt/Makefile.libfdt
  4. 3
      libfdt/version.lds
  5. 6
      tests/Makefile.tests
  6. 3
      tests/run_tests.sh

9
Makefile

@ -184,7 +184,7 @@ endif
# #
LIBFDT_dir = libfdt LIBFDT_dir = libfdt
LIBFDT_archive = $(LIBFDT_dir)/libfdt.a 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_include = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_INCLUDES))
LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION)) LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION))


@ -199,6 +199,7 @@ $(LIBFDT_lib): $(addprefix $(LIBFDT_dir)/,$(LIBFDT_OBJS)) $(LIBFDT_version)
@$(VECHO) LD $@ @$(VECHO) LD $@
$(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS)$(LIBFDT_soname) -o $(LIBFDT_lib) \ $(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS)$(LIBFDT_soname) -o $(LIBFDT_lib) \
$(addprefix $(LIBFDT_dir)/,$(LIBFDT_OBJS)) $(addprefix $(LIBFDT_dir)/,$(LIBFDT_OBJS))
ln -s $(LIBFDT_LIB) $(LIBFDT_dir)/$(LIBFDT_soname)


ifneq ($(DEPTARGETS),) ifneq ($(DEPTARGETS),)
-include $(LIBFDT_OBJS:%.o=$(LIBFDT_dir)/%.d) -include $(LIBFDT_OBJS:%.o=$(LIBFDT_dir)/%.d)
@ -250,11 +251,11 @@ convert-dtsv0: $(CONVERT_OBJS)


fdtdump: $(FDTDUMP_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: dist:
git archive --format=tar --prefix=dtc-$(dtc_version)/ HEAD \ git archive --format=tar --prefix=dtc-$(dtc_version)/ HEAD \

1
libfdt/.gitignore vendored

@ -0,0 +1 @@
libfdt.so.1

2
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 \ 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 fdt_addresses.c fdt_overlay.c
LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
LIBFDT_LIB = libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT)


libfdt_clean: libfdt_clean:
@$(VECHO) CLEAN "(libfdt)" @$(VECHO) CLEAN "(libfdt)"
rm -f $(STD_CLEANFILES:%=$(LIBFDT_dir)/%) rm -f $(STD_CLEANFILES:%=$(LIBFDT_dir)/%)
rm -f $(LIBFDT_dir)/$(LIBFDT_soname)

3
libfdt/version.lds

@ -71,6 +71,9 @@ LIBFDT_1.2 {
fdt_check_full; fdt_check_full;
fdt_setprop_placeholder; fdt_setprop_placeholder;
fdt_property_placeholder; fdt_property_placeholder;
fdt_header_size_;
fdt_appendprop_addrrange;
fdt_setprop_inplace_namelen_partial;
local: local:
*; *;
}; };

6
tests/Makefile.tests

@ -58,17 +58,17 @@ TESTS_CLEANDIRS = $(TESTS_CLEANDIRS_L:%=$(TESTS_PREFIX)%)
.PHONY: tests .PHONY: tests
tests: $(TESTS) $(TESTS_TREES) 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 # Not necessary on all platforms; allow -ldl to be excluded instead of forcing
# other platforms to patch it out. # other platforms to patch it out.
LIBDL = -ldl 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] $@ @$(VECHO) LD [libdl] $@
$(LINK.c) -o $@ $^ $(LIBDL) $(LINK.c) -o $@ $^ $(LIBDL)


$(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o \ $(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 $(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o



3
tests/run_tests.sh

@ -18,6 +18,9 @@ if [ -z "$STATSZ" ]; then
fi fi
fi fi


# Help things find the libfdt shared object
export LD_LIBRARY_PATH=../libfdt

export QUIET_TEST=1 export QUIET_TEST=1
STOP_ON_FAIL=0 STOP_ON_FAIL=0



Loading…
Cancel
Save