Emit a warning when -z relro is unsupported

Alan Modra amodra@gmail.com
Wed Jul 29 07:10:02 GMT 2020


I believe the ia64-linux glibc problem is triggered by a fairly simple
glibc build bug.  There is a linker bug too.

I was able to reproduce the problem, with
.IA_64.unwind__libc_freeres_fn being mapped to bfd_abs_section, which
is what happens when a section is discarded by a linker script.

On looking at glibc/shlib.lds I see toward the end:

  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_/home/local/bin/../lib/gcc/ia64-linux/9.3.1/../../../../ia64-linux/bin/ld: warning: -z relro ignored
*) }
}

Uh oh, the script will discard all orphan sections due to *(*)
appearing.  (Yes there are some odd section match patterns before
that from the warning, but the final * gets everything.)

Now .IA_64.unwind__libc_freeres_fn is not an orphan, but it is
SHF_LINK_ORDER and __libc_freeres_fn is its linked-to section, and
that one is an orphan.  ldelf_before_place_orphans handles linked-to
sections, correctly discarding .IA_64.unwind__libc_freeres_fn but
failing to set SEC_EXCLUDE which would avoid the ldwrite.c assertion.

glibc patch attached

-- 
Alan Modra
Australia Development Lab, IBM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Don-t-mix-linker-error-messages-into-edited-scripts.patch
Type: text/x-diff
Size: 1111 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200729/915a8eff/attachment.bin>


More information about the Libc-alpha mailing list