From patchwork Wed Mar 30 06:17:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 52466 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B90BA386EC0E for ; Wed, 30 Mar 2022 06:17:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B90BA386EC0E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1648621058; bh=fT4pRxE/YVob7vI723Sn6gxi+i7ZOQuhbVhSMLyMtAM=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=h+D6hjfSUppFqveGtR+ynMFa7mz50FwQ7/bNV3V4y+iV6/uRbyFUyDXkmaAtvr5Zk o+z6I8wbiELW9Ej+edFUj/s5VRFEebILhlij1CWTzOZhY4t5ex6GP4F1ASJ8RDyXiV IUnKjULEoRIrCWJNBVfaj75/q3rIKCLz6iz7VFNo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by sourceware.org (Postfix) with ESMTPS id 0F6D63858C50 for ; Wed, 30 Mar 2022 06:17:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0F6D63858C50 Received: by mail-yb1-xb49.google.com with SMTP id e8-20020a259248000000b0063391b39d14so14862744ybo.10 for ; Tue, 29 Mar 2022 23:17:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=fT4pRxE/YVob7vI723Sn6gxi+i7ZOQuhbVhSMLyMtAM=; b=EP3va2cbRfN5lZOxcXWXwL/4/tFvrpLITc1Ra3fnnoFJ+ipkW1+qn+3x/SiXEduLAl KPieaBB/makIA99mGXBYKDB00V+P8De+IR+puDkkRKs/HnjiV7/AFSORkKbLrrsabFyK JhYXLrKCdTFio8N1xX/9Qf+EiDM6xcWky8HtyHNrK2AhvMpzUhHGBzHz5aLEzkWxxfVZ VTDZkF5iqAlp6c2/zKYONS/n/FFyOt4QHXmbyYT75dIiuqWS1M1K68Z8l7Mya85T2+FB OzHndFtPmUgjU2Rbyas3FndTm6T5hoZf9IGagllX+YCKbnP4o9BOE5hXHTafW5HldfF5 Xs5g== X-Gm-Message-State: AOAM533KWrVYQl86jJQgcl3OuhdhL4Q7urG/+2wRk4FSuUgTmSXhK+JW 8n1UjMSYS5DX+vtvNgixo3wHO/MkQTWDet8dBGSzSHiwYXPp+r3d62Ge9LSk/Bj/D4dJNVx4szm GpiwDXZoRF99gF1z8ONyIcFf/Jz05XBhCl6yMS9xfZDWxSKtcSPpSqidEXjSv4TYiPg/b X-Google-Smtp-Source: ABdhPJxzXmEtoIpjOWbnI4pwjcdhEs6MnUZb6h5D02Jxiq5fimLdScNMgvFVwBK3UWMbrPIuZJMgb46uGr5Z X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:200:925f:e947:f685:7815]) (user=maskray job=sendgmr) by 2002:a25:9945:0:b0:634:2086:37f2 with SMTP id n5-20020a259945000000b00634208637f2mr31538406ybo.252.1648621034370; Tue, 29 Mar 2022 23:17:14 -0700 (PDT) Date: Tue, 29 Mar 2022 23:17:07 -0700 Message-Id: <20220330061707.4119477-1-maskray@google.com> Mime-Version: 1.0 Subject: [PATCH] Remove -z combreloc and HAVE_Z_COMBRELOC To: libc-alpha@sourceware.org X-Spam-Status: No, score=-19.9 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Fangrui Song via Libc-alpha From: Fangrui Song Reply-To: Fangrui Song Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" -z combreloc has been the default 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 code paths in dl-machine.h files (many were copied from commit a711b01d34ca and ee0cb67ec238). Reviewed-by: Adhemerval Zanella --- Makeconfig | 10 ++------ config.h.in | 3 --- config.make.in | 1 - configure | 39 ------------------------------ configure.ac | 31 ------------------------ sysdeps/alpha/dl-machine.h | 33 +++++++------------------ sysdeps/arm/dl-machine.h | 18 ++------------ sysdeps/hppa/dl-machine.h | 9 ------- sysdeps/i386/dl-machine.h | 20 +++------------ sysdeps/ia64/dl-machine.h | 18 ++------------ sysdeps/riscv/dl-machine.h | 18 ++------------ sysdeps/s390/s390-32/dl-machine.h | 18 ++------------ sysdeps/s390/s390-64/dl-machine.h | 18 ++------------ sysdeps/sparc/sparc32/dl-machine.h | 16 ++---------- sysdeps/sparc/sparc64/dl-machine.h | 16 ++---------- sysdeps/x86_64/dl-machine.h | 18 ++------------ 16 files changed, 30 insertions(+), 256 deletions(-) diff --git a/Makeconfig b/Makeconfig index 47db08d6ae..0aa5fb0099 100644 --- a/Makeconfig +++ b/Makeconfig @@ -358,12 +358,6 @@ else real-static-start-installed-name = $(static-start-installed-name) endif -ifeq (yesyes,$(build-shared)$(have-z-combreloc)) -combreloc-LDFLAGS = -Wl,-z,combreloc -LDFLAGS.so += $(combreloc-LDFLAGS) -LDFLAGS-rtld += $(combreloc-LDFLAGS) -endif - relro-LDFLAGS = -Wl,-z,relro LDFLAGS.so += $(relro-LDFLAGS) LDFLAGS-rtld += $(relro-LDFLAGS) @@ -421,7 +415,7 @@ ifndef +link-pie +link-pie-before-inputs = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \ -Wl,-O1 -nostdlib -nostartfiles \ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ - $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ + $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \ $(+preinit) $(+prectorS) +link-pie-before-libc = -o $@ $(+link-pie-before-inputs) \ @@ -487,7 +481,7 @@ ifeq (yes,$(build-pie-default)) else # not build-pie-default +link-before-inputs = -nostdlib -nostartfiles $(no-pie-ldflag) \ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ - $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ + $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \ $(+preinit) $(+prector) +link-before-libc = -o $@ $(+link-before-inputs) \ diff --git a/config.h.in b/config.h.in index ff8597413d..a94f756859 100644 --- a/config.h.in +++ b/config.h.in @@ -56,9 +56,6 @@ #undef STACK_PROTECTOR_LEVEL #endif -/* Define if the linker supports the -z combreloc option. */ -#undef HAVE_Z_COMBRELOC - /* Define if _rtld_local structure should be forced into .sdata section. */ #undef HAVE_SDATA_SECTION diff --git a/config.make.in b/config.make.in index 6d43e691f7..bf728c71c0 100644 --- a/config.make.in +++ b/config.make.in @@ -53,7 +53,6 @@ c++-bits-std_abs-h = @CXX_BITS_STD_ABS_H@ all-warnings = @all_warnings@ enable-werror = @enable_werror@ -have-z-combreloc = @libc_cv_z_combreloc@ have-z-execstack = @libc_cv_z_execstack@ have-protected-data = @libc_cv_protected_data@ have-insert = @libc_cv_insert@ diff --git a/configure b/configure index 2a3cb49b0b..d2f413d05d 100755 --- a/configure +++ b/configure @@ -625,7 +625,6 @@ libc_cv_has_glob_dat libc_cv_hashstyle libc_cv_fpie libc_cv_z_execstack -libc_cv_z_combreloc ASFLAGS_config libc_cv_cc_with_libunwind libc_cv_insert @@ -5967,44 +5966,6 @@ if test $libc_cv_as_noexecstack = yes; then fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z combreloc" >&5 -$as_echo_n "checking for -z combreloc... " >&6; } -if ${libc_cv_z_combreloc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.c <&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then - if $READELF -S conftest.so | grep -E '.rela?.dyn' > /dev/null; then - libc_cv_z_combreloc=yes - else - libc_cv_z_combreloc=no - fi -else - libc_cv_z_combreloc=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_combreloc" >&5 -$as_echo "$libc_cv_z_combreloc" >&6; } -if test "$libc_cv_z_combreloc" = yes; then - $as_echo "#define HAVE_Z_COMBRELOC 1" >>confdefs.h - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z execstack" >&5 $as_echo_n "checking for linker that supports -z execstack... " >&6; } libc_linker_feature=no diff --git a/configure.ac b/configure.ac index fa7d3c025b..b6a747dece 100644 --- a/configure.ac +++ b/configure.ac @@ -1324,37 +1324,6 @@ if test $libc_cv_as_noexecstack = yes; then fi AC_SUBST(ASFLAGS_config) -AC_CACHE_CHECK(for -z combreloc, - libc_cv_z_combreloc, [dnl -cat > conftest.c <&AS_MESSAGE_LOG_FD]) -then -dnl The following test is a bit weak. We must use a tool which can test -dnl cross-platform since the gcc used can be a cross compiler. Without -dnl introducing new options this is not easily doable. Instead use a tool -dnl which always is cross-platform: readelf. To detect whether -z combreloc -dnl look for a section named .rel.dyn or .rela.dyn. - if $READELF -S conftest.so | grep -E '.rela?.dyn' > /dev/null; then - libc_cv_z_combreloc=yes - else - libc_cv_z_combreloc=no - fi -else - libc_cv_z_combreloc=no -fi -rm -f conftest*]) -if test "$libc_cv_z_combreloc" = yes; then - AC_DEFINE(HAVE_Z_COMBRELOC) -fi -AC_SUBST(libc_cv_z_combreloc) - LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack], [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no]) AC_SUBST(libc_cv_z_execstack) diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 30fc790e88..ccee972c96 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 94f41c65cb..a7898bf420 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 7b7a697cbb..8c0ca32fc6 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 3ffd0b4e31..1f8d734215 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 e2c5004a26..20e586aa35 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 1d3e2e588c..4912735c2b 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 4e6229e945..4392abb355 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 4bd97f5645..7a94b3a7a6 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 e8d208a080..8c2408b1e6 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 dc24dbc305..8c4bab14fc 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 6a6187490b..c70af7ab1e 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