public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* S/390: Revert relro patch from Jan 14
@ 2019-03-01 14:22 Andreas Krebbel
  2019-03-04 10:54 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Krebbel @ 2019-03-01 14:22 UTC (permalink / raw)
  To: binutils; +Cc: nickc, maamountk

The current version of Binutils as well as version 2.32 currently does
not create functional 32 bit binaries.

$ echo -e "#include <stdio.h>\nint main () { puts(\"hello\"); }" | gcc -x c /dev/stdin -m31 -fPIE
-pie -o t; ./t
Segmentation fault (core dumped)

The problem was introduced with this patch:

commit 5a12586d44fa8d5dfc74cbca4f2f36a273a16335
Author: Maamoun Tarsha <maamountk@hotmail.com>
Date:   Mon Jan 14 16:00:14 2019 +0000

    Add support to GNU ld to separate got related plt entries from
normal ones in order to be able to s witch the non-plt got entries to
read-only after startup, conforming to revised Linux for zSeries ABI.


The patch adds SEPARATE_GOTPLT definitions to the s390 emulation
scripts.  While this change does appear to be a NOP for 64 bit since
there is already such a line later in the file it really hurts on 32
bit. With that change the _GLOBAL_OFFSET_TABLE_ symbol does not point
to the beginning of the .got anymore. But this is mandated by our ABI.
The first PLT entry for position indpendent code relies on that fact.
That's why the example above crashes.

I'm going to revert this patch on mainline and 2.32 branch.

Andreas

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

* Re: S/390: Revert relro patch from Jan 14
  2019-03-01 14:22 S/390: Revert relro patch from Jan 14 Andreas Krebbel
@ 2019-03-04 10:54 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2019-03-04 10:54 UTC (permalink / raw)
  To: Andreas Krebbel, binutils; +Cc: maamountk

Hi Andreas,

> I'm going to revert this patch on mainline and 2.32 branch.

Fair enough - but a few of the linker tests are failing to compile:

  Assembler messages:
  Fatal error: selected target format 'elf32-s390' unknown
  ERROR: -m31 /work/sources/binutils/current/ld/testsuite/ld-s390/tlspic1.s: assembly failed
  UNRESOLVED: TLS -fpic -shared transitions

  ERROR: -m31 /work/sources/binutils/current/ld/testsuite/ld-s390/tlslib.s: assembly failed
  UNRESOLVED: Helper shared library

  ERROR: -m31 /work/sources/binutils/current/ld/testsuite/ld-s390/tlsbinpic.s: assembly failed
  UNRESOLVED: TLS -fpic and -fno-pic exec transitions

  ERROR: -m31 /work/sources/binutils/current/ld/testsuite/ld-s390/gotreloc-1.s: assembly failed
  UNRESOLVED: GOT: symbol address load from got to larl

This is with a toolchain configured as s390x-ibm-tpf, which of
course only supports 64-bit s390x binaries...

Cheers
  Nick

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

end of thread, other threads:[~2019-03-04 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-01 14:22 S/390: Revert relro patch from Jan 14 Andreas Krebbel
2019-03-04 10:54 ` Nick Clifton

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