public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
@ 2024-04-10 17:10 mmatti at linux dot vnet.ibm.com
  2024-04-10 17:14 ` [Bug build/31629] " mmatti at linux dot vnet.ibm.com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-10 17:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

            Bug ID: 31629
           Summary: powerpc64: Configuring with "--with-cpu=power10" and
                    'CFLAGS=-O2 -mcpu=power9' fails to build glibc
           Product: glibc
           Version: 2.40
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: mmatti at linux dot vnet.ibm.com
                CC: carlos at redhat dot com
  Target Milestone: ---

Attempting to build a glibc POWER10 multilib, fails with the following error

/glibc_prestine/new_build/linkobj/libc_pic.a(acct.os): in function `acct':
(.text+0x64): call to `__syscall_error' lacks nop, can't restore toc; (toc
save/adjust stub)
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[1]: *** [Makerules:656: /glibc_prestine/new_build/linkobj/libc.so] Error 1
make[1]: Leaving directory '/glibc_prestine/glibc'
make: *** [Makefile:9: all] Error 2

How to reproduce :

$ ./configure 'CFLAGS=-O2 -mcpu=power9' --prefix=/usr
--with-headers=/usr/include --build=ppc64le-linux --with-cpu=power10
$ make

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
@ 2024-04-10 17:14 ` mmatti at linux dot vnet.ibm.com
  2024-04-10 17:16 ` mmatti at linux dot vnet.ibm.com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-10 17:14 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

Manjunath S Matti <mmatti at linux dot vnet.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bergner at linux dot ibm.com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
  2024-04-10 17:14 ` [Bug build/31629] " mmatti at linux dot vnet.ibm.com
@ 2024-04-10 17:16 ` mmatti at linux dot vnet.ibm.com
  2024-04-10 17:21 ` mmatti at linux dot vnet.ibm.com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-10 17:16 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

Manjunath S Matti <mmatti at linux dot vnet.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmatti at linux dot vnet.ibm.com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
  2024-04-10 17:14 ` [Bug build/31629] " mmatti at linux dot vnet.ibm.com
  2024-04-10 17:16 ` mmatti at linux dot vnet.ibm.com
@ 2024-04-10 17:21 ` mmatti at linux dot vnet.ibm.com
  2024-04-10 17:29 ` mmatti at linux dot vnet.ibm.com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-10 17:21 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

--- Comment #1 from Manjunath S Matti <mmatti at linux dot vnet.ibm.com> ---
Disassembly of section .text:

0000000000000000 <__GI_acct>:

# if SYSCALL_ULONG_ARG_1
T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS,
          SYSCALL_ULONG_ARG_1, SYSCALL_ULONG_ARG_2)
# else
T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
   0:   00 00 4c 3c     addis   r2,r12,0
                        0: R_PPC64_REL16_HA     .TOC.
   4:   00 00 42 38     addi    r2,r2,0
                        4: R_PPC64_REL16_LO     .TOC.+0x4
   8:   33 00 00 38     li      r0,51
   c:   d1 ff 21 f8     stdu    r1,-48(r1)
  10:   20 00 e1 fb     std     r31,32(r1)
  14:   98 8f ed eb     ld      r31,-28776(r13)
  18:   10 00 ff 77     andis.  r31,r31,16
  1c:   1c 00 82 41     beq     38 <__GI_acct+0x38>
  20:   a6 02 28 7d     mflr    r9
  24:   40 00 21 f9     std     r9,64(r1)
  28:   01 00 00 44     scv     0
  2c:   40 00 21 e9     ld      r9,64(r1)
  30:   a6 03 28 7d     mtlr    r9
  34:   08 00 00 48     b       3c <__GI_acct+0x3c>
  38:   02 00 00 44     sc
# endif
        ret
  3c:   00 00 bf 2e     cmpdi   cr5,r31,0
  40:   20 00 e1 eb     ld      r31,32(r1)
  44:   30 00 21 38     addi    r1,r1,48
  48:   18 00 96 41     beq     cr5,60 <__GI_acct+0x60>
  4c:   01 f0 20 39     li      r9,-4095
  50:   40 48 23 7c     cmpld   r3,r9
  54:   20 00 e0 4d     bltlr+
  58:   d0 00 63 7c     neg     r3,r3
  5c:   08 00 00 48     b       64 <__GI_acct+0x64>
  60:   20 00 e3 4c     bnslr+
  64:   00 00 00 48     b       64 <__GI_acct+0x64>
                        64: R_PPC64_REL24       __syscall_error <-- this is
