Skip to content

Commit ec9f298

Browse files
authored
Refactor main function to support LLVM version changes (#9718)
* Refactor main function to support LLVM version changes Updated the main function to handle LLVM versioning for links. * Refactor main function and update link handling * Add patch to gprofng for protection against standard library macros
1 parent 8ed6e53 commit ec9f298

3 files changed

Lines changed: 40 additions & 3 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 5f66aee7f4bec7a2d8378034116f5e5c3dc50f41 Mon Sep 17 00:00:00 2001
2+
From: Andreas Schwab <schwab@suse.de>
3+
Date: Sat, 22 Nov 2025 11:29:43 +0100
4+
Subject: [PATCH] gprofng: protect against standard library macros
5+
6+
The CALL_UTIL macro can expand to an unparsable expression of the argument
7+
is a macro, like with the new const-preserving standard library macros in
8+
C23.
9+
10+
* gprofng/src/collector_module.h (CALL_UTIL): Add parens to not
11+
expand its argument if it is a function-like macro.
12+
13+
Upstream-Status: Backport [2.46 5f66aee7f4bec7a2d8378034116f5e5c3dc50f41]
14+
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
15+
---
16+
gprofng/src/collector_module.h | 2 +-
17+
1 file changed, 1 insertion(+), 1 deletion(-)
18+
19+
diff --git a/gprofng/src/collector_module.h b/gprofng/src/collector_module.h
20+
index b64d69c45ab..859a6dd1f7d 100644
21+
--- a/gprofng/src/collector_module.h
22+
+++ b/gprofng/src/collector_module.h
23+
@@ -119,7 +119,7 @@ typedef struct CollectorUtilFuncs
24+
extern CollectorUtilFuncs __collector_util_funcs;
25+
extern int __collector_dlsym_guard;
26+
27+
-#define CALL_UTIL(x) __collector_util_funcs.x
28+
+#define CALL_UTIL(x) (__collector_util_funcs.x)
29+
30+
/* The following constants define the meaning of the "void *arg"
31+
* argument of getFrameInfo().

packages/b/binutils/xmake.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ package("binutils")
1313
add_versions("2.38", "e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024")
1414
add_versions("2.34", "f00b0e8803dc9bab1e2165bd568528135be734df3fabf8d0161828cd56028952")
1515

16+
add_patches("2.45", "patches/gprofng-protect-against-standard-library-macros.patch", "092907d9dd6bc51744758245aa4f98a58c0352f00b5d85cd07a6150ce22fae71")
17+
1618
if is_plat("mingw") and is_subhost("msys") then
1719
add_extsources("pacman::binutils")
1820
elseif is_plat("linux") then

packages/l/llvm/components/base.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ function get_links(package)
6969
"LLVMOrcTargetProcess",
7070
"LLVMSymbolize",
7171
"LLVMTableGen",
72-
"LLVMTableGenGlobalISel",
7372
"LLVMTextAPI",
7473
"LLVMWindowsManifest",
7574
"LLVMXRay"
@@ -128,11 +127,16 @@ function get_links(package)
128127
if links_arch then
129128
links = table.join(links_arch, links)
130129
end
130+
-- LLVMTableGenGlobalISel was split into LLVMTableGenBasic + LLVMTableGenCommon in LLVM 19+
131+
if package:version() and package:version():ge("19") then
132+
table.insert(links, "LLVMTableGenBasic")
133+
table.insert(links, "LLVMTableGenCommon")
134+
else
135+
table.insert(links, "LLVMTableGenGlobalISel")
136+
end
131137
return links
132138
end
133139

134140
function main(package, component)
135141
component:add("links", get_links(package))
136142
end
137-
138-

0 commit comments

Comments
 (0)