This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Partial ILP32 support for aarch64


On Nov 21 2016, Steve Ellcey <sellcey@caviumnetworks.com> wrote:

> diff --git a/sysdeps/aarch64/dl-irel.h b/sysdeps/aarch64/dl-irel.h
> index 63a8e50..2effca4 100644
> --- a/sysdeps/aarch64/dl-irel.h
> +++ b/sysdeps/aarch64/dl-irel.h
> @@ -23,6 +23,7 @@
>  #include <stdio.h>
>  #include <unistd.h>
>  #include <ldsodefs.h>
> +#include <sysdep.h>
>  
>  #define ELF_MACHINE_IRELA	1
>  
> @@ -40,7 +41,7 @@ elf_irela (const ElfW(Rela) *reloc)
>    ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset;
>    const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
>  
> -  if (__glibc_likely (r_type == R_AARCH64_IRELATIVE))
> +  if (__glibc_likely (r_type == AARCH64_R (IRELATIVE)))

While we generally favor a space before parens, for macros that produce
an identifier we don't write one, similar to ElfW.

>  #define elf_machine_type_class(type)					\
> -  ((((type) == R_AARCH64_JUMP_SLOT ||					\
> -     (type) == R_AARCH64_TLS_DTPMOD ||					\
> -     (type) == R_AARCH64_TLS_DTPREL ||					\
> -     (type) == R_AARCH64_TLS_TPREL ||					\
> -     (type) == R_AARCH64_TLSDESC) * ELF_RTYPE_CLASS_PLT)		\
> -   | (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY)		\
> -   | (((type) == R_AARCH64_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA))
> +  ((((type) == AARCH64_R (JUMP_SLOT)					\
> +  || (type) == AARCH64_R (TLS_DTPMOD)					\
> +  || (type) == AARCH64_R (TLS_DTPREL)					\
> +  || (type) == AARCH64_R (TLS_TPREL)					\
> +  || (type) == AARCH64_R (TLSDESC)) * ELF_RTYPE_CLASS_PLT)		\

Indentation is off.

> diff --git a/sysdeps/aarch64/jmpbuf-unwind.h b/sysdeps/aarch64/jmpbuf-unwind.h
> index 3e0a37d..11ace17 100644
> --- a/sysdeps/aarch64/jmpbuf-unwind.h
> +++ b/sysdeps/aarch64/jmpbuf-unwind.h
> @@ -27,7 +27,7 @@
>    ((void *) (address) < (void *) demangle (jmpbuf[JB_SP]))
>  
>  #define _JMPBUF_CFA_UNWINDS_ADJ(jmpbuf, context, adj) \
> -  _JMPBUF_UNWINDS_ADJ (jmpbuf, (void *) _Unwind_GetCFA (context), adj)
> +  _JMPBUF_UNWINDS_ADJ (jmpbuf, (void *) (size_t) _Unwind_GetCFA (context), adj)

That should be uintptr_t.

> diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
> index c376e64..9dcf8d9 100644
> --- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
> @@ -32,6 +32,8 @@
>  #define __SIZEOF_PTHREAD_BARRIER_T     32
>  #define __SIZEOF_PTHREAD_BARRIERATTR_T  8
>  
> +#define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
> +
>  
>  /* Thread identifiers.  The structure of the attribute type is not
>     exposed on purpose.  */

The pthread type sizes should be adjusted, similar to x32, to avoid
excessive padding:

#ifdef __ILP32__
# define __SIZEOF_PTHREAD_ATTR_T        32
# define __SIZEOF_PTHREAD_MUTEX_T       32
# define __SIZEOF_PTHREAD_MUTEXATTR_T    4
# define __SIZEOF_PTHREAD_COND_T        48
# define __SIZEOF_PTHREAD_CONDATTR_T     4
# define __SIZEOF_PTHREAD_RWLOCK_T      44
# define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
# define __SIZEOF_PTHREAD_BARRIER_T     20
# define __SIZEOF_PTHREAD_BARRIERATTR_T  4
#else
# define __SIZEOF_PTHREAD_ATTR_T        64
# define __SIZEOF_PTHREAD_MUTEX_T       48
# define __SIZEOF_PTHREAD_MUTEXATTR_T    8
# define __SIZEOF_PTHREAD_COND_T        48
# define __SIZEOF_PTHREAD_CONDATTR_T     8
# define __SIZEOF_PTHREAD_RWLOCK_T      56
# define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
# define __SIZEOF_PTHREAD_BARRIER_T     32
# define __SIZEOF_PTHREAD_BARRIERATTR_T  8
#endif

> diff --git a/sysdeps/aarch64/nptl/bits/semaphore.h b/sysdeps/aarch64/nptl/bits/semaphore.h
> index 3cc5b37..05333ea 100644
> --- a/sysdeps/aarch64/nptl/bits/semaphore.h
> +++ b/sysdeps/aarch64/nptl/bits/semaphore.h
> @@ -21,7 +21,11 @@
>  #endif
>  
>  
> -#define __SIZEOF_SEM_T	32
> +#ifdef __ILP32__
> +# define __SIZEOF_SEM_T	16
> +#else
> +# define __SIZEOF_SEM_T	32
> +#endif

sem_t needs to be 64-bit aligned, to match struct new_sem.

 typedef union
 {
   char __size[__SIZEOF_SEM_T];
-  long int __align;
+  long long int __align;
 } sem_t;

> diff --git a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
> index a579501..ee54222 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
> @@ -19,7 +19,7 @@
>  #include <sys/ucontext.h>
>  
>  #define SIGCONTEXT siginfo_t *_si, struct ucontext *
> -#define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.pc)
> +#define GET_PC(ctx) ((void *) (size_t) (ctx)->uc_mcontext.pc)

uintptr_t

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]