From: stephan Date: Sun, 23 Feb 2025 17:24:55 +0000 (+0000) Subject: Internal cleanups to how certain linker flags are tested. X-Git-Tag: major-release~242^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b90beebd5dcdb6c2487f803989567584f16f3cb;p=thirdparty%2Fsqlite.git Internal cleanups to how certain linker flags are tested. FossilOrigin-Name: 6743e3e5b87f1d2308ec8cebef3c7ecccddafdace107630e0d8feee2b089d105 --- diff --git a/Makefile.in b/Makefile.in index b836bf5d3d..7926aa84dd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,7 +79,7 @@ libdir = @libdir@ INSTALL = @BIN_INSTALL@ AR = @AR@ -AR.flags = cr # TODO? Add a configure test to determine this? +AR.flags = cr CC = @CC@ B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@ T.cc = $(CC) @@ -129,6 +129,7 @@ LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@ libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@ # DLL.basename: see https://sqlite.org/forum/forumpost/828fdfe904 libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@ +# libsqlite3.out.implib => the output filename part of LDFLAGS_OUT_IMPLIB. ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@ ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@ HAVE_WASI_SDK = @HAVE_WASI_SDK@ diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index edd1b03351..94e940a72d 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -941,6 +941,35 @@ proc proj-check-emsdk {} { return $rc } +######################################################################## +# @proj-cc-check-Wl-flag ?flag ?args?? +# +# Checks whether the given linker flag (and optional arguments) can be +# passed from the compiler to the linker using one of these formats: +# +# - -Wl,flag[,arg1[,...argN]] +# - -Wl,flag -Wl,arg1 ...-Wl,argN +# +# If so, that flag string is returned, else an empty string is +# returned. +proc proj-cc-check-Wl-flag {args} { + cc-with {-link 1} { + # Try -Wl,flag,...args + set fli "-Wl" + foreach f $args { append fli ",$f" } + if {[cc-check-flags $fli]} { + return $fli + } + # Try -Wl,flag -Wl,arg1 ...-Wl,argN + set fli "" + foreach f $args { append fli "-Wl,$f " } + if {[cc-check-flags $fli]} { + return [string trim $fli] + } + return "" + } +} + ######################################################################## # @proj-check-rpath # @@ -966,14 +995,12 @@ proc proj-check-rpath {} { cc-with {-link 1} { if {[cc-check-flags "-rpath $lp"]} { define LDFLAGS_RPATH "-rpath $lp" - } elseif {[cc-check-flags "-Wl,-rpath,$lp"]} { - define LDFLAGS_RPATH "-Wl,-rpath,$lp" - } elseif {[cc-check-flags "-Wl,-rpath -Wl,$lp"]} { - define LDFLAGS_RPATH "-Wl,-rpath -Wl,$lp" - } elseif {[cc-check-flags -Wl,-R$lp]} { - define LDFLAGS_RPATH "-Wl,-R$lp" } else { - define LDFLAGS_RPATH "" + set wl [proj-cc-check-Wl-flag -rpath $lp] + if {"" eq $wl} { + set wl [proj-cc-check-Wl-flag -R$lp] + } + define LDFLAGS_RPATH $wl } } expr {"" ne [get-define LDFLAGS_RPATH]} @@ -1219,11 +1246,11 @@ proc proj-which-linenoise {dotH} { # # In that make invocation, $(libdir) would, at make-time, normally be # hard-coded to /foo/lib, rather than /blah/lib. That happens because -# the autosetup exports conventional $prefix-based values for the -# numerous autoconfig-compatible XYZdir vars at configure-time. What -# we would normally want, however, is that --libdir derives from the -# make-time $(prefix). The distinction between configure-time and -# make-time is the significant factor there. +# autosetup exports conventional $prefix-based values for the numerous +# autoconfig-compatible XYZdir vars at configure-time. What we would +# normally want, however, is that --libdir derives from the make-time +# $(prefix). The distinction between configure-time and make-time is +# the significant factor there. # # This function attempts to reconcile those vars in such a way that # they will derive, at make-time, from $(prefix) in a conventional diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index e2e99ef234..a0e197be74 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -1325,8 +1325,8 @@ proc sqlite-handle-out-implib {} { if {$olBaseName ne "none"} { cc-with {-link 1} { set dll "${olBaseName}[get-define TARGET_DLLEXT]" - set flags "-Wl,--out-implib,${dll}.a" - if {[cc-check-flags $flags]} { + set flags [proj-cc-check-Wl-flag --out-implib ${dll}.a] + if {"" ne $flags} { define LDFLAGS_OUT_IMPLIB $flags define SQLITE_OUT_IMPLIB ${dll}.a set rc 1 diff --git a/main.mk b/main.mk index 839d29af9e..e83f354de7 100644 --- a/main.mk +++ b/main.mk @@ -1068,7 +1068,8 @@ libsqlite3.DLL = $(libsqlite3.DLL.basename)$(T.dll) # libsqlite3.out.implib => "import library" file generated by the # --out-implib linker flag. Not commonly used on Unix systems but is # on the Windows-side Unix-esque environments and typically as a value -# of "libsqlite3.dll.a". +# of "libsqlite3.dll.a". It is expected to match the filename, if any, +# provided by the -Wl,--out-implib,FILENAME flag. # libsqlite3.out.implib ?= # diff --git a/manifest b/manifest index e96c6d43b2..b729d4efc7 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Internal\sconfigure\sdoc\scleanups.\sApply\sthe\s[5ecbe7ddc4]\sunix-on-windows\sDLL\sinstall\sdir\sfix\sto\sthe\scanonical\sbuild. -D 2025-02-23T15:34:05.604 +C Internal\scleanups\sto\show\scertain\slinker\sflags\sare\stested. +D 2025-02-23T17:24:55.929 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 18fe2ad1e0da1fc98843d53c48a5ee7e180eacccdae532e1bad9f95d4fabde7d +F Makefile.in 4ff9b301b59c66ef9d11c8d133cc62e09173bad4abc7d5eb801e45d5527f8fe6 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc 50c656e096ae49ccf9e5e88b4995f0a155f231ebae5b6d185cc64ce99d728a83 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -49,8 +49,8 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 9b5d7b984cbbbdcc5388a80cd3f8149c79fe135a69f6ef067dbce5cae6edcc77 -F autosetup/sqlite-config.tcl caf7f974d69b90fd6d53f6ffaae4fb468e9f44d4b23764fd8245b9ba36f64bb9 +F autosetup/proj.tcl cc300c15633cb2835eb52c235c5abfd2de0e8e989e9b650e82df3c1d3b856d22 +F autosetup/sqlite-config.tcl 6e25eed0ccf045d3593b18dab090bc6c9c787d966499c37561087733f91c7d5f F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -705,7 +705,7 @@ F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36 F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 4be69e88cfe2fb9091a07ad5debaaac7bf15fcbd373ade62146440606aa42344 +F main.mk 2c93ed0030ef1a3ac2c7e40d619ae46771556b396bf5f9b0abac445a8026b3cb F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2210,8 +2210,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f2e7355d87450f9a4d98390cf9d830e9902105048f9308e02c597190ecf2a594 -R fffbf6acb18ecfeac90b7b2e01746be5 +P 51b9812df9087ec0aa7656178a069ddf2d60dcffa5ab0de57a84bd412b2f71c7 +R 15336fe4227f08479deb26ef0e52e0d5 U stephan -Z 91c7527af047fb17603dad8a953d6c86 +Z d5c8e4d30229fa6cfc71221c7f3f2246 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4d0f7f6be2..b2825f915f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -51b9812df9087ec0aa7656178a069ddf2d60dcffa5ab0de57a84bd412b2f71c7 +6743e3e5b87f1d2308ec8cebef3c7ecccddafdace107630e0d8feee2b089d105