Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195760/?format=api
{ "id": 2195760, "url": "http://patchwork.ozlabs.org/api/patches/2195760/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260211191928.988805-3-adhemerval.zanella@linaro.org/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api", "name": "GNU C Library", "link_name": "glibc", "list_id": "libc-alpha.sourceware.org", "list_email": "libc-alpha@sourceware.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260211191928.988805-3-adhemerval.zanella@linaro.org>", "list_archive_url": null, "date": "2026-02-11T18:55:29", "name": "[2/5] configure: Parametrize runtime libraries to support compiler-rt", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "1f4c253991b00ed94a3229cebc2a1e8ae64c9841", "submitter": { "id": 66065, "url": "http://patchwork.ozlabs.org/api/people/66065/?format=api", "name": "Adhemerval Zanella", "email": "adhemerval.zanella@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20260211191928.988805-3-adhemerval.zanella@linaro.org/mbox/", "series": [ { "id": 491898, "url": "http://patchwork.ozlabs.org/api/series/491898/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=491898", "date": "2026-02-11T18:55:31", "name": "Enable glibc build with LLVM compiler-rt and libunwind", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491898/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2195760/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195760/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "libc-alpha@sourceware.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "libc-alpha@sourceware.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=qt6F6evk;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=qt6F6evk", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=linaro.org", "sourceware.org; spf=pass smtp.mailfrom=linaro.org", "server2.sourceware.org;\n arc=none smtp.remote-ip=2607:f8b0:4864:20::b130" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fB7cB3J5bz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 12 Feb 2026 06:22:34 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 68DB04BA23D0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 11 Feb 2026 19:22:32 +0000 (GMT)", "from mail-yx1-xb130.google.com (mail-yx1-xb130.google.com\n [IPv6:2607:f8b0:4864:20::b130])\n by sourceware.org (Postfix) with ESMTPS id D8C794BA2E12\n for <libc-alpha@sourceware.org>; Wed, 11 Feb 2026 19:19:39 +0000 (GMT)", "by mail-yx1-xb130.google.com with SMTP id\n 956f58d0204a3-64ad62a294bso4958609d50.1\n for <libc-alpha@sourceware.org>; Wed, 11 Feb 2026 11:19:39 -0800 (PST)", "from mandiga.. ([2804:1b3:a7c2:42d3:8bd2:a06b:9b74:4887])\n by smtp.gmail.com with ESMTPSA id\n 956f58d0204a3-64afc9b5932sm2786042d50.21.2026.02.11.11.19.36\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 11 Feb 2026 11:19:38 -0800 (PST)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 68DB04BA23D0", "OpenDKIM Filter v2.11.0 sourceware.org D8C794BA2E12" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org D8C794BA2E12", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org D8C794BA2E12", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770837580; cv=none;\n b=prRw3w8YyH355bXhGTYm25aJvass8g1GxgL82MzsbWlRj0mpDz8AJtglgoVypg6VxvgU5qWQ1QfKP/m9ZUqUij0LrfavWZH3yv7SC3qRL87TDRdRpu/908bm71ilb8myHx7oOiqdhELihHAeNorZY9qo4hkjvoUAQEDVjlYX14I=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770837580; c=relaxed/simple;\n bh=P9VJMB8hl8z2c2lo7+LghVeNAAaWtyO7I8wGdoEZ9dA=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=oYW/IXar9tJHDYGy8V6bLwsvxwA/7x9cse9F0XVHuvzWRsvzN/J5fos//r0CDXFCYYnEm44FEsjVJDmJ1aWuKDQ4Vo3evE84yBMMQLI3fExFTIqchdem1WMqsoZvu++1bvUlKK60+glkTMCG4Rxz2A6U9lVPLm9XkCxZX4TGHjI=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1770837579; x=1771442379; darn=sourceware.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=xvvt0v9UlFx2HqNLMA643I46ttgn3zvktgcDTKbtmek=;\n b=qt6F6evkYwKGQCkmnnmEskhmd9/HWLnWMd1M35jnRcYX6j5Sq3ZVpfVTq+zvkMKt2M\n 9AwRRP699Xi3WWhHboDnfmoW/5xMxZF5J1a+2GYnr2P0D9GKGMzd3e+AoN7AQ/v2a6JO\n 2cZtb9VWnER/tzu3zBf80gxoAFbCUl/HIz3Oblp+9ORYrwK9PxKRokcRtANw6zK5InT5\n u7DMwl2fMSLgxbsre4L1hIqCcG4HYOxXWDuzZqYRprCLE0vd8GEVGUAdlqdkkT2hGMJq\n 2ohLHT7ZU1iJduMDJ2SCB1k9C6FfsK7dY0dMU3gvkKV7+1e7SMKYuvuyDHXxv0P3FXcT\n MFiA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770837579; x=1771442379;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=xvvt0v9UlFx2HqNLMA643I46ttgn3zvktgcDTKbtmek=;\n b=YTGeq3blKeC/Hl9IvATeq3lrioOuBQLMqCDraGAeRfgxaH3QTC2TIMtJfHf0Ws22sM\n /v/fCERQeEEgm9hTCjUgBYl+7JEVIE9GfMH+habO9bx53hbCZgZcV3BbzndFnwNGJM4d\n O3xA/RpX5Ai2OXyKKPHyeOpjbRfFmoEppl6SS2GDn25HFqyT23hrSBaxwXnjraBBocWb\n kZ01iwmUjDw2oJl5J84ceLesLUCbd7ASHJJM/Grgm0rJdHis9dXmMwZSQzDvcrcqZGam\n BmEY/1QFpxnxv0XLe311DTQhKkHUv9peAhbQWZaEU34LGBhTIztL5Ryb8kPR66QxCSyh\n B+/w==", "X-Gm-Message-State": "AOJu0YyrYAlNkcOFr/TaXlH81/EkzsiIrUEvJkkp9ozCBiV/BwIBY6IT\n qUuzrj81VPfFc0Fb2rBeGO0ptMKjM9NBqbL+3m0+7ZKdwEdJN7b+zoN3h9HGs2NPcdTljlCWf1u\n bRpPJqRc=", "X-Gm-Gg": "AZuq6aI+XhSM/ruTz9CkueHN0pHZlZZsaQyhJicKu4VoZs2xIWzdlaciPxqvsjMVM5e\n 0RB3DaoBgWdNbsh+s/MoFc9RohA0vo30CVody7mha+fy6NggfqHYleaAy4gi5Zt0XzZgH6TdpX1\n uOjOi5doKRv1I18neU0gzhd1S9uYvqahK/QhqcvDbvyJ4IDQWcjs0NxGjpR2piYjHB4B3ezHSKl\n wQk0mBSQ64jkftd5kIa9iBuAVNh8DLfMEwH8hgkpubsE5Uyf9//5YZaAmzQR2+E4bC2SWdIEPW1\n sSujtfsm+7aYvYrjmDfdLGoaZhN8kuyKOASt2Ti57cm4/m/xGrVH5MPyPset+OdzRpndlOXCZco\n kpNGZC1Qv4KGb69vsCPptbQWdykR+4gq41Igusu8aA8F1VtknjkyxxhvKrK5iq9OseoWFLXL0zq\n 3iFNocIxTExg8KbVkk0vZZXoY47vbhEDHMxzw=", "X-Received": "by 2002:a05:690e:4249:b0:649:e440:26a5 with SMTP id\n 956f58d0204a3-64bbaa2805dmr278567d50.15.1770837578722;\n Wed, 11 Feb 2026 11:19:38 -0800 (PST)", "From": "Adhemerval Zanella <adhemerval.zanella@linaro.org>", "To": "libc-alpha@sourceware.org", "Cc": "Sam James <sam@gentoo.org>, Collin Funk <collin.funk1@gmail.com>,\n \"H . J . Lu\" <hjl.tools@gmail.com>", "Subject": "[PATCH 2/5] configure: Parametrize runtime libraries to support\n compiler-rt", "Date": "Wed, 11 Feb 2026 15:55:29 -0300", "Message-ID": "<20260211191928.988805-3-adhemerval.zanella@linaro.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260211191928.988805-1-adhemerval.zanella@linaro.org>", "References": "<20260211191928.988805-1-adhemerval.zanella@linaro.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libc-alpha@sourceware.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Libc-alpha mailing list <libc-alpha.sourceware.org>", "List-Unsubscribe": "<https://sourceware.org/mailman/options/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe>", "List-Archive": "<https://sourceware.org/pipermail/libc-alpha/>", "List-Post": "<mailto:libc-alpha@sourceware.org>", "List-Help": "<mailto:libc-alpha-request@sourceware.org?subject=help>", "List-Subscribe": "<https://sourceware.org/mailman/listinfo/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>", "Errors-To": "libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org" }, "content": "Historically, the build system has hardcoded references to `-lgcc` and\n`-lgcc_eh`, explicitly assuming the use of the GCC runtime. This\nprevents building glibc with alternative toolchains, specifically clang\nconfigured with `--rtlib=compiler-rt`, where these libraries are\nreplaced by `libclang_rt.builtins`.\n\nThis patch introduces a mechanism to dynamically detect the compiler's\nunderlying runtime library.\n\nThe logic works as follows:\n1. It queries the compiler using `-print-libgcc-file-name`.\n2. It parses the output path to determine if `libgcc` or `compiler-rt`\n is in use.\n3. Based on this detection, it parametrizes the build variables for\n the static runtime and exception handling libraries (replacing\n hardcoded `-lgcc` and `-lgcc_eh`).\n\nThis ensures that the build system correctly links against the active\ncompiler runtime—whether it is the traditional libgcc or LLVM's\ncompiler-rt—without requiring manual overrides.\n---\n Makeconfig | 12 ++++++------\n configure | 33 +++++++++++++++++++++++++++++++++\n configure.ac | 19 +++++++++++++++++++\n dlfcn/Makefile | 2 +-\n elf/Makefile | 4 ++--\n support/Makefile | 4 ++--\n 6 files changed, 63 insertions(+), 11 deletions(-)", "diff": "diff --git a/Makeconfig b/Makeconfig\nindex 01d02180b9..6a05e1d973 100644\n--- a/Makeconfig\n+++ b/Makeconfig\n@@ -716,20 +716,20 @@ else\n endif\n libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed\n gnulib-arch =\n-gnulib = -lgcc $(gnulib-arch)\n-gnulib-tests := -lgcc $(libgcc_eh)\n+gnulib = $(libgcc-name) $(gnulib-arch)\n+gnulib-tests := $(libgcc-name) $(libgcc_eh)\n gnulib-extralibdir = $(dir $(shell $(CC) -print-file-name=libgcc_s.so$(libgcc_s.so-version)))\n static-gnulib-arch =\n # By default, elf/static-stubs.o, instead of -lgcc_eh, is used to\n # statically link programs. When --disable-shared is used, we use\n # -lgcc_eh since elf/static-stubs.o isn't sufficient.\n ifeq (yes,$(build-shared))\n-static-gnulib = -lgcc $(static-gnulib-arch)\n+static-gnulib = $(libgcc-name) $(static-gnulib-arch)\n else\n-static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch)\n+static-gnulib = $(libgcc-name) $(libgcc_eh-name) $(static-gnulib-arch)\n endif\n-static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)\n-libc.so-gnulib := -lgcc\n+static-gnulib-tests := $(libgcc-name) $(libgcc_eh-name) $(libunwind)\n+libc.so-gnulib := $(libgcc-name)\n endif\n +preinit = $(addprefix $(csu-objpfx),crti.o)\n +postinit = $(addprefix $(csu-objpfx),crtn.o)\ndiff --git a/configure b/configure\nindex 2b9425232e..60103b8068 100755\n--- a/configure\n+++ b/configure\n@@ -9368,6 +9368,39 @@ printf \"%s\\n\" \"$libc_cv_have_libgcc_s\" >&6; }\n config_vars=\"$config_vars\n have-libgcc_s = $libc_cv_have_libgcc_s\"\n \n+# Check which runtime library compiler uses\n+{ printf \"%s\\n\" \"$as_me:${as_lineno-$LINENO}: checking for the usable compiler runtime library\" >&5\n+printf %s \"checking for the usable compiler runtime library... \" >&6; }\n+if test ${libc_cv_libgcc_usable+y}\n+then :\n+ printf %s \"(cached) \" >&6\n+else case e in #(\n+ e) libc_cv_libgcc_usable=no\n+ libgcc_name=`${CC-cc} $CFLAGS $CPPFLAGS -print-libgcc-file-name | sed 's:.*/::'`\n+ case \"$libgcc_name\" in\n+ libgcc*)\n+ libc_cv_libgcc=-lgcc\n+ libc_cv_libgcc_eh=-lgcc_eh\n+ ;;\n+ libclang_rt*)\n+ libc_cv_libgcc=-lclang_rt.builtins\n+ libc_cv_libgcc_eh=\n+ ;;\n+ *) { { printf \"%s\\n\" \"$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':\" >&5\n+printf \"%s\\n\" \"$as_me: error: in '$ac_pwd':\" >&2;}\n+as_fn_error $? \"non supported compiler runtime library\n+See 'config.log' for more details\" \"$LINENO\" 5; } ;;\n+ esac\n+ libc_cv_libgcc_usable=yes ;;\n+esac\n+fi\n+{ printf \"%s\\n\" \"$as_me:${as_lineno-$LINENO}: result: $libc_cv_libgcc_usable\" >&5\n+printf \"%s\\n\" \"$libc_cv_libgcc_usable\" >&6; }\n+config_vars=\"$config_vars\n+libgcc-name = $libc_cv_libgcc\"\n+config_vars=\"$config_vars\n+libgcc_eh-name = $libc_cv_libgcc_eh\"\n+\n # Check if compiler runtime library provides __sfp_handle_exceptions\n \n { printf \"%s\\n\" \"$as_me:${as_lineno-$LINENO}: checking for __sfp_handle_exceptions support\" >&5\ndiff --git a/configure.ac b/configure.ac\nindex 39d32ecf7f..add61dd826 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -2134,6 +2134,25 @@ AC_CACHE_CHECK([whether $CC can link against -lgcc_s], libc_cv_have_libgcc_s, [d\n LIBS=\"$old_LIBS\"])\n LIBC_CONFIG_VAR([have-libgcc_s], [$libc_cv_have_libgcc_s])\n \n+# Check which runtime library compiler uses\n+AC_CACHE_CHECK([for the usable compiler runtime library], [libc_cv_libgcc_usable], [dnl\n+ libc_cv_libgcc_usable=no\n+ libgcc_name=`${CC-cc} $CFLAGS $CPPFLAGS -print-libgcc-file-name | sed 's:.*/::'`\n+ case \"$libgcc_name\" in\n+ libgcc*)\n+ libc_cv_libgcc=-lgcc\n+ libc_cv_libgcc_eh=-lgcc_eh\n+ ;;\n+ libclang_rt*)\n+ libc_cv_libgcc=-lclang_rt.builtins\n+ libc_cv_libgcc_eh=\n+ ;;\n+ *) AC_MSG_FAILURE([non supported compiler runtime library]) ;;\n+ esac\n+ libc_cv_libgcc_usable=yes])\n+LIBC_CONFIG_VAR([libgcc-name], [$libc_cv_libgcc])\n+LIBC_CONFIG_VAR([libgcc_eh-name], [$libc_cv_libgcc_eh])\n+\n # Check if compiler runtime library provides __sfp_handle_exceptions\n LIBC_TRY_CC_AND_TEST_LINK([for __sfp_handle_exceptions support],\n [void __sfp_handle_exceptions (int); __sfp_handle_exceptions (0)],\ndiff --git a/dlfcn/Makefile b/dlfcn/Makefile\nindex 14de193ab8..00341dd476 100644\n--- a/dlfcn/Makefile\n+++ b/dlfcn/Makefile\n@@ -187,7 +187,7 @@ $(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so\n $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so\n \n ifneq (,$(CXX))\n-LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh\n+LDLIBS-bug-atexit3-lib.so = -lstdc++ $(libgcc_eh)\n $(objpfx)bug-atexit3-lib.so: $(libsupport)\n $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so\n endif\ndiff --git a/elf/Makefile b/elf/Makefile\nindex 396e97b5e7..3782045d06 100644\n--- a/elf/Makefile\n+++ b/elf/Makefile\n@@ -1519,7 +1519,7 @@ $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a\n \t\techo \".globl $$symbol\"; \\\n \t\techo \"$$symbol:\"; \\\n \tdone | $(CC) -o $@T.o $(ASFLAGS) -c -x assembler -\n-\t$(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T\n+\t$(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ $(gnulib) '-Wl,-)' -Wl,-Map,$@T\n \trm -f %@T.o $@.o\n \tmv -f $@T $@\n \n@@ -1549,7 +1549,7 @@ $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE\n \t$(MAKE) -f $< -f rtld-Rules\n \n $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a\n-\t$(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \\\n+\t$(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ $(gnulib) '-Wl,-)' \\\n \t\t -Wl,-Map,$@.map\n \n generated += librtld.map librtld.mk rtld-libc.a librtld.os.map\ndiff --git a/support/Makefile b/support/Makefile\nindex bd60466ad0..4c36f45129 100644\n--- a/support/Makefile\n+++ b/support/Makefile\n@@ -296,14 +296,14 @@ CFLAGS-temp_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64\n \n ifeq (,$(CXX))\n LINKS_DSO_PROGRAM = links-dso-program-c\n-LDLIBS-links-dso-program-c = -lgcc\n+LDLIBS-links-dso-program-c = $(gnulib)\n ifeq ($(have-libgcc_s),yes)\n CFLAGS-links-dso-program-c.c += -fexceptions\n LDLIBS-links-dso-program-c += -lgcc_s $(libunwind)\n endif\n else\n LINKS_DSO_PROGRAM = links-dso-program\n-LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)\n+LDLIBS-links-dso-program = -lstdc++ $(gnulib) $(libgcc_s) $(libunwind)\n endif\n \n ifeq (yes,$(have-selinux))\n", "prefixes": [ "2/5" ] }