aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2022-04-04 17:19:07 -0700
committerFangrui Song <maskray@google.com>2022-04-04 17:19:07 -0700
commit3ee318c9233ce77dee099f2830e8e29a0c572ca7 (patch)
tree06a550c27bc52f0edab75f7f900ef32112a7eae2 /sysdeps
parent1c225a2dd16f20d7fb04157b4ac8a3f284bd686a (diff)
downloadglibc-3ee318c9233ce77dee099f2830e8e29a0c572ca7.zip
glibc-3ee318c9233ce77dee099f2830e8e29a0c572ca7.tar.gz
glibc-3ee318c9233ce77dee099f2830e8e29a0c572ca7.tar.bz2
Remove -z combreloc and HAVE_Z_COMBRELOC
-z combreloc has been the default regadless of the architecture since binutils commit f4d733664aabd7bd78c82895e030ec9779a92809 (2002). The configure check added in commit fdde83499a05 (2001) has long been unneeded. We can therefore treat HAVE_Z_COMBRELOC as always 1 and delete dead code paths in dl-machine.h files (many were copied from commit a711b01d34ca and ee0cb67ec238). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/alpha/dl-machine.h33
-rw-r--r--sysdeps/arm/dl-machine.h18
-rw-r--r--sysdeps/hppa/dl-machine.h9
-rw-r--r--sysdeps/i386/dl-machine.h20
-rw-r--r--sysdeps/ia64/dl-machine.h18
-rw-r--r--sysdeps/riscv/dl-machine.h18
-rw-r--r--sysdeps/s390/s390-32/dl-machine.h18
-rw-r--r--sysdeps/s390/s390-64/dl-machine.h18
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h16
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h16
-rw-r--r--sysdeps/x86_64/dl-machine.h18
11 files changed, 28 insertions, 174 deletions
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index 30fc790..ccee972 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -371,37 +371,22 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
Elf64_Addr *const reloc_addr = reloc_addr_arg;
unsigned long int const r_type = ELF64_R_TYPE (reloc->r_info);
-#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED
- /* This is defined in rtld.c, but nowhere in the static libc.a; make the
- reference weak so static programs can still link. This declaration
- cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
- because rtld.c contains the common defn for _dl_rtld_map, which is
- incompatible with a weak decl in the same file. */
- weak_extern (_dl_rtld_map);
-#endif
-
/* We cannot use a switch here because we cannot locate the switch
jump table until we've self-relocated. */
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP
if (__builtin_expect (r_type == R_ALPHA_RELATIVE, 0))
{
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* Already done in dynamic linker. */
- if (map != &GL(dl_rtld_map))
-# endif
- {
- /* XXX Make some timings. Maybe it's preferable to test for
- unaligned access and only do it the complex way if necessary. */
- Elf64_Addr reloc_addr_val;
+ /* XXX Make some timings. Maybe it's preferable to test for
+ unaligned access and only do it the complex way if necessary. */
+ Elf64_Addr reloc_addr_val;
- /* Load value without causing unaligned trap. */
- memcpy (&reloc_addr_val, reloc_addr_arg, 8);
- reloc_addr_val += map->l_addr;
+ /* Load value without causing unaligned trap. */
+ memcpy (&reloc_addr_val, reloc_addr_arg, 8);
+ reloc_addr_val += map->l_addr;
- /* Store value without causing unaligned trap. */
- memcpy (reloc_addr_arg, &reloc_addr_val, 8);
- }
+ /* Store value without causing unaligned trap. */
+ memcpy (reloc_addr_arg, &reloc_addr_val, 8);
}
else
#endif
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 94f41c6..a7898bf 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -335,23 +335,9 @@ elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[],
Elf32_Addr *const reloc_addr = reloc_addr_arg;
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP
if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
- {
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* This is defined in rtld.c, but nowhere in the static libc.a;
- make the reference weak so static programs can still link.
- This declaration cannot be done when compiling rtld.c
- (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
- common defn for _dl_rtld_map, which is incompatible with a
- weak decl in the same file. */
-# ifndef SHARED
- weak_extern (_dl_rtld_map);
-# endif
- if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */
-# endif
- *reloc_addr += map->l_addr;
- }
+ *reloc_addr += map->l_addr;
# ifndef RTLD_BOOTSTRAP
else if (__builtin_expect (r_type == R_ARM_NONE, 0))
return;
diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
index 7b7a697..8c0ca32 100644
--- a/sysdeps/hppa/dl-machine.h
+++ b/sysdeps/hppa/dl-machine.h
@@ -557,15 +557,6 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
struct link_map *sym_map;
Elf32_Addr value;
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED
- /* This is defined in rtld.c, but nowhere in the static libc.a; make the
- reference weak so static programs can still link. This declaration
- cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
- because rtld.c contains the common defn for _dl_rtld_map, which is
- incompatible with a weak decl in the same file. */
- weak_extern (GL(dl_rtld_map));
-# endif
-
/* RESOLVE_MAP will return a null value for undefined syms, and
non-null for all other syms. In particular, relocs with no
symbol (symbol index of zero), also called *ABS* relocs, will be
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 3ffd0b4..1f8d734 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -266,29 +266,15 @@ elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[],
Elf32_Addr *const reloc_addr = reloc_addr_arg;
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-# if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+# if !defined RTLD_BOOTSTRAP
if (__glibc_unlikely (r_type == R_386_RELATIVE))
- {
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* This is defined in rtld.c, but nowhere in the static libc.a;
- make the reference weak so static programs can still link.
- This declaration cannot be done when compiling rtld.c
- (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
- common defn for _dl_rtld_map, which is incompatible with a
- weak decl in the same file. */
-# ifndef SHARED
- weak_extern (_dl_rtld_map);
-# endif
- if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */
-# endif
- *reloc_addr += map->l_addr;
- }
+ *reloc_addr += map->l_addr;
# ifndef RTLD_BOOTSTRAP
else if (__glibc_unlikely (r_type == R_386_NONE))
return;
# endif
else
-# endif /* !RTLD_BOOTSTRAP and have no -z combreloc */
+# endif /* !RTLD_BOOTSTRAP */
{
# ifndef RTLD_BOOTSTRAP
const Elf32_Sym *const refsym = sym;
diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h
index e2c5004..20e586a 100644
--- a/sysdeps/ia64/dl-machine.h
+++ b/sysdeps/ia64/dl-machine.h
@@ -383,29 +383,15 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
Elf64_Addr value;
-#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED
- /* This is defined in rtld.c, but nowhere in the static libc.a; make the
- reference weak so static programs can still link. This declaration
- cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
- because rtld.c contains the common defn for _dl_rtld_map, which is
- incompatible with a weak decl in the same file. */
- weak_extern (_dl_rtld_map);
-#endif
-
/* We cannot use a switch here because we cannot locate the switch
jump table until we've self-relocated. */
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP
if (__builtin_expect (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_REL64LSB),
0))
{
assert (ELF64_R_TYPE (reloc->r_info) == R_IA64_REL64LSB);
- value = *reloc_addr;
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* Already done in dynamic linker. */
- if (map != &GL(dl_rtld_map))
-# endif
- value += map->l_addr;
+ value = *reloc_addr + map->l_addr;
}
else
#endif
diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h
index 1d3e2e5..4912735 100644
--- a/sysdeps/riscv/dl-machine.h
+++ b/sysdeps/riscv/dl-machine.h
@@ -244,24 +244,10 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
}
#endif
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP
case R_RISCV_RELATIVE:
- {
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* This is defined in rtld.c, but nowhere in the static libc.a;
- make the reference weak so static programs can still link.
- This declaration cannot be done when compiling rtld.c
- (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
- common defn for _dl_rtld_map, which is incompatible with a
- weak decl in the same file. */
-# ifndef SHARED
- weak_extern (GL(dl_rtld_map));
-# endif
- if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */
-# endif
- *addr_field = map->l_addr + reloc->r_addend;
+ *addr_field = map->l_addr + reloc->r_addend;
break;
- }
#endif
case R_RISCV_IRELATIVE:
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 4e6229e..4392abb 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -329,23 +329,9 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
Elf32_Addr *const reloc_addr = reloc_addr_arg;
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP
if (__glibc_unlikely (r_type == R_390_RELATIVE))
- {
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* This is defined in rtld.c, but nowhere in the static libc.a;
- make the reference weak so static programs can still link.
- This declaration cannot be done when compiling rtld.c
- (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
- common defn for _dl_rtld_map, which is incompatible with a
- weak decl in the same file. */
-# ifndef SHARED
- weak_extern (GL(dl_rtld_map));
-# endif
- if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */
-# endif
- *reloc_addr = map->l_addr + reloc->r_addend;
- }
+ *reloc_addr = map->l_addr + reloc->r_addend;
else
#endif
if (__glibc_unlikely (r_type == R_390_NONE))
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index 4bd97f5..7a94b3a 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -276,23 +276,9 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
Elf64_Addr *const reloc_addr = reloc_addr_arg;
const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP
if (__glibc_unlikely (r_type == R_390_RELATIVE))
- {
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* This is defined in rtld.c, but nowhere in the static libc.a;
- make the reference weak so static programs can still link.
- This declaration cannot be done when compiling rtld.c
- (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
- common defn for _dl_rtld_map, which is incompatible with a
- weak decl in the same file. */
-# ifndef SHARED
- weak_extern (GL(dl_rtld_map));
-# endif
- if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */
-# endif
- *reloc_addr = map->l_addr + reloc->r_addend;
- }
+ *reloc_addr = map->l_addr + reloc->r_addend;
else
#endif
if (__glibc_unlikely (r_type == R_390_NONE))
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index e8d208a..8c2408b 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -303,15 +303,6 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
struct link_map *sym_map = NULL;
-#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* This is defined in rtld.c, but nowhere in the static libc.a; make the
- reference weak so static programs can still link. This declaration
- cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
- because rtld.c contains the common defn for _dl_rtld_map, which is
- incompatible with a weak decl in the same file. */
- weak_extern (_dl_rtld_map);
-#endif
-
if (__glibc_unlikely (r_type == R_SPARC_NONE))
return;
@@ -321,13 +312,10 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
return;
}
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP
if (__glibc_unlikely (r_type == R_SPARC_RELATIVE))
{
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- if (map != &_dl_rtld_map) /* Already done in rtld itself. */
-# endif
- *reloc_addr += map->l_addr + reloc->r_addend;
+ *reloc_addr += map->l_addr + reloc->r_addend;
return;
}
#endif
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index dc24dbc..8c4bab1 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -324,15 +324,6 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
const unsigned long int r_type = ELF64_R_TYPE_ID (reloc->r_info);
struct link_map *sym_map = NULL;
-#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* This is defined in rtld.c, but nowhere in the static libc.a; make the
- reference weak so static programs can still link. This declaration
- cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
- because rtld.c contains the common defn for _dl_rtld_map, which is
- incompatible with a weak decl in the same file. */
- weak_extern (_dl_rtld_map);
-#endif
-
if (__glibc_unlikely (r_type == R_SPARC_NONE))
return;
@@ -342,13 +333,10 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
return;
}
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+#if !defined RTLD_BOOTSTRAP
if (__glibc_unlikely (r_type == R_SPARC_RELATIVE))
{
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- if (map != &_dl_rtld_map) /* Already done in rtld itself. */
-# endif
- *reloc_addr += map->l_addr + reloc->r_addend;
+ *reloc_addr += map->l_addr + reloc->r_addend;
return;
}
#endif
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 6a61874..c70af7a 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -258,23 +258,9 @@ elf_machine_rela(struct link_map *map, struct r_scope_elem *scope[],
ElfW(Addr) *const reloc_addr = reloc_addr_arg;
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
-# if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+# if !defined RTLD_BOOTSTRAP
if (__glibc_unlikely (r_type == R_X86_64_RELATIVE))
- {
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
- /* This is defined in rtld.c, but nowhere in the static libc.a;
- make the reference weak so static programs can still link.
- This declaration cannot be done when compiling rtld.c
- (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
- common defn for _dl_rtld_map, which is incompatible with a
- weak decl in the same file. */
-# ifndef SHARED
- weak_extern (GL(dl_rtld_map));
-# endif
- if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */
-# endif
- *reloc_addr = map->l_addr + reloc->r_addend;
- }
+ *reloc_addr = map->l_addr + reloc->r_addend;
else
# endif
# if !defined RTLD_BOOTSTRAP