public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Joseph Myers <joseph@codesourcery.com>
Cc: libc-alpha@sourceware.org
Subject: Re: Fix powerpc ifunc-sel.h build for -Os
Date: Tue, 27 Feb 2018 20:34:00 -0000	[thread overview]
Message-ID: <20180227180834.GA3300@ravnborg.org> (raw)
In-Reply-To: <alpine.DEB.2.20.1802271756170.14335@digraph.polyomino.org.uk>

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

  reply	other threads:[~2018-02-27 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 18:16 Joseph Myers
2018-02-27 20:34 ` Sam Ravnborg [this message]
2018-02-27 20:34   ` Joseph Myers
2018-03-02 22:21 ` Tulio Magno Quites Machado Filho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180227180834.GA3300@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).