Skip to contentSkip to conversation

xen/compiler: Fix the position of the visibility pragma

PATCH In review Andrew Cooper 2 participants 2 messages Mar 18, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/compiler: Fix the position of the visibility pragma

This needs to be ahead of everything. Right now, it is after xen/init.h being included for -DINIT_SECTIONS_ONLY

  # 1 "./include/xen/compiler.h" 1
  # 83 "./include/xen/compiler.h"
  # 1 "./include/xen/init.h" 1
  # 62 "./include/xen/init.h"
  typedef int (*initcall_t)(void);
  typedef void (*exitcall_t)(void);
  # 72 "./include/xen/init.h"
  void do_presmp_initcalls(void);
  void do_initcalls(void);
  # 84 "./include/xen/compiler.h" 2
  # 122 "./include/xen/compiler.h"
  #pragma GCC visibility push(hidden)
Fixes 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>

---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
xen/include/xen/compiler.h +5 -5
index b118e4ba62eb..636a85bc417d 100644
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -118,11 +123,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 

base-commit: 77be740e8182fa6b31291a8ae983d253187e9b50

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Andrew Cooper

This needs to be ahead of everything. Right now, it is after xen/init.h being included for -DINIT_SECTIONS_ONLY

  # 1 "./include/xen/compiler.h" 1
  # 83 "./include/xen/compiler.h"
  # 1 "./include/xen/init.h" 1
  # 62 "./include/xen/init.h"
  typedef int (*initcall_t)(void);
  typedef void (*exitcall_t)(void);
  # 72 "./include/xen/init.h"
  void do_presmp_initcalls(void);
  void do_initcalls(void);
  # 84 "./include/xen/compiler.h" 2
  # 122 "./include/xen/compiler.h"
  #pragma GCC visibility push(hidden)
Quoted 2 lines
Fixes 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")