public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
@ 2020-06-09 20:53 marxin at gcc dot gnu.org
  2020-06-10  6:19 ` [Bug lto/95620] " marxin at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-09 20:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

            Bug ID: 95620
           Summary: [10/11 Regression] relocation truncated to fit:
                    R_X86_64_PC32 against `.bss'
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

It's a test-case reduced from opa-ff project:

$ cat intel.i
double a[353783808];
int b, c, d;

int
main() {
  for (; b;)
#pragma omp parallel
    a[c] = 1;
  for (;; b++)
    if (a[c])
      d++;
}

$ gcc intel.i -mcmodel=medium -O2 -fopenmp
$ gcc intel.i -mcmodel=medium -O2 -flto -fopenmp
/tmp/ccaU2BEX.ltrans0.ltrans.o: in function `main':
<artificial>:(.text.startup+0x2): relocation truncated to fit: R_X86_64_PC32
against `.bss'
<artificial>:(.text.startup+0x22): relocation truncated to fit: R_X86_64_PC32
against `.bss'
collect2: error: ld returned 1 exit status

They have a huge .bss array (~350MB).
Since r10-5244-g6d8fd122c4f856e9 we can't handle it, the maximum value
supported by LTO is ~270MB.

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

* [Bug lto/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
@ 2020-06-10  6:19 ` marxin at gcc dot gnu.org
  2020-06-10  7:21 ` marxin at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-10  6:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
So we basically change assembly in the following way:

$ diff -u good.s bad.s -U999
--- good.s      2020-06-09 23:37:35.755366723 +0200
+++ bad.s       2020-06-09 23:37:36.771361476 +0200
@@ -1,13 +1,13 @@
        .file   "<artificial>"
        .text
        .globl  main
        .type   main, @function
 main:
 .LFB1:
        movl    b(%rip), %edx
 .LFE1:
        .size   main, .-main
-       .local  b
-       .comm   b,4,4
        .local  a
        .comm   a,2430270464
+       .local  b
+       .comm   b,4,4

and logically the relocation for 'b(%rip)' now has to go over the huge 'a'
array.
It's invalid to me, I would recommend using -mcmodel=large.

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

* [Bug lto/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
  2020-06-10  6:19 ` [Bug lto/95620] " marxin at gcc dot gnu.org
@ 2020-06-10  7:21 ` marxin at gcc dot gnu.org
  2020-06-26 12:09 ` [Bug target/95620] " rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-10  7:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2020-06-10
         Resolution|INVALID                     |---
     Ever confirmed|0                           |1

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
So it's really problem as with LTO we don't put the large array into .lbss
section:

LTO:
        .file   "<artificial>"
        .text
        .local  a
        .comm   a,2830270464,32
        .local  b
        .comm   b,4,4

non-LTO mode:

        .globl  a
        .section        .lbss,"aw"
        .align 32
        .type   a, @object
        .size   a, 2830270464
a:
        .zero   2830270464

So the symbol goes from .lbss section to .data section as LTO makes the symbol
local.

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

