This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Downgrade linker error on protected symbols in .dynbss to a warning

PR18222 has convinced me I ought to downgrade the linker error for
"copy reloc against protected <symbol> is invalid" to a warning.

The thing is that the protected visibility variable in libunwind is in
fact a constant.  libunwind doesn't change it from its initial value,
nor do any of the testsuite testcases.  Neither is the variable's
address taken.  So there isn't a real problem here in use of protected
variables, just a potential problem.

Since I'm downgrading the error to a warning I'm also going to revert
HJ's patch on master that turned off the error completely for x86.
Something like HJ's patch might be appropriate to turn off the warning
if the linker can be taught how to detect "safe" copying of protected
visibility variables into .dynbss.  Or better, edit code to PIC so no
copying into .dynbss is needed.

The following shows the changelog for the reversion + patch, then the
patch as I assume no one is particularly interested in the details of
a reversion.

	Revert 2015-03-05  H.J. Lu  <>
	PR ld/pr15228
	PR ld/pr17709
	* elf-bfd.h (elf_backend_data): Delete extern_protected_data.
	* elf32-i386.c (elf_backend_extern_protected_data): Delete.
	* elf64-x86-64.c (elf_backend_extern_protected_data): Likewise.
	* elflink.c (_bfd_elf_adjust_dynamic_copy): Remove
	extern_protected_data test.
	(_bfd_elf_symbol_refs_local_p): Likewise.
	* elfxx-target.h (elf_backend_extern_protected_data): Delete.
	(elfNN_bed): Delete elf_backend_extern_protected_data init.
	Revert 2015-03-05  H.J. Lu  <>
	PR ld/pr15228
	PR ld/pr17709
	* ld-i386/i386.exp (i386tests): Remove test for PR ld/17709.
	* ld-i386/pr17709-nacl.rd: Delete.
	* ld-i386/pr17709.rd: Likewise.
	* ld-i386/pr17709a.s: Likewise.
	* ld-i386/pr17709b.s: Likewise.
	* ld-i386/protected3.d: Updated.
	* ld-i386/protected3.s: Likewise.
	* ld-x86-64/pr17709-nacl.rd: Delete.
	* ld-x86-64/pr17709.rd: Likewise.
	* ld-x86-64/pr17709a.s: Likewise.
	* ld-x86-64/pr17709b.s: Likewise.
	* ld-x86-64/protected3.d: Updated.
	* ld-x86-64/protected3.s: Likewise.
	* ld-x86-64/x86-64.exp (x86_64tests): Remove test for PR ld/17709.

	PR ld/18222
	* elflink.c (_bfd_elf_adjust_dynamic_copy): Don't report an error
	on adding a protected visibility variable to .dynbss.

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 183b313..5bc9e9b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2674,13 +2674,9 @@ _bfd_elf_adjust_dynamic_copy (struct bfd_link_info *info,
   dynbss->size += h->size;
   if (h->protected_def)
-    {
-      info->callbacks->einfo
-	(_("%P: copy reloc against protected `%T' is invalid\n"),
-	 h->root.root.string);
-      bfd_set_error (bfd_error_bad_value);
-      return FALSE;
-    }
+    info->callbacks->einfo
+      (_("%P: copy reloc against protected `%T' is dangerous\n"),
+       h->root.root.string);
   return TRUE;

Alan Modra
Australia Development Lab, IBM

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]