[PATCH v2] jit: set JIT_LDFLAGS for MinGW [PR125229]
Zhongteng Gui
dragon-archer@outlook.com
Thu Oct 8 17:58:46 GMT 2026
Changes since v1:
- Seperate conditions for JIT_LDFLAGS and LIBGCCJIT_EXTRA_OPTS, as suggested by Jonathan.
- Fixed a bug in v1: when host is Darwin and target is MinGW, existing special handling for
JIT_LDFLAGS on Darwin hosts will also be effective.
---
>From 67555815a16ef23ba491df2451015bd1fcc20579 Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <dragon-archer@outlook.com>
Date: Fri, 9 Oct 2026 01:51:20 +0800
Subject: [PATCH v2] jit: Set JIT_LDFLAGS for MinGW [PR125229]
JIT_LDFLAGS is not set in the MinGW branch, so user-supplied LDFLAGS
are ignored when linking libgccjit. This can cause build failures
when those flags are required.
Separate the JIT_LDFLAGS conditional from the LIBGCCJIT_EXTRA_OPTS
conditional to make the platform-specific handling clearer. Use
LDFLAGS for non-Darwin hosts and apply the existing Darwin-specific
adjustments based on the host, independently of the target.
gcc/jit/ChangeLog:
PR jit/125229
* Make-lang.in (JIT_LDFLAGS): Define in a separate host-based
conditional, using LDFLAGS for non-Darwin hosts.
Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com>
---
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 eb1c9966062..476a82ea708 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -153,6 +153,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)
@@ -162,13 +172,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
--
2.56.0.windows.2
More information about the Jit
mailing list