diff mbox

[ARM,BZ,#17711] Fix extern protected data handling

Message ID 55AFC57B.8020602@arm.com
State Committed
Headers show

Commit Message

Szabolcs Nagy July 22, 2015, 4:31 p.m. UTC
Fixes elf/tst-protected1a and elf/tst-protected1b tests.
Depends on a gcc and binutils fix too.

2015-07-22  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	[BZ #17711]
	* sysdeps/arm/dl-sysdep.h (DL_EXTERN_PROTECTED_DATA): Define.
	* sysdeps/arm/dl-machine.h (elf_machine_type_class): Handle
	ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA.

Comments

Joseph Myers July 22, 2015, 7:49 p.m. UTC | #1
On Wed, 22 Jul 2015, Szabolcs Nagy wrote:

> Fixes elf/tst-protected1a and elf/tst-protected1b tests.
> Depends on a gcc and binutils fix too.
> 
> 2015-07-22  Szabolcs Nagy  <szabolcs.nagy@arm.com>
> 
> 	[BZ #17711]
> 	* sysdeps/arm/dl-sysdep.h (DL_EXTERN_PROTECTED_DATA): Define.
> 	* sysdeps/arm/dl-machine.h (elf_machine_type_class): Handle
> 	ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA.

OK, but please make your commit message more specific - instead of saying 
"a gcc and binutils fix", name the precise commits required (or give URLs 
in the list archives if not yet committed).
diff mbox

Patch

diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index f901538..6fb20bd 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -224,18 +224,22 @@  _dl_start_user:\n\
    TLS variable, so undefined references should not be allowed to
    define the value.
    ELF_RTYPE_CLASS_COPY iff TYPE should not be allowed to resolve to one
-   of the main executable's symbols, as for a COPY reloc.  */
+   of the main executable's symbols, as for a COPY reloc.
+   ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA iff TYPE describes relocation against
+   protected data whose address may be external due to copy relocation.  */
 #ifndef RTLD_BOOTSTRAP
 # define elf_machine_type_class(type) \
   ((((type) == R_ARM_JUMP_SLOT || (type) == R_ARM_TLS_DTPMOD32		\
      || (type) == R_ARM_TLS_DTPOFF32 || (type) == R_ARM_TLS_TPOFF32	\
      || (type) == R_ARM_TLS_DESC)					\
     * ELF_RTYPE_CLASS_PLT)						\
-   | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY))
+   | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY)			\
+   | (((type) == R_ARM_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA))
 #else
 #define elf_machine_type_class(type) \
   ((((type) == R_ARM_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT)	\
-   | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY))
+   | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY)	\
+   | (((type) == R_ARM_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA))
 #endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
diff --git a/sysdeps/arm/dl-sysdep.h b/sysdeps/arm/dl-sysdep.h
index e5657dd..463ce59 100644
--- a/sysdeps/arm/dl-sysdep.h
+++ b/sysdeps/arm/dl-sysdep.h
@@ -21,3 +21,5 @@ 
 /* _dl_argv cannot be attribute_relro, because _dl_start_user
    might write into it after _dl_start returns.  */
 #define DL_ARGV_NOT_RELRO 1
+
+#define DL_EXTERN_PROTECTED_DATA