mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 08:17:40 -04:00
build: Fix linker version script support detection
The tests for linker version script support were incorrect in both make and meson build systems. The problem was that the script needs to match the object it's used with, whereas the tests used dummy objects with no matching symbols. Updated both systems to test with proper symbol matching between the test object and version script using a dedicated test.lds file. Generated-by: Claude Code 1.0.65 (claude-sonnet-4@20250514)
This commit is contained in:
parent
617f3d9b60
commit
28bdb653cb
3 changed files with 9 additions and 2 deletions
2
Makefile
2
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
6
libfdt/test.lds
Normal file
6
libfdt/test.lds
Normal file
|
@ -0,0 +1,6 @@
|
|||
TEST {
|
||||
global:
|
||||
test_func;
|
||||
local:
|
||||
*;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue