08c3a6
commit b2387bea84560d286613257139aba6787f414594
08c3a6
Author: Florian Weimer <fweimer@redhat.com>
08c3a6
Date:   Mon May 9 18:15:16 2022 +0200
08c3a6
08c3a6
    ia64: Always define IA64_USE_NEW_STUB as a flag macro
08c3a6
    
08c3a6
    And keep the previous definition if it exists.  This allows
08c3a6
    disabling IA64_USE_NEW_STUB while keeping USE_DL_SYSINFO defined.
08c3a6
    
08c3a6
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
08c3a6
    (cherry picked from commit 18bd9c3d3b1b6a9182698c85354578d1d58e9d64)
08c3a6
08c3a6
diff --git a/sysdeps/unix/sysv/linux/ia64/brk.c b/sysdeps/unix/sysv/linux/ia64/brk.c
08c3a6
index cf2c5bd667fb4432..61d8fa260eb59d1e 100644
08c3a6
--- a/sysdeps/unix/sysv/linux/ia64/brk.c
08c3a6
+++ b/sysdeps/unix/sysv/linux/ia64/brk.c
08c3a6
@@ -16,7 +16,6 @@
08c3a6
    License along with the GNU C Library; if not, see
08c3a6
    <https://www.gnu.org/licenses/>.  */
08c3a6
 
08c3a6
-#include <dl-sysdep.h>
08c3a6
-/* brk is used by statup before TCB is properly set.  */
08c3a6
-#undef USE_DL_SYSINFO
08c3a6
+/* brk is used by startup before TCB is properly set up.  */
08c3a6
+#define IA64_USE_NEW_STUB 0
08c3a6
 #include <sysdeps/unix/sysv/linux/brk.c>
08c3a6
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
08c3a6
index 7198c192a03b7676..f1c81a66833941cc 100644
08c3a6
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
08c3a6
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
08c3a6
@@ -46,12 +46,15 @@
08c3a6
 #undef SYS_ify
08c3a6
 #define SYS_ify(syscall_name)	__NR_##syscall_name
08c3a6
 
08c3a6
-#if defined USE_DL_SYSINFO \
08c3a6
-	&& (IS_IN (libc) \
08c3a6
-	    || IS_IN (libpthread) || IS_IN (librt))
08c3a6
-# define IA64_USE_NEW_STUB
08c3a6
-#else
08c3a6
-# undef IA64_USE_NEW_STUB
08c3a6
+#ifndef IA64_USE_NEW_STUB
08c3a6
+# if defined USE_DL_SYSINFO && IS_IN (libc)
08c3a6
+#  define IA64_USE_NEW_STUB 1
08c3a6
+# else
08c3a6
+#  define IA64_USE_NEW_STUB 0
08c3a6
+# endif
08c3a6
+#endif
08c3a6
+#if IA64_USE_NEW_STUB && !USE_DL_SYSINFO
08c3a6
+# error IA64_USE_NEW_STUB needs USE_DL_SYSINFO
08c3a6
 #endif
08c3a6
 
08c3a6
 #ifdef __ASSEMBLER__
08c3a6
@@ -103,7 +106,7 @@
08c3a6
 	mov r15=num;				\
08c3a6
 	break __IA64_BREAK_SYSCALL
08c3a6
 
08c3a6
-#ifdef IA64_USE_NEW_STUB
08c3a6
+#if IA64_USE_NEW_STUB
08c3a6
 # ifdef SHARED
08c3a6
 #  define DO_CALL(num)				\
08c3a6
 	.prologue;				\
08c3a6
@@ -187,7 +190,7 @@
08c3a6
    (non-negative) errno on error or the return value on success.
08c3a6
  */
08c3a6
 
08c3a6
-#ifdef IA64_USE_NEW_STUB
08c3a6
+#if IA64_USE_NEW_STUB
08c3a6
 
08c3a6
 # define INTERNAL_SYSCALL_NCS(name, nr, args...)			      \
08c3a6
 ({									      \
08c3a6
@@ -279,7 +282,7 @@
08c3a6
 #define ASM_OUTARGS_5	ASM_OUTARGS_4, "=r" (_out4)
08c3a6
 #define ASM_OUTARGS_6	ASM_OUTARGS_5, "=r" (_out5)
08c3a6
 
08c3a6
-#ifdef IA64_USE_NEW_STUB
08c3a6
+#if IA64_USE_NEW_STUB
08c3a6
 #define ASM_ARGS_0
08c3a6
 #define ASM_ARGS_1	ASM_ARGS_0, "4" (_out0)
08c3a6
 #define ASM_ARGS_2	ASM_ARGS_1, "5" (_out1)
08c3a6
@@ -315,7 +318,7 @@
08c3a6
   /* Branch registers.  */						\
08c3a6
   "b6"
08c3a6
 
08c3a6
-#ifdef IA64_USE_NEW_STUB
08c3a6
+#if IA64_USE_NEW_STUB
08c3a6
 # define ASM_CLOBBERS_6	ASM_CLOBBERS_6_COMMON
08c3a6
 #else
08c3a6
 # define ASM_CLOBBERS_6	ASM_CLOBBERS_6_COMMON , "b7"