[master] cf7451118 wrap __attribute__((x, used)) as v_used_(x)
Nils Goroll
nils.goroll at uplex.de
Wed Jan 22 14:20:07 UTC 2025
commit cf7451118279caf05b94201949746a7583a5d67c
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Wed Jan 22 15:16:19 2025 +0100
wrap __attribute__((x, used)) as v_used_(x)
SunCC does not support it. gcc apparently has it since at least 3.1, but I
simply added it to the existing version check for v_cold_ under the assumption
that 4.3 is already ancient enough for everyone to have it.
diff --git a/include/vdef.h b/include/vdef.h
index 1f3bbec43..381a4f799 100644
--- a/include/vdef.h
+++ b/include/vdef.h
@@ -243,8 +243,10 @@ int __llvm_gcov_flush(void);
#if __GNUC_PREREQ__(4, 3) || defined(__clang__)
# define v_cold_ __attribute__((cold))
+# define v_used_(x) __attribute__((x, used))
#else
# define v_cold_
+# define v_used_(x)
#endif
#if defined __has_attribute
diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 883fbe365..308e53dae 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -1245,7 +1245,7 @@ class vcc():
vmd = "Vmod_%s_Data" % self.modname
fo.write('\n')
fo.write('static const char vmod_vcs[] ')
- fo.write('__attribute__((section(".vmod_vcs"), used)) = %s;\n' % vcs)
+ fo.write('v_used_(section(".vmod_vcs")) = %s;\n' % vcs)
for i in (714, 759, 765):
fo.write("/*lint -esym(%d, %s) */\n" % (i, vmd))
fo.write("\nextern const struct vmod_data %s;\n" % vmd)
More information about the varnish-commit
mailing list