causing the issue
        ...
  70:   40 20 0c 00     .long 0xc2040
  74:   68 00 00 00     .long 0x68
  78:   04 00 61 63     ori     r1,r27,4
  7c:   63 74 00 00     .long 0x7463

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (2 preceding siblings ...)
  2024-04-10 17:21 ` mmatti at linux dot vnet.ibm.com
@ 2024-04-10 17:29 ` mmatti at linux dot vnet.ibm.com
  2024-04-10 18:48 ` bergner at linux dot ibm.com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-10 17:29 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

--- Comment #2 from Manjunath S Matti <mmatti at linux dot vnet.ibm.com> ---
If glibc is configured without 'CFLAGS=-O2 -mcpu=power9', i.e.

$ ./configure --prefix=/usr --with-headers=/usr/include --build=ppc64le-linux
--with-cpu=power10

$ make 

This successfully builds glibc. Comparing the pass case with the fail case of
acct.os we get 

     5c:  08 00 00 48     b       64 <__GI_acct+0x64>
   60:  20 00 e3 4c     bnslr+
   64:  00 00 00 48     b       64 <__GI_acct+0x64>
-                       64: R_PPC64_REL24_NOTOC __syscall_error
+                       64: R_PPC64_REL24       __syscall_error
        ...
   70:  40 20 0c 00     .long 0xc2040
   74:  68 00 00 00     .long 0x68


The build goes through because R_PPC64_REL24_NOTOC is generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (3 preceding siblings ...)
  2024-04-10 17:29 ` mmatti at linux dot vnet.ibm.com
@ 2024-04-10 18:48 ` bergner at linux dot ibm.com
  2024-04-10 20:45 ` bergner at linux dot ibm.com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bergner at linux dot ibm.com @ 2024-04-10 18:48 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

Peter Bergner <bergner at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |powerpc64*-*-*
   Last reconfirmed|                            |2024-04-10
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (4 preceding siblings ...)
  2024-04-10 18:48 ` bergner at linux dot ibm.com
@ 2024-04-10 20:45 ` bergner at linux dot ibm.com
  2024-04-10 20:54 ` bergner at linux dot ibm.com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bergner at linux dot ibm.com @ 2024-04-10 20:45 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

Peter Bergner <bergner at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amodra at gmail dot com,
                   |                            |fweimer at redhat dot com,
                   |                            |tuliom at ascii dot art.br

--- Comment #3 from Peter Bergner <bergner at linux dot ibm.com> ---
The above code comes from sysdeps/powerpc/powerpc64/sysdep.h:

    b JUMPTARGET (NOTOC (__syscall_error))

The NOTOC macro defined in the same file is defined as:

#ifdef USE_PPC64_NOTOC
# define NOTOC(l) l@notoc
#else
# define NOTOC(l) l
#endif

...and USE_PPC64_NOTOC is a configure time macro from
sysdeps/powerpc/powerpc64/configure.ac:

AC_CACHE_CHECK([if the compiler supports @notoc],
               libc_cv_ppc64_notoc, [dnl
  cat > conftest.c <<EOF
int bar (void);
int foo (void) { return bar () + 1; }
EOF
  libc_cv_ppc64_notoc=no
  if AC_TRY_COMMAND([${CC-cc} $libc_cv_cc_submachine $CFLAGS $CPPFLAGS -S -o
conftest.s conftest.c]) \
     && AC_TRY_COMMAND([grep -q -E 'bar@notoc' conftest.s])
  then
    libc_cv_ppc64_notoc=yes
  fi
  rm -rf conftest.*])

The "bug" is that $libc_cv_cc_submachine (ie, -mcpu=power10 from the
--with-cpu=power10 configure option) is overridden by the -mcpu=power9 from the
CLFAGS.     

The following GLIBC patch fixes the error for me:

@@ -35,7 +35,7 @@ int bar (void);
 int foo (void) { return bar () + 1; }
 EOF
   libc_cv_ppc64_notoc=no
-  if AC_TRY_COMMAND([${CC-cc} $libc_cv_cc_submachine $CFLAGS $CPPFLAGS -S -o
conftest.s conftest.c]) \
+  if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $libc_cv_cc_submachine -S -o
conftest.s conftest.c]) \
      && AC_TRY_COMMAND([grep -q -E 'bar@notoc' conftest.s])
   then
     libc_cv_ppc64_notoc=yes

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (5 preceding siblings ...)
  2024-04-10 20:45 ` bergner at linux dot ibm.com
