https://gcc.gnu.org/g:2577be489a992edfc4e5987cc2c85111f401762c
commit r17-5017-g2577be489a992edfc4e5987cc2c85111f401762c Author: Zhongteng Gui <[email protected]> Date: Fri Oct 9 01:58:46 2026 +0800 jit: set JIT_LDFLAGS for MinGW [PR125229] On any other platforms except MinGW, JIT_LDFLAGS is set to LDFLAGS, so that user defined LDFLAGS can be used when building JIT. But for MinGW, JIT_LDFLAGS is not set, which causes build failure when user defined LDFLAGS is required. gcc/jit/ChangeLog: PR jit/125229 * Make-lang.in: Seperate conditions for JIT_LDFLAGS and LIBGCCJIT_EXTRA_OPTS, fixed special condition where host is Darwin and target is MinGW, existing special handling for JIT_LDFLAGS on Darwin hosts will also be effective. Signed-off-by: Zhongteng Gui <[email protected]> Signed-off-by: Jonathan Yong <[email protected]> Diff: --- gcc/jit/Make-lang.in | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in index 3c13448d9bc6..cdcf19c933c3 100644 --- a/gcc/jit/Make-lang.in +++ b/gcc/jit/Make-lang.in @@ -154,6 +154,16 @@ jit_OBJS = $(JIT_OBJS) $(JIT_TARGET_OBJS) # Use strict warnings for this front end. jit-warn = $(STRICT_WARN) +ifneq (,$(findstring darwin,$(host))) +# Use the default (shared) libgcc. +JIT_LDFLAGS = $(filter-out -static-libgcc, $(LDFLAGS)) +ifeq (,$(findstring darwin8,$(host))) +JIT_LDFLAGS += -Wl,-rpath,@loader_path +endif +else +JIT_LDFLAGS = $(LDFLAGS) +endif + ifneq (,$(findstring mingw,$(target))) # Create import library LIBGCCJIT_EXTRA_OPTS = -Wl,--out-implib,$(LIBGCCJIT_IMPORT_LIB) @@ -163,13 +173,7 @@ LIBGCCJIT_VERS = $(LIBGCCJIT_CURRENT).$(LIBGCCJIT_REVISION).$(LIBGCCJIT_AGE) LIBGCCJIT_EXTRA_OPTS = -Wl,-current_version,$(LIBGCCJIT_VERS) \ -Wl,-compatibility_version,$(LIBGCCJIT_COMPAT) \ $(LIBGCCJIT_VERSION_SCRIPT_OPTION) $(LIBGCCJIT_SONAME_OPTION) -# Use the default (shared) libgcc. -JIT_LDFLAGS = $(filter-out -static-libgcc, $(LDFLAGS)) -ifeq (,$(findstring darwin8,$(host))) -JIT_LDFLAGS += -Wl,-rpath,@loader_path -endif else -JIT_LDFLAGS = $(LDFLAGS) LIBGCCJIT_EXTRA_OPTS = $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \ $(LIBGCCJIT_SONAME_OPTION) endif
