diff --git a/Makefile b/Makefile index 83d8220..c9dc5eb 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ else CFLAGS += $(shell $(PKG_CONFIG) --cflags yaml-0.1) endif -HAS_VERSION_SCRIPT := $(shell echo 'int main(){}' | $(CC) -Wl,--version-script=/dev/null -x c - -o /dev/null 2>/dev/null && echo y) +HAS_VERSION_SCRIPT := $(shell printf 'void test_func(){}\nint main(){}' | $(CC) -Wl,--version-script=libfdt/test.lds -x c - && echo y || echo n) ifeq ($(HOSTOS),darwin) SHAREDLIB_EXT = dylib diff --git a/libfdt/meson.build b/libfdt/meson.build index 68d4c1d..46a5b3a 100644 --- a/libfdt/meson.build +++ b/libfdt/meson.build @@ -1,5 +1,6 @@ version_script = '-Wl,--version-script=@0@'.format(meson.current_source_dir() / 'version.lds') -if not cc.has_link_argument(version_script) +test_code = 'void test_func(){} int main(){}' +if not cc.links(test_code, args: ['-Wl,--version-script=' + meson.current_source_dir() / 'test.lds']) version_script = [] endif diff --git a/libfdt/test.lds b/libfdt/test.lds new file mode 100644 index 0000000..2e7b5d6 --- /dev/null +++ b/libfdt/test.lds @@ -0,0 +1,6 @@ +TEST { + global: + test_func; + local: + *; +}; \ No newline at end of file