From 9849c407e8e6732fbf417cb447937e3b3b9a54ec Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Wed, 16 Dec 2009 09:09:38 +0100 Subject: build: Get rids of PIC macro using compiler flag __PIC__ instead Based on Peter Mazinger's comments on a recent commit, I decided to get rids of all occurrences of PIC changing them to __PIC__ Signed-off-by: Carmelo Amoroso --- .../linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h | 4 ++-- .../linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h | 4 ++-- .../linuxthreads/sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h | 8 ++++---- .../linuxthreads/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h | 6 +++--- .../linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h | 8 ++++---- libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S | 2 +- .../sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h | 4 ++-- .../linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h | 6 +++--- 8 files changed, 21 insertions(+), 21 deletions(-) (limited to 'libpthread') diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h index 9ea779e0d..5d686299c 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h @@ -118,7 +118,7 @@ __LABEL($syscall_error) \ # define __local_multiple_threads __libc_multiple_threads # endif -# ifdef PIC +# ifdef __PIC__ # define CENABLE bsr ra, __local_enable_asynccancel !samegp # define CDISABLE bsr ra, __local_disable_asynccancel !samegp # else @@ -130,7 +130,7 @@ __LABEL($syscall_error) \ extern int __local_multiple_threads attribute_hidden; # define SINGLE_THREAD_P \ __builtin_expect (__local_multiple_threads == 0, 1) -# elif defined(PIC) +# elif defined(__PIC__) # define SINGLE_THREAD_P(reg) ldl reg, __local_multiple_threads(gp) !gprel # else # define SINGLE_THREAD_P(reg) \ diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h index 75fcf54fa..3937808d5 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h @@ -27,7 +27,7 @@ /* We push lr onto the stack, so we have to use ldmib instead of ldmia to find the saved arguments. */ -# ifdef PIC +# ifdef __PIC__ # undef DOARGS_5 # undef DOARGS_6 # undef DOARGS_7 @@ -105,7 +105,7 @@ extern int __local_multiple_threads attribute_hidden; # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) # else -# if !defined PIC +# if !defined __PIC__ # define SINGLE_THREAD_P \ ldr ip, =__local_multiple_threads; \ ldr ip, [ip]; \ diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h index 134977e07..7b210ff11 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h @@ -104,7 +104,7 @@ # define POPARGS_6 POPARGS_5 ldw -54(%sr0,%sp), %r21 ASM_LINE_SEP # ifdef IS_IN_libpthread -# ifdef PIC +# ifdef __PIC__ # define CENABLE .import __pthread_enable_asynccancel,code ASM_LINE_SEP \ bl __pthread_enable_asynccancel,%r2 ASM_LINE_SEP # define CDISABLE .import __pthread_disable_asynccancel,code ASM_LINE_SEP \ @@ -116,7 +116,7 @@ bl __pthread_disable_asynccancel,%r2 ASM_LINE_SEP # endif # elif !defined NOT_IN_libc -# ifdef PIC +# ifdef __PIC__ # define CENABLE .import __libc_enable_asynccancel,code ASM_LINE_SEP \ bl __libc_enable_asynccancel,%r2 ASM_LINE_SEP # define CDISABLE .import __libc_disable_asynccancel,code ASM_LINE_SEP \ @@ -128,7 +128,7 @@ bl __libc_disable_asynccancel,%r2 ASM_LINE_SEP # endif # else -# ifdef PIC +# ifdef __PIC__ # define CENABLE .import __librt_enable_asynccancel,code ASM_LINE_SEP \ bl __librt_enable_asynccancel,%r2 ASM_LINE_SEP # define CDISABLE .import __librt_disable_asynccancel,code ASM_LINE_SEP \ @@ -167,7 +167,7 @@ nop ASM_LINE_SEP \ ldw MULTIPLE_THREADS_OFFSET(%sr0,%ret0),%ret0 ASM_LINE_SEP \ Lstp: ASM_LINE_SEP -# ifdef PIC +# ifdef __PIC__ /* Slower version uses GOT to get value of __local_multiple_threads */ # define SINGLE_THREAD_P \ addil LT%__local_multiple_threads, %r19 ASM_LINE_SEP \ diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h index a5dbeff1e..0bb16e453 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h @@ -101,7 +101,7 @@ # define CENABLE call __pthread_enable_asynccancel; # define CDISABLE call __pthread_disable_asynccancel # elif defined IS_IN_librt -# ifdef PIC +# ifdef __PIC__ # define CENABLE pushl %ebx; \ call __i686.get_pc_thunk.bx; \ addl $_GLOBAL_OFFSET_TABLE_, %ebx; \ @@ -139,7 +139,7 @@ #endif # ifndef __ASSEMBLER__ -# if defined FLOATING_STACKS && USE___THREAD && defined PIC +# if defined FLOATING_STACKS && USE___THREAD && defined __PIC__ # define SINGLE_THREAD_P \ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ p_header.data.multiple_threads) == 0, 1) @@ -153,7 +153,7 @@ extern int __local_multiple_threads # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) # endif # else -# if !defined PIC +# if !defined __PIC__ # define SINGLE_THREAD_P cmpl $0, __local_multiple_threads # elif defined FLOATING_STACKS && USE___THREAD # define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h index bb798e40d..9cd56755e 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h @@ -77,7 +77,7 @@ # define UNDOCARGS_5 UNDOCARGS_4; move.l (%sp)+, %d5; # ifdef IS_IN_libpthread -# ifdef PIC +# ifdef __PIC__ # define CENABLE jbsr __pthread_enable_asynccancel@PLTPC # define CDISABLE jbsr __pthread_disable_asynccancel@PLTPC # else @@ -85,7 +85,7 @@ # define CDISABLE jbsr __pthread_disable_asynccancel # endif # elif !defined NOT_IN_libc -# ifdef PIC +# ifdef __PIC__ # define CENABLE jbsr __libc_enable_asynccancel@PLTPC # define CDISABLE jbsr __libc_disable_asynccancel@PLTPC # else @@ -93,7 +93,7 @@ # define CDISABLE jbsr __libc_disable_asynccancel # endif # else -# ifdef PIC +# ifdef __PIC__ # define CENABLE jbsr __librt_enable_asynccancel@PLTPC # define CDISABLE jbsr __librt_disable_asynccancel@PLTPC # else @@ -114,7 +114,7 @@ extern int __local_multiple_threads attribute_hidden; # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) # else -# if !defined PIC +# if !defined __PIC__ # define SINGLE_THREAD_P tst.l __local_multiple_threads # else # define SINGLE_THREAD_P tst.l (__local_multiple_threads, %pc) diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S index 9f304abbe..8a43ea0db 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S @@ -56,7 +56,7 @@ ENTRY (__vfork) movel %a0,%sp@- # ifdef __ASSUME_VFORK_SYSCALL -# ifndef PIC +# ifndef __PIC__ jbra SYSCALL_ERROR_LABEL # endif # else diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h index 865da8e8c..9925a2f53 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h @@ -89,7 +89,7 @@ # else # define CENABLE bl JUMPTARGET(__librt_enable_asynccancel) # define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel) -# if defined HAVE_AS_REL16 && defined PIC +# if defined HAVE_AS_REL16 && defined __PIC__ # undef CGOTSETUP # define CGOTSETUP \ bcl 20,31,1f; \ @@ -122,7 +122,7 @@ extern int __local_multiple_threads attribute_hidden; # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) # else -# if !defined PIC +# if !defined __PIC__ # define SINGLE_THREAD_P \ lis 10,__local_multiple_threads@ha; \ lwz 10,__local_multiple_threads@l(10); \ diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h index 03c6fedbf..48b2caadd 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h @@ -102,7 +102,7 @@ # define __local_multiple_threads __librt_multiple_threads # endif -# if defined IS_IN_librt && defined PIC +# if defined IS_IN_librt && defined __PIC__ # define CENABLE \ mov.l r12,@-r15; \ mov.l 1f,r12; \ @@ -155,7 +155,7 @@ # endif # ifndef __ASSEMBLER__ -# if defined FLOATING_STACKS && USE___THREAD && defined PIC +# if defined FLOATING_STACKS && USE___THREAD && defined __PIC__ # define SINGLE_THREAD_P \ __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1) # else @@ -163,7 +163,7 @@ extern int __local_multiple_threads attribute_hidden; # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) # endif # else -# if !defined PIC +# if !defined __PIC__ # define SINGLE_THREAD_P \ mov.l 1f,r0; \ mov.l @r0,r0; \ -- cgit v1.2.3 From e092e7c30464555b3fb81adc8f2f479e892b0786 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Wed, 16 Dec 2009 13:12:00 +0100 Subject: check if USE_TLS is defined before use This patch will convert all the #ifdef USE_TLS and #if USE_TLS to #if defined(USE_TLS) && USE_TLS. By checking if the USE_TLS is defined before checking its value will result in correct behavior for architectures not defining this config symbol. Signed-off-by: Hans-Christian Egtvedt Acked-by: Carmelo AMOROSO --- libpthread/linuxthreads.old/pthread.c | 6 +++--- libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libpthread') diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index c988131fc..ad392e34e 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -537,7 +537,7 @@ int __pthread_initialize_manager(void) } /* Start the thread manager */ pid = 0; -#ifdef USE_TLS +#if defined(USE_TLS) && USE_TLS if (__linuxthreads_initial_report_events != 0) THREAD_SETMEM (((pthread_descr) NULL), p_report_events, __linuxthreads_initial_report_events); @@ -710,7 +710,7 @@ static pthread_descr thread_self_stack(void) if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos) return manager_thread; h = __pthread_handles + 2; -# ifdef USE_TLS +# if defined(USE_TLS) && USE_TLS while (h->h_descr == NULL || ! (sp <= (char *) h->h_descr->p_stackaddr && sp >= h->h_bottom)) h++; @@ -845,7 +845,7 @@ static void pthread_handle_sigcancel(int sig) /* Main thread should accumulate times for thread manager and its children, so that timings for main thread account for all threads. */ if (self == __pthread_main_thread) { -#ifdef USE_TLS +#if defined(USE_TLS) && USE_TLS waitpid(__pthread_manager_thread->p_pid, NULL, __WCLONE); #else waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE); diff --git a/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c b/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c index 19821d6e7..8e38b6904 100644 --- a/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c +++ b/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c @@ -31,7 +31,7 @@ td_thr_tls_get_addr (const td_thrhandle_t *th __attribute__ ((unused)), size_t offset __attribute__ ((unused)), void **address __attribute__ ((unused))) { -#ifdef USE_TLS +#if defined(USE_TLS) && USE_TLS size_t modid; union dtv pdtv, *dtvp; -- cgit v1.2.3