@ 2024-04-10 20:54 ` bergner at linux dot ibm.com
  2024-04-10 23:20 ` amodra at gmail dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bergner at linux dot ibm.com @ 2024-04-10 20:54 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

--- Comment #4 from Peter Bergner <bergner at linux dot ibm.com> ---
Alan, I CC'd you not for your help with the GLIBC fix, but to ask why does the
linker even give an error here?  This is a tail-call (b __syscall_error, not bl
__syscall_error), so the callee will never return to the instruction after the
direct branch, so we shouldn't need to place a toc-restore nop here, correct?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (6 preceding siblings ...)
  2024-04-10 20:54 ` bergner at linux dot ibm.com
@ 2024-04-10 23:20 ` amodra at gmail dot com
  2024-04-11  2:17 ` mmatti at linux dot vnet.ibm.com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: amodra at gmail dot com @ 2024-04-10 23:20 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

--- Comment #5 from Alan Modra <amodra at gmail dot com> ---
As the linker error says, this is a call that is going via a toc save or toc
adjust stub.  ie. the stub will be modifying r2.  Since this is a tail call
there is no way to restore the callers r2.  I believe the linker error is
correct.  As far as I'm aware there is only one case where the linker error is
wrong, and that is when calling a function that never returns.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (7 preceding siblings ...)
  2024-04-10 23:20 ` amodra at gmail dot com
@ 2024-04-11  2:17 ` mmatti at linux dot vnet.ibm.com
  2024-04-13 12:07 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmatti at linux dot vnet.ibm.com @ 2024-04-11  2:17 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

Manjunath S Matti <mmatti at linux dot vnet.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bmahi496 at linux dot ibm.com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (8 preceding siblings ...)
  2024-04-11  2:17 ` mmatti at linux dot vnet.ibm.com
@ 2024-04-13 12:07 ` fweimer at redhat dot com
  2024-04-13 12:12 ` fweimer at redhat dot com
  2024-04-24  7:10 ` amodra at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: fweimer at redhat dot com @ 2024-04-13 12:07 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

--- Comment #6 from Florian Weimer <fweimer at redhat dot com> ---
I believe this is INVALID. Passing -mcpu=power9 in CFLAGS and configuring using
--with-cpu=power10 looks like a user error to me.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (9 preceding siblings ...)
  2024-04-13 12:07 ` fweimer at redhat dot com
@ 2024-04-13 12:12 ` fweimer at redhat dot com
  2024-04-24  7:10 ` amodra at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: fweimer at redhat dot com @ 2024-04-13 12:12 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.redhat.com/b
                   |                            |rowse/RHEL-31523

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug build/31629] powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc
  2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
                   ` (10 preceding siblings ...)
  2024-04-13 12:12 ` fweimer at redhat dot com
@ 2024-04-24  7:10 ` amodra at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: amodra at gmail dot com @ 2024-04-24  7:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31629

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|amodra at gmail dot com            |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-04-24  7:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 17:10 [Bug build/31629] New: powerpc64: Configuring with "--with-cpu=power10" and 'CFLAGS=-O2 -mcpu=power9' fails to build glibc mmatti at linux dot vnet.ibm.com
2024-04-10 17:14 ` [Bug build/31629] " mmatti at linux dot vnet.ibm.com
2024-04-10 17:16 ` mmatti at linux dot vnet.ibm.com
2024-04-10 17:21 ` mmatti at linux dot vnet.ibm.com
2024-04-10 17:29 ` mmatti at linux dot vnet.ibm.com
2024-04-10 18:48 ` bergner at linux dot ibm.com
2024-04-10 20:45 ` bergner at linux dot ibm.com
2024-04-10 20:54 ` bergner at linux dot ibm.com
2024-04-10 23:20 ` amodra at gmail dot com
2024-04-11  2:17 ` mmatti at linux dot vnet.ibm.com
2024-04-13 12:07 ` fweimer at redhat dot com
2024-04-13 12:12 ` fweimer at redhat dot com
2024-04-24  7:10 ` amodra at gmail dot com

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).