[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/15228] copy relocations against protected symbols should be disa
From: |
cvs-commit at gcc dot gnu.org |
Subject: |
[Bug ld/15228] copy relocations against protected symbols should be disallowed |
Date: |
Fri, 03 Apr 2015 23:31:20 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=15228
--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot
gnu.org> ---
The binutils-2_25-branch branch has been updated by Alan Modra
<address@hidden>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=12aca65e0f9148bf136a9f4cfc2187aa485a143a
commit 12aca65e0f9148bf136a9f4cfc2187aa485a143a
Author: Alan Modra <address@hidden>
Date: Fri Mar 27 15:41:05 2015 +1030
Relax PR 15228 protected visibility restriction
Allows .dynbss copy of shared library protected visibility variables
if they are read-only.
To recap: Copying a variable from a shared library into an executable's
.dynbss is an old hack invented for non-PIC executables, to avoid the
text relocations you'd otherwise need to access a shared library
variable. This works with ELF shared libraries because global
symbols can be overridden. The trouble is that protected visibility
symbols can't be overridden. A shared library will continue to access
it's own protected visibility variable while the executable accesses a
copy. If either the shared library or the executable updates the
value then the copy diverges from the original. This is wrong since
there is only one definition of the variable in the application.
So I made the linker report an error on attempting to copy protected
visibility variables into .dynbss. However, you'll notice the above
paragraph contains an "If". An application that does not modify the
variable value remains correct even though two copies of the variable
exist. The linker can detect this situation if the variable was
defined in a read-only section.
PR ld/15228
PR ld/18167
* elflink.c (elf_merge_st_other): Add "sec" parameter. Don't set
protected_def when symbol section is read-only. Adjust all calls.
* elf-bfd.h (struct elf_link_hash_entry): Update protected_def comment.
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug ld/15228] copy relocations against protected symbols should be disallowed,
cvs-commit at gcc dot gnu.org <=