Fix powerpc ifunc-sel.h build for -Os.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 2 Mar 2018 22:27:56 +0000 (22:27 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 2 Mar 2018 22:27:56 +0000 (22:27 +0000)
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.

* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Make always_inline.
(ifunc_one): Likewise.

ChangeLog
sysdeps/powerpc/ifunc-sel.h

index 001141c73d866444907bd19ace7e749cbf1f7183..f2dd409fd2d0a51a6e91869abdca92ec08d51609 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-03-02  Joseph Myers  <joseph@codesourcery.com>
+
+       * sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Make always_inline.
+       (ifunc_one): Likewise.
+
 2018-03-01  DJ Delorie  <dj@delorie.com>
 
        [BZ #22342]
index bdb00bf2c6ab4a0514bbede8bfb9deef27f02907..7112bed22c40aee26fd76c28fb74b1f88c85e63f 100644 (file)
@@ -4,7 +4,7 @@
 
 extern int global;
 
-static inline void *
+static inline __attribute__ ((always_inline)) void *
 inhibit_stack_protector
 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
 ifunc_one (int (*f1) (void))
 {