Handle ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for MIPS

Message ID alpine.DEB.2.10.1509161554010.9502@digraph.polyomino.org.uk
State New, archived
Headers

Commit Message

Joseph Myers Sept. 16, 2015, 3:55 p.m. UTC
  This patch handles ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for MIPS in a
way similar to other architectures.

I've *not* committed this patch since, while it seems the logical
change for this purpose, it doesn't actually fix the
elf/tst-protected1[ab] failures; probably a binutils fix is needed as
well.  Perhaps someone familiar with MIPS binutils would like to look
at that?

2015-09-16  Joseph Myers  <joseph@codesourcery.com>

	[BZ #17711]
	* sysdeps/mips/dl-machine.h (elf_machine_type_class): Handle
	ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA.
	* sysdeps/mips/dl-sysdep.h: New file.
  

Patch

diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 52cd742..832aa01 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -58,7 +58,8 @@ 
 #define ELF_MACHINE_JMP_SLOT			R_MIPS_JUMP_SLOT
 #define elf_machine_type_class(type) \
   ((((type) == ELF_MACHINE_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)	\
-   | (((type) == R_MIPS_COPY) * ELF_RTYPE_CLASS_COPY))
+   | (((type) == R_MIPS_COPY) * ELF_RTYPE_CLASS_COPY)		\
+   | (((type) == R_MIPS_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA))
 
 #define ELF_MACHINE_PLT_REL 1
 #define ELF_MACHINE_NO_REL 0
diff --git a/sysdeps/mips/dl-sysdep.h b/sysdeps/mips/dl-sysdep.h
new file mode 100644
index 0000000..d94889d
--- /dev/null
+++ b/sysdeps/mips/dl-sysdep.h
@@ -0,0 +1,21 @@ 
+/* System-specific settings for dynamic linker code.  MIPS version.
+   Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include_next <dl-sysdep.h>
+
+#define DL_EXTERN_PROTECTED_DATA