Bug 29542 - PowerPC: internal error in get_output_view, at output.h:110
Summary: PowerPC: internal error in get_output_view, at output.h:110
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.39
: P2 normal
Target Milestone: 2.40
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-31 16:50 UTC by Dante Almeida
Modified: 2022-09-26 09:59 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2022-09-25 00:00:00


Attachments
Reproducer program (344 bytes, text/x-sh)
2022-08-31 16:50 UTC, Dante Almeida
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dante Almeida 2022-08-31 16:50:35 UTC
Created attachment 14307 [details]
Reproducer program

runme.sh:
-------------------------------------------------------------
#!/bin/bash

BINUTILS_HOME=/home/dante/src/binutils/ppc64le
export PATH="$BINUTILS_HOME/bin:$PATH"

LD=gold

ld.$LD -V | head -1

rm *.o *.c *.so >& /dev/null

cat > foo.c <<- EOM
#include <iostream>

extern "C" {
EOM

for i in `seq 1 259`;
do
    printf "int foo_%s();\n" $i >> foo.c
done

echo 'int use_all_undefs() {' >> foo.c

for i in `seq 1 259`;
do
    printf "foo_%s();\n" $i >> foo.c
done

echo 'return 1; }}' >> foo.c


g++ -B$BINUTILS_HOME/bin -c -fPIC -mlongcall -o foo.o foo.c
g++ ./foo.o -s -fuse-ld=$LD -B$BINUTILS_HOME/bin -shared -o ./libfoo.so

-------------------------------------------------------------

gcc 12.1.0 on ppc64le (bug also happens on gcc 9.3.0):

$ ./runme.sh
GNU gold (GNU Binutils 2.39.0.20220826) 1.16
/home/dante/src/binutils/ppc64le/bin/ld.gold: internal error in get_output_view, at output.h:110
collect2: error: ld returned 1 exit status



Works when LD=bfd.
Also works without the "-s" option.

Running binutils v2.39 configured with:
./configure --prefix=/tmp/dante --enable-shared --enable-plugins --enable-gold --enable-threads
Comment 1 Dante Almeida 2022-09-24 13:34:46 UTC
Hi,

Please increase that 259 number in the reproducer program in case you don't get the error message.

I've noticed that on some hosts (RHEL 8) I had to increase that number to get an error.

Thanks.
Comment 2 Sourceware Commits 2022-09-26 05:25:08 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c21736aed1d4877e090df60362413669dbdc391d

commit c21736aed1d4877e090df60362413669dbdc391d
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Sep 25 12:07:36 2022 +0930

    PR29542, PowerPC gold internal error in get_output_view,
    
    We were attempting to set a BSS style section contents.
    
            PR 29542
            * powerpc.cc (Output_data_plt_powerpc::do_write): Don't set .plt,
            .iplt or .lplt section contents when position independent.
Comment 3 Sourceware Commits 2022-09-26 09:58:20 UTC
The binutils-2_39-branch branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=041c22e35de06d22566f4c71e4425c3351215e66

commit 041c22e35de06d22566f4c71e4425c3351215e66
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Sep 25 12:07:36 2022 +0930

    PR29542, PowerPC gold internal error in get_output_view,
    
    We were attempting to set a BSS style section contents.
    
            PR 29542
            * powerpc.cc (Output_data_plt_powerpc::do_write): Don't set .plt,
            .iplt or .lplt section contents when position independent.
    
    (cherry picked from commit c21736aed1d4877e090df60362413669dbdc391d)
Comment 4 Alan Modra 2022-09-26 09:59:12 UTC
Fixed