From 96154cd892c614f13f32996ce75df1442641fb5b Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Sat, 7 Apr 2012 09:34:45 -0400 Subject: Simplify _ELF_DYNAMIC_DO_RELOC after combining the old two defs. * elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): Simplify conditions and remove no longer applicable assertion. --- ChangeLog | 5 +++++ elf/dynamic-link.h | 9 +-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91e836149c..0544a89ab4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-04-07 Carlos O'Donell + + * elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): Simplify + conditions and remove no longer applicable assertion. + 2012-04-06 H.J. Lu * bits/byteswap.h (__bswap_16): Removed. diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h index 310ad5e66e..ef01c61f3e 100644 --- a/elf/dynamic-link.h +++ b/elf/dynamic-link.h @@ -278,13 +278,7 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp) \ if (__builtin_expect (ranges[0].size, 1)) \ ranges[0].size = (start - ranges[0].start); \ - if (! ELF_DURING_STARTUP \ - && ((do_lazy) \ - /* This test does not only detect whether the relocation \ - sections are in the right order, it also checks whether \ - there is a DT_REL/DT_RELA section. */ \ - || __builtin_expect (ranges[0].start + ranges[0].size \ - != start, 0))) \ + if (! ELF_DURING_STARTUP && ((do_lazy) || ranges[0].size == 0)) \ { \ ranges[1].start = start; \ ranges[1].size = (map)->l_info[DT_PLTRELSZ]->d_un.d_val; \ @@ -293,7 +287,6 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp) else \ { \ /* Combine processing the sections. */ \ - assert (ranges[0].start + ranges[0].size == start); \ ranges[0].size += (map)->l_info[DT_PLTRELSZ]->d_un.d_val; \ } \ } \ -- cgit v1.2.3 From 5ed848f3d8b5b3be92fe3006fd18a089ef982316 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sat, 7 Apr 2012 09:29:14 -0700 Subject: Handle some new sparc relocation types. * elf/elf.h (R_SPARC_WDISP10): Define. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Handle R_SPARC_SIZE32. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Handle R_SPARC_SIZE64 and R_SPARC_H34. --- ChangeLog | 8 ++++++++ elf/elf.h | 1 + sysdeps/sparc/sparc32/dl-machine.h | 6 ++++++ sysdeps/sparc/sparc64/dl-machine.h | 12 ++++++++++++ 4 files changed, 27 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0544a89ab4..cdecc655a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-04-07 David S. Miller + + * elf/elf.h (R_SPARC_WDISP10): Define. + * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Handle + R_SPARC_SIZE32. + * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Handle + R_SPARC_SIZE64 and R_SPARC_H34. + 2012-04-07 Carlos O'Donell * elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): Simplify diff --git a/elf/elf.h b/elf/elf.h index a71de7286b..347d6d856e 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -1327,6 +1327,7 @@ typedef struct #define R_SPARC_H34 85 #define R_SPARC_SIZE32 86 #define R_SPARC_SIZE64 87 +#define R_SPARC_WDISP10 88 #define R_SPARC_JMP_IREL 248 #define R_SPARC_IRELATIVE 249 #define R_SPARC_GNU_VTINHERIT 250 diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 31b540ac37..2dfeeb27a3 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -359,6 +359,12 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, if (__builtin_expect (r_type == R_SPARC_NONE, 0)) return; + if (__builtin_expect (r_type == R_SPARC_SIZE32, 0)) + { + *reloc_addr = sym->st_size + reloc->r_addend; + return; + } + #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0)) { diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 4b14593c9b..35c24d1558 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -385,6 +385,12 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, if (__builtin_expect (r_type == R_SPARC_NONE, 0)) return; + if (__builtin_expect (r_type == R_SPARC_SIZE64, 0)) + { + *reloc_addr = sym->st_size + reloc->r_addend; + return; + } + #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0)) { @@ -552,6 +558,12 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, (((value & 0x3ff) + ELF64_R_TYPE_DATA (reloc->r_info)) & 0x1fff)); break; + /* ABS34 code model reloc */ + case R_SPARC_H34: + *(unsigned int *) reloc_addr = + ((*(unsigned int *)reloc_addr & 0xffc00000) | + ((value >> 12) & 0x3fffff)); + /* MEDMID code model relocs */ case R_SPARC_H44: *(unsigned int *) reloc_addr = -- cgit v1.2.3 From 1e4920e0808439be5e4a6a6e8a736de32c43b070 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 22 Feb 2011 13:26:19 -0500 Subject: memset: fix define usage for shared libs The proper define to check "am I in a shared lib" is "SHARED", not "PIC". The two new memset_chk functions incorrectly depend on "PIC". Signed-off-by: Mike Frysinger --- ChangeLog | 5 +++++ sysdeps/i386/i686/memset_chk.S | 2 +- sysdeps/x86_64/memset_chk.S | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cdecc655a9..bed8caf4e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-04-07 Mike Frysinger + + * sysdeps/i386/i686/memset_chk.S: Change PIC to SHARED. + * sysdeps/x86_64/memset_chk.S: Likewise. + 2012-04-07 David S. Miller * elf/elf.h (R_SPARC_WDISP10): Define. diff --git a/sysdeps/i386/i686/memset_chk.S b/sysdeps/i386/i686/memset_chk.S index 504fc06b18..f2e7fd7813 100644 --- a/sysdeps/i386/i686/memset_chk.S +++ b/sysdeps/i386/i686/memset_chk.S @@ -19,7 +19,7 @@ #include #include "asm-syntax.h" -#ifndef PIC +#ifndef SHARED /* For libc.so this is defined in memset.S. For libc.a, this is a separate source to avoid memset bringing in __chk_fail and all routines diff --git a/sysdeps/x86_64/memset_chk.S b/sysdeps/x86_64/memset_chk.S index 16f1fde165..9efb3d9ee9 100644 --- a/sysdeps/x86_64/memset_chk.S +++ b/sysdeps/x86_64/memset_chk.S @@ -19,7 +19,7 @@ #include #include "asm-syntax.h" -#ifndef PIC +#ifndef SHARED /* For libc.so this is defined in memset.S. For libc.a, this is a separate source to avoid memset bringing in __chk_fail and all routines -- cgit v1.2.3