[0/4] OpenRISC large binary fixes

Message ID 20210419000524.3625897-1-shorne@gmail.com
Headers show
Series
  • OpenRISC large binary fixes
Related show

Message

CHIGOT, CLEMENT via Binutils April 19, 2021, 12:05 a.m.
These are several fixes to OpenRISC BFD to handle issues mostly related to
linking large files.

There will be a GCC patch then depends on this, a new -mcmodel=large argument is
added to GCC to allow creating GOT relocation values larger than 64k.

The series fixes 3 issues:

 * PR 27624 - Assertion failure when dynamic symol is localized
 * PR 21464 - GOT relocation truncation.
 * PR 27746 - Issue with silent overlows in PLT code.

Stafford Horne (4):
  or1k: Fix issue with plt link failure for local calls
  or1k: Implement relocation R_OR1K_GOT_AHI16 for gotha()
  or1k: Support cmodel=large when generating plt code
  or1k: Fail link if the PLT relocation overflows

 bfd/bfd-in2.h                     |   1 +
 bfd/elf32-or1k.c                  | 182 ++++++++++++++++++++++--------
 bfd/libbfd.h                      |   1 +
 bfd/reloc.c                       |   2 +
 cpu/or1k.opc                      |   7 +-
 gas/testsuite/gas/or1k/reloc-1.d  |   4 +-
 gas/testsuite/gas/or1k/reloc-1.s  |   4 +
 include/elf/or1k.h                |   1 +
 ld/testsuite/ld-or1k/or1k.exp     |   8 ++
 ld/testsuite/ld-or1k/pltlarge1.dd |  38 +++++++
 ld/testsuite/ld-or1k/pltlarge1.s  |  24 ++++
 ld/testsuite/ld-or1k/pltlarge2.dd |  39 +++++++
 ld/testsuite/ld-or1k/pltlarge2.s  |  25 ++++
 ld/testsuite/ld-or1k/pltlib.s     |   1 +
 opcodes/or1k-asm.c                |   7 +-
 15 files changed, 296 insertions(+), 48 deletions(-)
 create mode 100644 ld/testsuite/ld-or1k/pltlarge1.dd
 create mode 100644 ld/testsuite/ld-or1k/pltlarge1.s
 create mode 100644 ld/testsuite/ld-or1k/pltlarge2.dd
 create mode 100644 ld/testsuite/ld-or1k/pltlarge2.s

-- 
2.26.2

Comments

CHIGOT, CLEMENT via Binutils April 20, 2021, 9:53 p.m. | #1
On Mon, Apr 19, 2021 at 09:05:20AM +0900, Stafford Horne wrote:
> These are several fixes to OpenRISC BFD to handle issues mostly related to

> linking large files.

> 

> There will be a GCC patch then depends on this, a new -mcmodel=large argument is

> added to GCC to allow creating GOT relocation values larger than 64k.

> 

> The series fixes 3 issues:

> 

>  * PR 27624 - Assertion failure when dynamic symol is localized

>  * PR 21464 - GOT relocation truncation.

>  * PR 27746 - Issue with silent overlows in PLT code.


As discussed offline with Giulio, this series does not properly fix the PR 21464
issue.  I have fixed the issue and will post a v2 after I fix some other things
uncovered...

Instead of using large PLTs whenever we see gotha() relocations, I will try to
detect when the plt_relocation overflows and switch to use the large model then.

This is needed as the gcc crtstuff will now always have gotha() relocations, with
the current binutils this would cause the large PLT code to always be generated.
We don't want that.

-Stafford