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: Fix powerpc ifunc-sel.h build for -Os


Hi Joseph.

On Tue, Feb 27, 2018 at 05:56:46PM +0000, Joseph Myers wrote:
> Compiling the testsuite for powerpc (multi-arch configurations) with
> -Os with GCC 7 fails with:
> 
> In file included from ifuncmod1.c:7:0,
>                  from ifuncdep1.c:3:
> ../sysdeps/powerpc/ifunc-sel.h: In function 'ifunc_sel':
> ../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 2 probably doesn't match constraints [-Werror]
>    __asm__ ("mflr 12\n\t"
>    ^~~~~~~
> ../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 3 probably doesn't match constraints [-Werror]
> ../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 4 probably doesn't match constraints [-Werror]
> ../sysdeps/powerpc/ifunc-sel.h:12:3: error: impossible constraint in 'asm'
> 
> The "i" constraints on function pointers require the function call to
> be inlined so the compiler can see the constant function pointer
> arguments passed to the asm.  This patch marks the relevant functions
> as always_inline accordingly.
> 
> Tested that this fixes the -Os testsuite build for
> powerpc-linux-gnu-power4, powerpc64-linux-gnu, powerpc64le-linux-gnu
> with build-many-glibcs.py.
> 
> 2018-02-27  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Make always_inline.
> 	(ifunc_one): Likewise.
> 
> diff --git a/sysdeps/powerpc/ifunc-sel.h b/sysdeps/powerpc/ifunc-sel.h
> index bdb00bf..7112bed 100644
> --- a/sysdeps/powerpc/ifunc-sel.h
> +++ b/sysdeps/powerpc/ifunc-sel.h
> @@ -4,7 +4,7 @@
>  
>  extern int global;
>  
> -static inline void *
> +static inline __attribute__ ((always_inline)) void *
>  inhibit_stack_protector

It would be a little less verbose to use __always_inline from cdefs.h
Note: I did not check if this is not feasible for some reasons

>  ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
>  {
> @@ -32,7 +32,7 @@ ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
>    return ret;
>  }
>  
> -static inline void *
> +static inline __attribute__ ((always_inline)) void *
>  inhibit_stack_protector
Same goes here.

	Sam


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