* [Bug target/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
  2020-06-10  6:19 ` [Bug lto/95620] " marxin at gcc dot gnu.org
  2020-06-10  7:21 ` marxin at gcc dot gnu.org
@ 2020-06-26 12:09 ` rguenth at gcc dot gnu.org
  2020-06-26 13:00 ` hjl.tools at gmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-26 12:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.2
           Keywords|rejects-valid               |link-failure,
                   |                            |missed-optimization

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

* [Bug target/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-06-26 12:09 ` [Bug target/95620] " rguenth at gcc dot gnu.org
@ 2020-06-26 13:00 ` hjl.tools at gmail dot com
  2020-06-26 21:03 ` hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-06-26 13:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Martin Liška from comment #2)
> So it's really problem as with LTO we don't put the large array into .lbss
> section:
> 
> LTO:
> 	.file	"<artificial>"
> 	.text
> 	.local	a
> 	.comm	a,2830270464,32
         ^^^^ This should be .largecomm.

[hjl@gnu-cfl-2 tmp]$ cat x.s
        .local  a
        .largecomm a,2830270464,32
[hjl@gnu-cfl-2 tmp]$ gcc -c x.s 
[hjl@gnu-cfl-2 tmp]$ readelf -SsW  x.o
There are 9 section headers, starting at offset 0x160:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .text             PROGBITS        0000000000000000 000040 000000 00  AX 
0   0  1
  [ 2] .data             PROGBITS        0000000000000000 000040 000000 00  WA 
0   0  1
  [ 3] .bss              NOBITS          0000000000000000 000040 000000 00  WA 
0   0  1
  [ 4] .lbss             NOBITS          0000000000000000 000040 a8b28000 00
WAl  0   0 32
  [ 5] .note.gnu.property NOTE            0000000000000000 000040 000030 00   A
 0   0  8
  [ 6] .symtab           SYMTAB          0000000000000000 000070 0000a8 18     
7   7  8
  [ 7] .strtab           STRTAB          0000000000000000 000118 000003 00     
0   0  1
  [ 8] .shstrtab         STRTAB          0000000000000000 00011b 000045 00     
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)

Symbol table '.symtab' contains 7 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    2 
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 
     4: 0000000000000000 0xa8b28000 OBJECT  LOCAL  DEFAULT    4 a
     5: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 
     6: 0000000000000000     0 SECTION LOCAL  DEFAULT    5 
[hjl@gnu-cfl-2 tmp]$

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

* [Bug target/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-06-26 13:00 ` hjl.tools at gmail dot com
@ 2020-06-26 21:03 ` hjl.tools at gmail dot com
  2020-06-29  9:46 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-06-26 21:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2020-June/54
                   |                            |9001.html
             Status|REOPENED                    |NEW
           Keywords|                            |patch

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at

https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549001.html

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

* [Bug target/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-06-26 21:03 ` hjl.tools at gmail dot com
@ 2020-06-29  9:46 ` marxin at gcc dot gnu.org
  2020-07-18 15:56 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-29  9:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Thank you for the patch H.J.!

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

* [Bug target/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-06-29  9:46 ` marxin at gcc dot gnu.org
@ 2020-07-18 15:56 ` cvs-commit at gcc dot gnu.org
  2020-07-18 15:57 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-18 15:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:7aa22a8f1a5cd7f79d6bdd8b56ef7ab89a43bce3

commit r11-2208-g7aa22a8f1a5cd7f79d6bdd8b56ef7ab89a43bce3
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jun 26 13:59:31 2020 -0700

    x86-64: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL

    Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

    gcc/

            PR target/95620
            * config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

    libgomp/

            PR target/95620
            * testsuite/libgomp.c/pr95620.c: New test.

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

* [Bug target/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-07-18 15:56 ` cvs-commit at gcc dot gnu.org
@ 2020-07-18 15:57 ` hjl.tools at gmail dot com
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-07-18 15:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 11 so far.

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

* [Bug target/95620] [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-07-18 15:57 ` hjl.tools at gmail dot com
@ 2020-07-23  6:51 ` rguenth at gcc dot gnu.org
  2021-04-08 12:02 ` [Bug target/95620] [10 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23  6:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.2                        |10.3

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.

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

* [Bug target/95620] [10 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
  2023-07-07  8:54 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.3                        |10.4

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.

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

* [Bug target/95620] [10 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-04-08 12:02 ` [Bug target/95620] [10 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:41 ` jakub at gcc dot gnu.org
  2023-07-07  8:54 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug target/95620] [10 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss'
  2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
@ 2023-07-07  8:54 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  8:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95620

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.5.0
   Target Milestone|10.5                        |11.0
             Status|NEW                         |RESOLVED
      Known to work|                            |11.0
         Resolution|---                         |FIXED

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for GCC 11.

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

end of thread, other threads:[~2023-07-07  8:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 20:53 [Bug lto/95620] New: [10/11 Regression] relocation truncated to fit: R_X86_64_PC32 against `.bss' marxin at gcc dot gnu.org
2020-06-10  6:19 ` [Bug lto/95620] " marxin at gcc dot gnu.org
2020-06-10  7:21 ` marxin at gcc dot gnu.org
2020-06-26 12:09 ` [Bug target/95620] " rguenth at gcc dot gnu.org
2020-06-26 13:00 ` hjl.tools at gmail dot com
2020-06-26 21:03 ` hjl.tools at gmail dot com
2020-06-29  9:46 ` marxin at gcc dot gnu.org
2020-07-18 15:56 ` cvs-commit at gcc dot gnu.org
2020-07-18 15:57 ` hjl.tools at gmail dot com
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2021-04-08 12:02 ` [Bug target/95620] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:41 ` jakub at gcc dot gnu.org
2023-07-07  8:54 ` rguenth at gcc dot gnu.org

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