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] Allow inclusion of sysdep.h and sys/auxv.h at build time


On 02/20/2014 01:39 AM, Adam Conrad wrote:
> On powerpc and sparc, one can't include sys/auxv.h at build time, due
> to a header guard clash with sysdep.h.  This is a non-issue at runtime,
> as sysdep.h is an internal header not exposed to userspace, but it does
> mean that either the testsuite can't include sys/auxv.h (as tst-auxv.c
> does), or the includes need to be mangled to make it work.  This simple
> patch gets around that.  Okay to commit?
> 
> 	* sysdeps/powerpc/bits/hwcap.h: Allow _SYSDEPS_SYSDEP_H guard as a
> 	synonym for _SYS_AUXV_H to allow direct inclusion.
> 	* sysdeps/sparc/bits/hwcap.h: Likewise.
> 	* sysdeps/powerpc/sysdep.h: Define _SYSDEPS_SYSDEP_H instead of
> 	_SYS_AUXV_H so we can include sysdep.h and sys/auxv.h together.
> 	* sysdeps/sparc/sysdep.h: Likewise.

This looks good to me, but I'm curious what this actually fixes?

Is there a followup patch that includes sys/auxv.h somewhere?

> 
> diff --git a/sysdeps/powerpc/bits/hwcap.h b/sysdeps/powerpc/bits/hwcap.h
> index 1af8c82..7daec91 100644
> --- a/sysdeps/powerpc/bits/hwcap.h
> +++ b/sysdeps/powerpc/bits/hwcap.h
> @@ -16,7 +16,7 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>  
> -#ifndef _SYS_AUXV_H
> +#if !defined(_SYS_AUXV_H) && !defined(_SYSDEPS_SYSDEP_H)

OK.

>  # error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
>  #endif
>  
> diff --git a/sysdeps/powerpc/sysdep.h b/sysdeps/powerpc/sysdep.h
> index 541b657..e6627c0 100644
> --- a/sysdeps/powerpc/sysdep.h
> +++ b/sysdeps/powerpc/sysdep.h
> @@ -19,7 +19,7 @@
>   * Powerpc Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP).
>   * This entry is copied to _dl_hwcap or rtld_global._dl_hwcap during startup.
>   */
> -#define _SYS_AUXV_H 1
> +#define _SYSDEPS_SYSDEP_H 1

OK.

>  #include <bits/hwcap.h>
>  
>  #define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
> diff --git a/sysdeps/sparc/bits/hwcap.h b/sysdeps/sparc/bits/hwcap.h
> index cf7c3db..74e1d7f 100644
> --- a/sysdeps/sparc/bits/hwcap.h
> +++ b/sysdeps/sparc/bits/hwcap.h
> @@ -16,7 +16,7 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>  
> -#ifndef _SYS_AUXV_H
> +#if !defined(_SYS_AUXV_H) && !defined(_SYSDEPS_SYSDEP_H)

OK.

>  # error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
>  #endif
>  
> diff --git a/sysdeps/sparc/sysdep.h b/sysdeps/sparc/sysdep.h
> index 1404cc1..a566bd8 100644
> --- a/sysdeps/sparc/sysdep.h
> +++ b/sysdeps/sparc/sysdep.h
> @@ -15,7 +15,7 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>  
> -#define _SYS_AUXV_H 1
> +#define _SYSDEPS_SYSDEP_H 1

OK.

>  #include <bits/hwcap.h>
>  
>  #ifdef	__ASSEMBLER__
> ---
> 

Cheers,
Carlos.


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