From patchwork Tue Aug 2 14:59:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 56499 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 345F1386C584 for ; Tue, 2 Aug 2022 14:59:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 345F1386C584 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659452371; bh=Bcxc/R4QX/NqbFvNEOTwjYzdcS0lWXy9slVCtHTgwP4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=hywsPsSNrXEL3UiKpKolM08ePtqVu5aiDhYt5O9ne3TK1rtJ5VqZPwAwsKZSip++u uXVhvoKTPiqk+JYjJ5Mcq4T/6slbvzhOQKI/icLvkR35dult9fVYnMmnqj80i6RjLM jTL8GhYTiyc779Lx8m3I47ughM+seuI1XRYlLNnU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) by sourceware.org (Postfix) with ESMTPS id 41B69385829C for ; Tue, 2 Aug 2022 14:59:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 41B69385829C Received: by mail-vk1-xa2f.google.com with SMTP id l13so3076997vka.12 for ; Tue, 02 Aug 2022 07:59:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bcxc/R4QX/NqbFvNEOTwjYzdcS0lWXy9slVCtHTgwP4=; b=uW8Gvo6wmVlBKUMIQyWG+l4WpPKQxL93dGocS+LWvwv02FxIfgNHGvbb+iSqg5Pn1H 3nZuOEcNfx9Wb9hz92JtRznMkcaCZX49Q+FBdEQ8qaeG8RysrhWjF/GYbTCA2LyUl5vr V8EVdkIEUIK87DqpBLiKs4cnRB53MqiAy80Huqdz7+i5bB8IEVaKBTw5xmyjObKYcNrv 7N1B0a0lLTfgVZUeoZkzfYJWYFF82brkpnXr7fRk1JD/VYnky46vwSZJaFUnHhp5WKwW fXxxSPCpjgwADrRKHfBJEL6Ax90lSBCibYACM9gHfPK9jqhB3tfUUnlFB/vkKeemjzTj WkBw== X-Gm-Message-State: AJIora/YLFCYoZ9FX09P1SvGtM0PwZwoIOo5PF142LevQyGWzMdlR87Z 37g+6Kxhl8w/YYZlJaXS174ZHdM8SD4Ljg== X-Google-Smtp-Source: AGRyM1u0u60O2Tn0rTg7/hcsQ7BLAbvD1+lcbLAnbSgJoOSDa8oge1xatlRBKnCJhvtRLj+hgrMZXg== X-Received: by 2002:a1f:48c7:0:b0:376:3a67:4c13 with SMTP id v190-20020a1f48c7000000b003763a674c13mr7900371vka.2.1659452349307; Tue, 02 Aug 2022 07:59:09 -0700 (PDT) Received: from mandiga.. ([2804:431:c7cb:1e34:2331:a60b:db1e:6436]) by smtp.gmail.com with ESMTPSA id v145-20020a1f2f97000000b003762e090ed8sm8000982vkv.49.2022.08.02.07.59.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 07:59:09 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 1/5] Remove missing LD_LIBRARY_VERSION usages Date: Tue, 2 Aug 2022 11:59:01 -0300 Message-Id: <20220802145905.2789733-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> References: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The environment variable was removed by d2db60d8d830ef68c8d20a77ac3572d610aa40b1. --- sysdeps/unix/sysv/linux/ldd-rewrite.sed | 1 - sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed | 3 --- sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed | 3 --- sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed | 2 -- sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed | 2 -- 5 files changed, 11 deletions(-) diff --git a/sysdeps/unix/sysv/linux/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ldd-rewrite.sed index 7b8b6bdee0..1faa90fbc8 100644 --- a/sysdeps/unix/sysv/linux/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/ldd-rewrite.sed @@ -8,4 +8,3 @@ fi\ # In case of an error punt. /LD_TRACE_LOADED_OBJECTS=1/a\ -add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out" diff --git a/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed index 9039b69548..74bdbd9659 100644 --- a/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed @@ -1,6 +1,3 @@ -/LD_TRACE_LOADED_OBJECTS=1/a\ -add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out" - # ldd is generated from elf/ldd.bash.in with the name # of ld.so as generated in Makeconfig diff --git a/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed index 6b4f1bfcad..ea2b5a05cf 100644 --- a/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed @@ -1,6 +1,3 @@ -/LD_TRACE_LOADED_OBJECTS=1/a\ -add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out" - # ldd is generated from elf/ldd.bash.in with the name # of ld.so as generated in Makeconfig diff --git a/sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed index 7dc2698fa8..3ec8f49f42 100644 --- a/sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed @@ -1,3 +1 @@ -/LD_TRACE_LOADED_OBJECTS=1/a\ -add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out" s_^\(RTLDLIST=\)\(.*lib\)\(\|64\)\(/[^/]*\.so\.[0-9.]*\)[ ]*$_\1"\2\4 \264\4"_ diff --git a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed index 44d76e8aa1..49c0c7a3a8 100644 --- a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed @@ -1,3 +1 @@ -/LD_TRACE_LOADED_OBJECTS=1/a\ -add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out" s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_ From patchwork Tue Aug 2 14:59:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 56503 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 A1E5C386C59E for ; Tue, 2 Aug 2022 15:00:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1E5C386C59E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659452418; bh=pMQYo/N9qCvs35a/c4CRA5wWo0pbOzfw1u290u4kLHs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YUzgKn7hpGIZSNs4DPx8s8hffaP7Kyz23gyR5TNWF30XJvpEQB/U073pCahENWQ+v AJbw0UNgVsvMIOWn23VJyAEivgqvFpESsz/EEZQOoLQOR97/UK6S62Uewu51M85Buu mUUAo75MjJvrlVRGklaTe6y/k5XpZ+jl1a+INzyY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-vk1-xa2e.google.com (mail-vk1-xa2e.google.com [IPv6:2607:f8b0:4864:20::a2e]) by sourceware.org (Postfix) with ESMTPS id 4033F3852748 for ; Tue, 2 Aug 2022 14:59:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4033F3852748 Received: by mail-vk1-xa2e.google.com with SMTP id v13so4393754vke.3 for ; Tue, 02 Aug 2022 07:59:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pMQYo/N9qCvs35a/c4CRA5wWo0pbOzfw1u290u4kLHs=; b=yUP/DoycsPxA8iFwb4PaLcvfBy0arf/Usqo26AqYSbDL6E9gvmgo94oQPEOwA6OLQV yL5WspiDyR0S0ZCrVcjCk60AwYH6QBK89j8RGZCVT+RmiH5DKBIRjicE+wLT6QgnX1AK AjtWGLSzl7TXJ7o1umbNFSaLVhFaeu+n99U7ekkt3WxRzBI4dkP4Bb8z74A5rKDJr4YO ulP4PoJL3xzoRBcoW2L1T7vHQ1k3UGOe/fDl7dU5sQp6VVF2N6LcOaS/wTU5NYeqgyuP nOqK8UAtUWee5JDRHhiBUoKSD9wuOz+2ztXEQV2vcBAUkoJ+m38kQOBC2CFl1jfWuos/ h6VQ== X-Gm-Message-State: AJIora/4bsDXOJrY7ndIO9uh05mvWIon0tYwmncFpFHluSnmIaA0iU0B XAMARIITfOJFhzBG3v4CfgMKvryTCKWkOQ== X-Google-Smtp-Source: AGRyM1uD5GoKWMXbKxs3wUq3O3A654liRZR085P/v+yDmu6bNlOk8U2BF/Ri/kc3oPWgHGu8oOE/7w== X-Received: by 2002:a1f:4882:0:b0:375:24c4:5484 with SMTP id v124-20020a1f4882000000b0037524c45484mr7999694vka.23.1659452353152; Tue, 02 Aug 2022 07:59:13 -0700 (PDT) Received: from mandiga.. ([2804:431:c7cb:1e34:2331:a60b:db1e:6436]) by smtp.gmail.com with ESMTPSA id v145-20020a1f2f97000000b003762e090ed8sm8000982vkv.49.2022.08.02.07.59.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 07:59:12 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 2/5] Assume only FLAG_ELF_LIBC6 suport Date: Tue, 2 Aug 2022 11:59:02 -0300 Message-Id: <20220802145905.2789733-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> References: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" From: "Lucas A. M. Magalhaes" The older libc versions are obsolete for over twenty years now. This patch removes the special flags for libc5 and libc4 and assumes that all libraries cached are libc6 compatible and use FLAG_ELF_LIBC6. Checked with a build for all affected architectures. Co-authored-by: Adhemerval Zanella Reviewed-by: Adhemerval Zanella --- elf/cache.c | 6 +- elf/ldconfig.c | 63 ++----------------- elf/readelflib.c | 46 ++------------ elf/readlib.c | 25 +------- sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 30 --------- sysdeps/unix/sysv/linux/arc/ldconfig.h | 27 -------- sysdeps/unix/sysv/linux/arm/ldconfig.h | 25 -------- sysdeps/unix/sysv/linux/csky/ldconfig.h | 34 ---------- sysdeps/unix/sysv/linux/i386/ldconfig.h | 6 -- sysdeps/unix/sysv/linux/ia64/ldconfig.h | 24 ------- sysdeps/unix/sysv/linux/m68k/ldconfig.h | 1 - .../unix/sysv/linux/mips/mips64/ldconfig.h | 25 -------- sysdeps/unix/sysv/linux/powerpc/ldconfig.h | 27 -------- sysdeps/unix/sysv/linux/riscv/ldconfig.h | 36 ----------- sysdeps/unix/sysv/linux/s390/ldconfig.h | 7 --- sysdeps/unix/sysv/linux/x86_64/ldconfig.h | 26 -------- 16 files changed, 14 insertions(+), 394 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/arc/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/arm/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/csky/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/ia64/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/m68k/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/powerpc/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/riscv/ldconfig.h delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ldconfig.h diff --git a/elf/cache.c b/elf/cache.c index 3d7d3a67bf..f5f3ef8c4d 100644 --- a/elf/cache.c +++ b/elf/cache.c @@ -157,6 +157,7 @@ struct cache_entry /* List of all cache entries. */ static struct cache_entry *entries; +/* libc4, ELF and libc5 are unsupported. */ static const char *flag_descr[] = { "libc4", "ELF", "libc5", "libc6"}; @@ -168,14 +169,11 @@ print_entry (const char *lib, int flag, uint64_t hwcap, printf ("\t%s (", lib); switch (flag & FLAG_TYPE_MASK) { - case FLAG_LIBC4: - case FLAG_ELF: - case FLAG_ELF_LIBC5: case FLAG_ELF_LIBC6: fputs (flag_descr[flag & FLAG_TYPE_MASK], stdout); break; default: - fputs (_("unknown"), stdout); + fputs (_("unknown or unsupported flag"), stdout); break; } switch (flag & FLAG_REQUIRED_MASK) diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 9394ac6438..6f37f38f35 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -65,19 +65,6 @@ #define PACKAGE _libc_intl_domainname -static const struct -{ - const char *name; - int flag; -} lib_types[] = -{ - {"libc4", FLAG_LIBC4}, - {"libc5", FLAG_ELF_LIBC5}, - {"libc6", FLAG_ELF_LIBC6}, - {"glibc2", FLAG_ELF_LIBC6} -}; - - /* List of directories to handle. */ struct dir_entry { @@ -469,27 +456,8 @@ add_dir_1 (const char *line, const char *from_file, int from_line) entry->from_file = strdup (from_file); entry->from_line = from_line; - /* Search for an '=' sign. */ entry->path = xstrdup (line); - char *equal_sign = strchr (entry->path, '='); - if (equal_sign) - { - *equal_sign = '\0'; - ++equal_sign; - entry->flag = FLAG_ANY; - for (i = 0; i < sizeof (lib_types) / sizeof (lib_types[0]); ++i) - if (strcmp (equal_sign, lib_types[i].name) == 0) - { - entry->flag = lib_types[i].flag; - break; - } - if (entry->flag == FLAG_ANY) - error (0, 0, _("%s is not a known library type"), equal_sign); - } - else - { - entry->flag = FLAG_ANY; - } + entry->flag = FLAG_ELF_LIBC6; /* Canonify path: for now only remove leading and trailing whitespace and the trailing slashes. */ @@ -1054,23 +1022,11 @@ search_dir (const struct dir_entry *entry) soname = xstrdup (direntry->d_name); } - if (flag == FLAG_ELF - && (entry->flag == FLAG_ELF_LIBC5 - || entry->flag == FLAG_ELF_LIBC6)) - flag = entry->flag; - /* Some sanity checks to print warnings. */ if (opt_verbose) { - if (flag == FLAG_ELF_LIBC5 && entry->flag != FLAG_ELF_LIBC5 - && entry->flag != FLAG_ANY) - error (0, 0, _("libc5 library %s in wrong directory"), file_name); - if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6 - && entry->flag != FLAG_ANY) + if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6) error (0, 0, _("libc6 library %s in wrong directory"), file_name); - if (flag == FLAG_LIBC4 && entry->flag != FLAG_LIBC4 - && entry->flag != FLAG_ANY) - error (0, 0, _("libc4 library %s in wrong directory"), file_name); } /* Add library to list. */ @@ -1089,19 +1045,8 @@ search_dir (const struct dir_entry *entry) /* It's newer - add it. */ /* Flag should be the same - sanity check. */ if (dlib_ptr->flag != flag) - { - if (dlib_ptr->flag == FLAG_ELF - && (flag == FLAG_ELF_LIBC5 || flag == FLAG_ELF_LIBC6)) - dlib_ptr->flag = flag; - else if ((dlib_ptr->flag == FLAG_ELF_LIBC5 - || dlib_ptr->flag == FLAG_ELF_LIBC6) - && flag == FLAG_ELF) - dlib_ptr->flag = flag; - else - error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."), - dlib_ptr->name, direntry->d_name, - entry->path); - } + error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."), + dlib_ptr->name, direntry->d_name, entry->path); free (dlib_ptr->name); dlib_ptr->name = xstrdup (direntry->d_name); dlib_ptr->is_link = is_link; diff --git a/elf/readelflib.c b/elf/readelflib.c index 771182b5d0..5f43e0230d 100644 --- a/elf/readelflib.c +++ b/elf/readelflib.c @@ -44,7 +44,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag, size_t file_length) { int i; - unsigned int j; unsigned int dynamic_addr; size_t dynamic_size; char *program_interpreter; @@ -81,9 +80,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag, elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents); check_ptr (elf_pheader); - /* The library is an elf library, now search for soname and - libc5/libc6. */ - *flag = FLAG_ELF; + /* The library is an elf library. */ + *flag = FLAG_ELF_LIBC6; /* The default ISA level is 0. */ *isa_level = 0; @@ -110,16 +108,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag, program_interpreter = (char *) (file_contents + segment->p_offset); check_ptr (program_interpreter); - /* Check if this is enough to classify the binary. */ - for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]); - ++j) - if (strcmp (program_interpreter, interpreters[j].soname) == 0) - { - *flag = interpreters[j].flag; - break; - } - break; - case PT_GNU_PROPERTY: /* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes in 32-bit objects and to 8 bytes in 64-bit objects. Skip @@ -244,38 +232,16 @@ done: if (dynamic_strings == NULL) return 1; - /* Now read the DT_NEEDED and DT_SONAME entries. */ + /* Now read the DT_SONAME entries. */ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++dyn_entry) { - if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) + if (dyn_entry->d_tag == DT_SONAME) { char *name = dynamic_strings + dyn_entry->d_un.d_val; check_ptr (name); - - if (dyn_entry->d_tag == DT_NEEDED) - { - - if (*flag == FLAG_ELF) - { - /* Check if this is enough to classify the binary. */ - for (j = 0; - j < sizeof (known_libs) / sizeof (known_libs [0]); - ++j) - if (strcmp (name, known_libs [j].soname) == 0) - { - *flag = known_libs [j].flag; - break; - } - } - } - - else if (dyn_entry->d_tag == DT_SONAME) - *soname = xstrdup (name); - - /* Do we have everything we need? */ - if (*soname && *flag != FLAG_ELF) - return 0; + *soname = xstrdup (name); + return 0; } } diff --git a/elf/readlib.c b/elf/readlib.c index ed42fbd48e..be65e3d0e9 100644 --- a/elf/readlib.c +++ b/elf/readlib.c @@ -43,24 +43,6 @@ struct known_names int flag; }; -static struct known_names interpreters[] = -{ - { "/lib/" LD_SO, FLAG_ELF_LIBC6 }, -#ifdef SYSDEP_KNOWN_INTERPRETER_NAMES - SYSDEP_KNOWN_INTERPRETER_NAMES -#endif -}; - -static struct known_names known_libs[] = -{ - { LIBC_SO, FLAG_ELF_LIBC6 }, - { LIBM_SO, FLAG_ELF_LIBC6 }, -#ifdef SYSDEP_KNOWN_LIBRARY_NAMES - SYSDEP_KNOWN_LIBRARY_NAMES -#endif -}; - - /* Check if string corresponds to a GDB Python file. */ static bool is_gdb_python_file (const char *name) @@ -83,7 +65,8 @@ process_file (const char *real_file_name, const char *file_name, struct exec *aout_header; ret = 0; - *flag = FLAG_ANY; + /* Just set FLAG_ELF_LIBC6 as old formats are not supported anymore. */ + *flag = FLAG_ELF_LIBC6; *soname = NULL; file = fopen (real_file_name, "rb"); @@ -150,7 +133,6 @@ process_file (const char *real_file_name, const char *file_name, *dot = '\0'; } *soname = copy; - *flag = FLAG_LIBC4; goto done; } @@ -191,9 +173,6 @@ implicit_soname (const char *lib, int flag) { char *soname = xstrdup (lib); - if ((flag & FLAG_TYPE_MASK) != FLAG_LIBC4) - return soname; - /* Aout files don't have a soname, just return the name including the major number. */ char *major = strstr (soname, ".so."); diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h deleted file mode 100644 index 5cbfb32714..0000000000 --- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2009-2022 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 - . */ - -#include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \ - { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/arc/ldconfig.h b/sysdeps/unix/sysv/linux/arc/ldconfig.h deleted file mode 100644 index f673170e59..0000000000 --- a/sysdeps/unix/sysv/linux/arc/ldconfig.h +++ /dev/null @@ -1,27 +0,0 @@ -/* ldconfig default paths and libraries. Linux/RISC-V version. - Copyright (C) 2020-2022 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 - . */ - -#include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib/ld-linux-arc.so.2", FLAG_ELF_LIBC6 }, \ - { "/lib/ld-linux-arceb.so.2", FLAG_ELF_LIBC6 }, - -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/arm/ldconfig.h b/sysdeps/unix/sysv/linux/arm/ldconfig.h deleted file mode 100644 index d1253993ea..0000000000 --- a/sysdeps/unix/sysv/linux/arm/ldconfig.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2001-2022 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 - . */ - -#include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \ - { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/csky/ldconfig.h b/sysdeps/unix/sysv/linux/csky/ldconfig.h deleted file mode 100644 index fbe17e3dc8..0000000000 --- a/sysdeps/unix/sysv/linux/csky/ldconfig.h +++ /dev/null @@ -1,34 +0,0 @@ -/* ldconfig default paths and libraries. Linux/C-SKY version. - Copyright (C) 2018-2022 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 - . */ - -#include - -#define LD_SO_PREFIX "/lib/ld-linux-" -#define LD_SO_SUFFIX ".so.1" - -#ifdef __CSKY_HARD_FLOAT__ -# define LD_SO_ABI "cskyv2-hf" -#else -# define LD_SO_ABI "cskyv2" -#endif - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { LD_SO_PREFIX LD_SO_ABI LD_SO_SUFFIX, FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/i386/ldconfig.h b/sysdeps/unix/sysv/linux/i386/ldconfig.h index bafbec1231..9afda09cca 100644 --- a/sysdeps/unix/sysv/linux/i386/ldconfig.h +++ b/sysdeps/unix/sysv/linux/i386/ldconfig.h @@ -16,9 +16,3 @@ . */ #include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib/ld-linux.so.1", FLAG_ELF_LIBC5 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.5", FLAG_ELF_LIBC5 }, \ - { "libm.so.5", FLAG_ELF_LIBC5 }, diff --git a/sysdeps/unix/sysv/linux/ia64/ldconfig.h b/sysdeps/unix/sysv/linux/ia64/ldconfig.h deleted file mode 100644 index 4731419bf8..0000000000 --- a/sysdeps/unix/sysv/linux/ia64/ldconfig.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 2001-2022 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 - . */ - -#include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/m68k/ldconfig.h b/sysdeps/unix/sysv/linux/m68k/ldconfig.h deleted file mode 100644 index 953f192bcd..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/ldconfig.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h deleted file mode 100644 index ac82941aff..0000000000 --- a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2001-2022 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 - . */ - -#include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib32/ld.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib64/ld.so.1", FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h b/sysdeps/unix/sysv/linux/powerpc/ldconfig.h deleted file mode 100644 index 1d70657838..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h +++ /dev/null @@ -1,27 +0,0 @@ -/* ldconfig default paths and libraries. Linux/PowerPC version. - Copyright (C) 2002-2022 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 - . */ - -#include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib/ld.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib64/ld64.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib64/ld64.so.2", FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/riscv/ldconfig.h b/sysdeps/unix/sysv/linux/riscv/ldconfig.h deleted file mode 100644 index e3847f116e..0000000000 --- a/sysdeps/unix/sysv/linux/riscv/ldconfig.h +++ /dev/null @@ -1,36 +0,0 @@ -/* ldconfig default paths and libraries. Linux/RISC-V version. - Copyright (C) 2001-2022 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 - . */ - -#include - -#define LD_SO_PREFIX "/lib/ld-linux-" -#define LD_SO_SUFFIX ".so.1" - -#if __riscv_xlen == 64 -# define LD_SO_ABI "riscv64-lp64" -#else -# define LD_SO_ABI "riscv32-ilp32" -#endif - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { LD_SO_PREFIX LD_SO_ABI "d" LD_SO_SUFFIX, FLAG_ELF_LIBC6 }, \ - { LD_SO_PREFIX LD_SO_ABI LD_SO_SUFFIX, FLAG_ELF_LIBC6 }, - -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/s390/ldconfig.h b/sysdeps/unix/sysv/linux/s390/ldconfig.h index f564a6eaf6..9afda09cca 100644 --- a/sysdeps/unix/sysv/linux/s390/ldconfig.h +++ b/sysdeps/unix/sysv/linux/s390/ldconfig.h @@ -16,10 +16,3 @@ . */ #include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib/ld.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib/ld64.so.1", FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h deleted file mode 100644 index b67203e017..0000000000 --- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2001-2022 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 - . */ - -#include - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \ - { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \ - { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, From patchwork Tue Aug 2 14:59:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 56501 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 B73B1386EC3C for ; Tue, 2 Aug 2022 14:59:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B73B1386EC3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659452377; bh=1kxPFv9QLFr0edBrahkl+31qlFZ5dWCGXtRqKedvFMQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=J5z3kvVA00eLwkxcgFW5mh2eYmwHBRDqm0jZ/yMKrzsVid6e8o9xLJEaWGvZd2x/Q qJgWlGFRCWj0SKPIA51mG3B1Aup6vKgGiHra3mkSW9wdHscoWmjhb3TR+d2GZcC++W 7KKeKd2pb+vT44LuTuGv4Dl9jEHX5jPu02WPaE/I= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-vk1-xa31.google.com (mail-vk1-xa31.google.com [IPv6:2607:f8b0:4864:20::a31]) by sourceware.org (Postfix) with ESMTPS id 3CDF4385EC53 for ; Tue, 2 Aug 2022 14:59:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3CDF4385EC53 Received: by mail-vk1-xa31.google.com with SMTP id q191so4956380vkb.6 for ; Tue, 02 Aug 2022 07:59: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:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1kxPFv9QLFr0edBrahkl+31qlFZ5dWCGXtRqKedvFMQ=; b=0tq8N6CnoKpzX83oAYPLGlhgreOvfN0Q53W2gVVRjarZYNQ+SI0qfhgtanWO9W54R6 KrP+/AGH5HhQkcEFVjnfR4kD3K4I3Tv0NtWUOueuk5dvXkv/8wcf0/6HVS718xCMYaJH v6BI94mMyA/l6JOvTxLfWhZ0+wFCitXTBb6hXSxSZPGbMmhrc4q9pnMVy2DI3pBBIjZv 2c+LHinfLCnP/GSJiXyY4+T55sMcJj7yA50LejTxHN2KOcywZyatVlYFY7k3FaHx3MdD pGK87+8nYWzE2bzBnCSXRWlqK2hlR/Gv5FkihQ8y/vfowbuIwiGVla6TnJloU8Sy+0Yk sUeg== X-Gm-Message-State: AJIora8RnT8iel5YaNapAkCJEjTgJzP0KotRiYnibsWhpZpmZp5S3baA DVLSwi8K0+Hgn9kwonZG9YziDPeurKHmgA== X-Google-Smtp-Source: AGRyM1sN13BJRnOb8cyEXSJPDgJQrokjCt5s8fv7wtOqnaaIXhhofHGok9/lb0rrubSvWdEs9aH6ig== X-Received: by 2002:a1f:9f4f:0:b0:375:2fb5:b20e with SMTP id i76-20020a1f9f4f000000b003752fb5b20emr7928736vke.22.1659452354182; Tue, 02 Aug 2022 07:59:14 -0700 (PDT) Received: from mandiga.. ([2804:431:c7cb:1e34:2331:a60b:db1e:6436]) by smtp.gmail.com with ESMTPSA id v145-20020a1f2f97000000b003762e090ed8sm8000982vkv.49.2022.08.02.07.59.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 07:59:13 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 3/5] Remove ldd libc4 support Date: Tue, 2 Aug 2022 11:59:03 -0300 Message-Id: <20220802145905.2789733-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> References: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The older libc versions are obsolete for over twenty years now. --- Makeconfig | 4 +- sysdeps/unix/sysv/linux/Makefile | 2 - sysdeps/unix/sysv/linux/csky/configure | 1 - sysdeps/unix/sysv/linux/csky/configure.ac | 1 - sysdeps/unix/sysv/linux/i386/Makefile | 5 - sysdeps/unix/sysv/linux/i386/configure | 1 - sysdeps/unix/sysv/linux/i386/configure.ac | 1 - sysdeps/unix/sysv/linux/ldd-rewrite.sed | 10 -- sysdeps/unix/sysv/linux/lddlibc4.c | 104 ------------------ sysdeps/unix/sysv/linux/m68k/Makefile | 4 - sysdeps/unix/sysv/linux/m68k/configure | 1 - sysdeps/unix/sysv/linux/m68k/configure.ac | 1 - .../unix/sysv/linux/sparc/sparc32/Makefile | 2 - 13 files changed, 2 insertions(+), 135 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/ldd-rewrite.sed delete mode 100644 sysdeps/unix/sysv/linux/lddlibc4.c diff --git a/Makeconfig b/Makeconfig index ba70321af1..e78cf220af 100644 --- a/Makeconfig +++ b/Makeconfig @@ -866,7 +866,7 @@ endif +extra-math-flags = $(if $(filter libm,$(in-module)),-fno-math-errno,-fmath-errno) # Use 64 bit time_t support for installed programs -installed-modules = nonlib nscd lddlibc4 ldconfig locale_programs \ +installed-modules = nonlib nscd ldconfig locale_programs \ iconvprogs libnss_files libnss_compat libnss_db libnss_hesiod \ libutil libpcprofile libSegFault +extra-time-flags = $(if $(filter $(installed-modules),\ @@ -966,7 +966,7 @@ endif # $(+cflags) == "" libio-include = -I$(..)libio # List of non-library modules that we build. -built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \ +built-modules = iconvprogs iconvdata ldconfig libmemusage \ libSegFault libpcprofile librpcsvc locale-programs \ memusagestat nonlib nscd extramodules libnldbl libsupport \ testsuite testsuite-internal diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index a139a16532..3f31c19e4a 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -393,8 +393,6 @@ endif ifeq ($(subdir),elf) sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir -libof-lddlibc4 = lddlibc4 - others += pldd install-bin += pldd $(objpfx)pldd: $(objpfx)xmalloc.o diff --git a/sysdeps/unix/sysv/linux/csky/configure b/sysdeps/unix/sysv/linux/csky/configure index 20dc0df8e6..b36cee5b7b 100644 --- a/sysdeps/unix/sysv/linux/csky/configure +++ b/sysdeps/unix/sysv/linux/csky/configure @@ -2,4 +2,3 @@ # Local configure fragment for sysdeps/unix/sysv/linux/csky arch_minimum_kernel=4.20.0 -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed diff --git a/sysdeps/unix/sysv/linux/csky/configure.ac b/sysdeps/unix/sysv/linux/csky/configure.ac index 89448969d4..efcd375cd2 100644 --- a/sysdeps/unix/sysv/linux/csky/configure.ac +++ b/sysdeps/unix/sysv/linux/csky/configure.ac @@ -2,4 +2,3 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/unix/sysv/linux/csky arch_minimum_kernel=4.20.0 -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile index 598e27dcda..f1f8c3f44c 100644 --- a/sysdeps/unix/sysv/linux/i386/Makefile +++ b/sysdeps/unix/sysv/linux/i386/Makefile @@ -7,11 +7,6 @@ sysdep_routines += ioperm iopl vm86 tests += tst-bz21269 endif -ifeq ($(subdir),elf) -sysdep-others += lddlibc4 -install-bin += lddlibc4 -endif - ifeq ($(subdir),io) sysdep_routines += libc-do-syscall libc-do-syscall-int80 endif diff --git a/sysdeps/unix/sysv/linux/i386/configure b/sysdeps/unix/sysv/linux/i386/configure index f119e62fc3..351d82355a 100644 --- a/sysdeps/unix/sysv/linux/i386/configure +++ b/sysdeps/unix/sysv/linux/i386/configure @@ -2,4 +2,3 @@ # Local configure fragment for sysdeps/unix/sysv/linux/i386. libc_cv_gcc_unwind_find_fde=yes -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed diff --git a/sysdeps/unix/sysv/linux/i386/configure.ac b/sysdeps/unix/sysv/linux/i386/configure.ac index 64ab2cc2c8..61c04f2f49 100644 --- a/sysdeps/unix/sysv/linux/i386/configure.ac +++ b/sysdeps/unix/sysv/linux/i386/configure.ac @@ -2,4 +2,3 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/unix/sysv/linux/i386. libc_cv_gcc_unwind_find_fde=yes -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed diff --git a/sysdeps/unix/sysv/linux/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ldd-rewrite.sed deleted file mode 100644 index 1faa90fbc8..0000000000 --- a/sysdeps/unix/sysv/linux/ldd-rewrite.sed +++ /dev/null @@ -1,10 +0,0 @@ -/Maybe extra code for non-ELF binaries/a\ - file=$1\ - # Run the ldd stub.\ - lddlibc4 "$file"\ - # Test the result.\ - if test $? -lt 3; then\ - return 0;\ - fi\ - # In case of an error punt. -/LD_TRACE_LOADED_OBJECTS=1/a\ diff --git a/sysdeps/unix/sysv/linux/lddlibc4.c b/sysdeps/unix/sysv/linux/lddlibc4.c deleted file mode 100644 index 153d2ad183..0000000000 --- a/sysdeps/unix/sysv/linux/lddlibc4.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Stub for ldd script to print Linux libc4 dependencies. - Copyright (C) 1998-2022 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 - . */ - -/* This code is based on the `ldd' program code from the Linux ld.so - package. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Get libc version number. */ -#include "../version.h" - -#define PACKAGE _libc_intl_domainname - - -int -main (int argc, char *argv[]) -{ - const char *filename; - size_t filename_len; - struct exec exec; - char *buf; - FILE *fp; - - /* Set locale via LC_ALL. */ - setlocale (LC_ALL, ""); - - /* Set the text message domain. */ - textdomain (PACKAGE); - - /* We expect exactly one argument. */ - if (argc != 2) - return 1; - - if (strcmp (argv[1], "--help") == 0) - { - printf (gettext ("Usage: lddlibc4 FILE\n\n")); - printf (gettext ("For bug reporting instructions, please see:\n\ -%s.\n"), REPORT_BUGS_TO); - return 0; - } - else if (strcmp (argv[1], "--version") == 0) - { - printf ("lddlibc4 %s%s\n", PKGVERSION, VERSION); - printf (gettext ("\ -Copyright (C) %s Free Software Foundation, Inc.\n\ -This is free software; see the source for copying conditions. There is NO\n\ -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2022"); - return 0; - } - - filename = argv[1]; - - /* First see whether this is really an a.out binary. */ - fp = fopen (filename, "rb"); - if (fp == NULL) - error (2, errno, gettext ("cannot open `%s'"), filename); - - /* Read the program header. */ - if (fread (&exec, sizeof exec, 1, fp) < 1) - error (2, errno, gettext ("cannot read header from `%s'"), filename); - - /* Test for the magic numbers. */ - if (N_MAGIC (exec) != ZMAGIC && N_MAGIC (exec) != QMAGIC - && N_MAGIC (exec) != OMAGIC) - exit (3); - - /* We don't need the file open anymore. */ - fclose (fp); - - /* We must put `__LDD_ARGV0=' in the environment. */ - filename_len = strlen (filename); - buf = (char *) alloca (sizeof "__LDD_ARGV0=" + filename_len); - mempcpy (mempcpy (buf, "__LDD_ARGV0=", sizeof "__LDD_ARGV0=" - 1), - filename, filename_len + 1); - /* ...and put the value in the environment. */ - putenv (buf); - - /* Now we can execute the binary. */ - return execv (filename, &argv[argc]) ? 4 : 0; -} diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile index 18ad2bf0ee..72d5bff992 100644 --- a/sysdeps/unix/sysv/linux/m68k/Makefile +++ b/sysdeps/unix/sysv/linux/m68k/Makefile @@ -16,7 +16,3 @@ sysdep_routines += mremap sysdep_headers += sys/reg.h endif -ifeq ($(subdir),elf) -sysdep-others += lddlibc4 -install-bin += lddlibc4 -endif diff --git a/sysdeps/unix/sysv/linux/m68k/configure b/sysdeps/unix/sysv/linux/m68k/configure index 8e955387b7..aa295f80cb 100644 --- a/sysdeps/unix/sysv/linux/m68k/configure +++ b/sysdeps/unix/sysv/linux/m68k/configure @@ -6,4 +6,3 @@ m68k/coldfire) libc_cv_gcc_unwind_find_fde=yes ;; esac -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed diff --git a/sysdeps/unix/sysv/linux/m68k/configure.ac b/sysdeps/unix/sysv/linux/m68k/configure.ac index c21ca9dd47..0e547f2f2e 100644 --- a/sysdeps/unix/sysv/linux/m68k/configure.ac +++ b/sysdeps/unix/sysv/linux/m68k/configure.ac @@ -7,4 +7,3 @@ m68k/coldfire) libc_cv_gcc_unwind_find_fde=yes ;; esac -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile index 21c7dc1680..167307cc78 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile @@ -13,8 +13,6 @@ endif ifeq ($(subdir),elf) CFLAGS-rtld.c += -mcpu=v8 #rtld-routines += dl-sysdepsparc -sysdep-others += lddlibc4 -install-bin += lddlibc4 endif # elf ifeq ($(subdir),math) From patchwork Tue Aug 2 14:59:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 56502 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 73F23384B0D6 for ; Tue, 2 Aug 2022 15:00:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73F23384B0D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659452413; bh=Yw3I0a+kV+bZu+tHa1xIvFd6H98qx5M5tf68SeXll10=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=yD4/fe5Tj5M+5fYqXhUEVic+PuDgaU0ondb8U8Ok8u9wZMrekOJsUUGvUSrq97AS9 H40r1mtK13neuqTAQAgxecmkYIuH6qCdCq8yRSfRD/xoGkLBjdkRNFI0CREINaOMFB oJ/4A01+aKh49scoqBwmbV7KiqDDDvSN9IUj4tbM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-vs1-xe2e.google.com (mail-vs1-xe2e.google.com [IPv6:2607:f8b0:4864:20::e2e]) by sourceware.org (Postfix) with ESMTPS id 33FE53852752 for ; Tue, 2 Aug 2022 14:59:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 33FE53852752 Received: by mail-vs1-xe2e.google.com with SMTP id c3so14825797vsc.6 for ; Tue, 02 Aug 2022 07:59:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yw3I0a+kV+bZu+tHa1xIvFd6H98qx5M5tf68SeXll10=; b=5h2yXyiaiWGbUDSM6XNGVxOUYO4FEAzqGRbY5duCza6taH03ZOeA8GI5RMuMZGwIzQ rq70HIUloZDLynj3ZEbd5GySuammB9pdcipIq1RCUIHHsZ8qFAVdKwX/hr5CtHlec/Fc 5vPBQEs6c2DETDRKn1Ysd9qCZAVq5CCYiZQbfnjKFhQMw2U8I0zlUgJESL9usKJGFx3R ohGQjN7GssNcIbBP3K0v0zcjK+Bc/CnMA/toJ5Td139GQBFH1R2LUnSF90p8kuAAe2Mx sAX+AqBVdXgyKHHn3ikesAaebgXe/FFGZ0KrLOcHJU094bfhETHgXLuzdNzhJr9s5z+5 nLMw== X-Gm-Message-State: ACgBeo0vKOHyWHETqTip7MJ//HJL1qpISyE77QxhH000BccdZwZ3ygOc lSye9cT4sGAV4cachCjomdv8PUr30+biBw== X-Google-Smtp-Source: AA6agR4nwTE8J86cVAleQbs83gRHFvsqrHmGGMKWQxYKbXcEgDj5hWlfEWlJQn0PAIHyHLUh2VRKrA== X-Received: by 2002:a05:6102:3a54:b0:388:47e0:c002 with SMTP id c20-20020a0561023a5400b0038847e0c002mr624246vsu.4.1659452355256; Tue, 02 Aug 2022 07:59:15 -0700 (PDT) Received: from mandiga.. ([2804:431:c7cb:1e34:2331:a60b:db1e:6436]) by smtp.gmail.com with ESMTPSA id v145-20020a1f2f97000000b003762e090ed8sm8000982vkv.49.2022.08.02.07.59.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 07:59:15 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 4/5] arm: Remove RELA support Date: Tue, 2 Aug 2022 11:59:04 -0300 Message-Id: <20220802145905.2789733-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> References: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Now that prelink is not support, there is no need to keep supporting rela for non bootstrap. --- sysdeps/arm/dl-machine-rel.h | 7 +-- sysdeps/arm/dl-machine.h | 100 ----------------------------------- 2 files changed, 1 insertion(+), 106 deletions(-) diff --git a/sysdeps/arm/dl-machine-rel.h b/sysdeps/arm/dl-machine-rel.h index 999967931b..9dfaf718f2 100644 --- a/sysdeps/arm/dl-machine-rel.h +++ b/sysdeps/arm/dl-machine-rel.h @@ -19,13 +19,8 @@ #ifndef _DL_MACHINE_REL_H #define _DL_MACHINE_REL_H -/* ARM never uses Elf32_Rela relocations for the dynamic linker. - Prelinked libraries may use Elf32_Rela though. */ -#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP +#define ELF_MACHINE_NO_RELA 1 #define ELF_MACHINE_NO_REL 0 - -/* ARM never uses Elf32_Rela relocations for the dynamic linker. - Prelinked libraries may use Elf32_Rela though. */ #define ELF_MACHINE_PLT_REL 1 #define PLTREL ElfW(Rel) diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 6a422713bd..4e78d8fb0e 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -447,96 +447,6 @@ elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[], } } -# ifndef RTLD_BOOTSTRAP -static inline void -__attribute__ ((always_inline)) -elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], - const Elf32_Rela *reloc, const Elf32_Sym *sym, - const struct r_found_version *version, - void *const reloc_addr_arg, int skip_ifunc) -{ - Elf32_Addr *const reloc_addr = reloc_addr_arg; - const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); - - if (__builtin_expect (r_type == R_ARM_RELATIVE, 0)) - *reloc_addr = map->l_addr + reloc->r_addend; - else if (__builtin_expect (r_type == R_ARM_NONE, 0)) - return; - else - { - const Elf32_Sym *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type); - Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); - - if (sym != NULL - && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0) - && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) - && __builtin_expect (!skip_ifunc, 1)) - value = elf_ifunc_invoke (value); - - switch (r_type) - { - /* Not needed for dl-conflict.c. */ - case R_ARM_COPY: - if (sym == NULL) - /* This can happen in trace mode if an object could not be - found. */ - break; - if (sym->st_size > refsym->st_size - || (GLRO(dl_verbose) && sym->st_size < refsym->st_size)) - { - const char *strtab; - - strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]); - _dl_error_printf ("\ -%s: Symbol `%s' has different size in shared object, consider re-linking\n", - RTLD_PROGNAME, strtab + refsym->st_name); - } - memcpy (reloc_addr_arg, (void *) value, - MIN (sym->st_size, refsym->st_size)); - break; - case R_ARM_GLOB_DAT: - case R_ARM_JUMP_SLOT: - case R_ARM_ABS32: - *reloc_addr = value + reloc->r_addend; - break; - case R_ARM_PC24: - relocate_pc24 (map, value, reloc_addr, reloc->r_addend); - break; -#if !defined RTLD_BOOTSTRAP - case R_ARM_TLS_DTPMOD32: - /* Get the information from the link map returned by the - resolv function. */ - if (sym_map != NULL) - *reloc_addr = sym_map->l_tls_modid; - break; - - case R_ARM_TLS_DTPOFF32: - *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend; - break; - - case R_ARM_TLS_TPOFF32: - if (sym != NULL) - { - CHECK_STATIC_TLS (map, sym_map); - *reloc_addr = (sym->st_value + sym_map->l_tls_offset - + reloc->r_addend); - } - break; - case R_ARM_IRELATIVE: - value = map->l_addr + reloc->r_addend; - if (__glibc_likely (!skip_ifunc)) - value = ((Elf32_Addr (*) (int)) value) (GLRO(dl_hwcap)); - *reloc_addr = value; - break; -#endif - default: - _dl_reloc_bad_type (map, r_type, 0); - break; - } - } -} -# endif static inline void __attribute__ ((always_inline)) @@ -547,16 +457,6 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc, *reloc_addr += l_addr; } -# ifndef RTLD_BOOTSTRAP -static inline void -__attribute__ ((always_inline)) -elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, - void *const reloc_addr_arg) -{ - Elf32_Addr *const reloc_addr = reloc_addr_arg; - *reloc_addr = l_addr + reloc->r_addend; -} -# endif static inline void __attribute__ ((always_inline)) From patchwork Tue Aug 2 14:59:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 56504 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 4183B384B0E7 for ; Tue, 2 Aug 2022 15:01:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4183B384B0E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659452462; bh=OeozzfJDh+SCf06jxYxfSYZYrthd2tAY1O59Nt4+oWU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=vIZX+9so+QJzOwlYuoO82tOJSbNaAKo4CDlrKJmQpVVUBGFR4lzRJykzvhGfjxrD6 8gt7lfKw9LfGzqzZi4YRRUkgJ1KLr7SKlB3sSbP7oRcAMOO7ogK86OZ8tk5zwf3jBq XMBWqf7xX+QC5Ubcf3+CAWVX/rwfReTbhM5i16HY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by sourceware.org (Postfix) with ESMTPS id 657773851AA8 for ; Tue, 2 Aug 2022 14:59:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 657773851AA8 Received: by mail-vk1-xa29.google.com with SMTP id q14so5733845vke.9 for ; Tue, 02 Aug 2022 07:59:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OeozzfJDh+SCf06jxYxfSYZYrthd2tAY1O59Nt4+oWU=; b=y0/AHpBtkFGIc2kNDAzhD5GGyqwffR6d92qcVfVuDvEzQvEsSr6el8DVSKRpO+IpB6 EujQRx00x6pf4dAzLh1yOTeyTFkVaDVWeiERnWqxDt1l5M2z2x5HJlgoBGTRezOkvFQ0 J8NdX16RdX3o1rkg4xKFdbNQ989WX1URZIoT5Aipuo8JEBCGK/b5MaHb5qoGsXTtwxnH mA9DNdh/7in1SAqtVG0M2w6k8CdVZAs8uF9vgr8bRNbcX3ak77deVK+DGsvgfQDvC1KQ /Er5DaoKXgg5cLHShy+QkLVQ9rl0j7QRnEcLoYALr+43WE/12vhONENe6+cAy5J9020l Lp2g== X-Gm-Message-State: AJIora8zC5MvlC/bmMyyj3lceqZK721FavyQZ2mj5diWlzG7f233p2X/ 8bklZvmbDFCtgdB6M8ioO8o/PPir0lWhTA== X-Google-Smtp-Source: AGRyM1syL7qvQ1PQRL4Xh11SwcBEOttn7Jj5o1XmF/2KNQ1lmyHnS2GWpIs33nwjgxGrhHps53mSUQ== X-Received: by 2002:a1f:dac3:0:b0:377:8cb:4544 with SMTP id r186-20020a1fdac3000000b0037708cb4544mr7326149vkg.7.1659452356348; Tue, 02 Aug 2022 07:59:16 -0700 (PDT) Received: from mandiga.. ([2804:431:c7cb:1e34:2331:a60b:db1e:6436]) by smtp.gmail.com with ESMTPSA id v145-20020a1f2f97000000b003762e090ed8sm8000982vkv.49.2022.08.02.07.59.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 07:59:16 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 5/5] i386: Remove RELA support Date: Tue, 2 Aug 2022 11:59:05 -0300 Message-Id: <20220802145905.2789733-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> References: <20220802145905.2789733-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Now that prelink is not support, there is no need to keep supporting rela for non bootstrap. --- sysdeps/i386/dl-machine-rel.h | 7 +- sysdeps/i386/dl-machine.h | 191 ---------------------------------- 2 files changed, 1 insertion(+), 197 deletions(-) diff --git a/sysdeps/i386/dl-machine-rel.h b/sysdeps/i386/dl-machine-rel.h index b98273aead..9dfaf718f2 100644 --- a/sysdeps/i386/dl-machine-rel.h +++ b/sysdeps/i386/dl-machine-rel.h @@ -19,13 +19,8 @@ #ifndef _DL_MACHINE_REL_H #define _DL_MACHINE_REL_H -/* The i386 never uses Elf32_Rela relocations for the dynamic linker. - Prelinked libraries may use Elf32_Rela though. */ -#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP +#define ELF_MACHINE_NO_RELA 1 #define ELF_MACHINE_NO_REL 0 - -/* The i386 never uses Elf32_Rela relocations for the dynamic linker. - Prelinked libraries may use Elf32_Rela though. */ #define ELF_MACHINE_PLT_REL 1 #define PLTREL ElfW(Rel) diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 56a189fda2..64aad6e787 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -437,153 +437,6 @@ and creates an unsatisfiable circular dependency.\n", } } -# ifndef RTLD_BOOTSTRAP -static inline void -__attribute__ ((always_inline)) -elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], - const Elf32_Rela *reloc, const Elf32_Sym *sym, - const struct r_found_version *version, - void *const reloc_addr_arg, int skip_ifunc) -{ - Elf32_Addr *const reloc_addr = reloc_addr_arg; - const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); - - if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE) - *reloc_addr = map->l_addr + reloc->r_addend; - else if (r_type != R_386_NONE) - { - const Elf32_Sym *const refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, - r_type); - Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true); - - if (sym != NULL - && __glibc_likely (sym->st_shndx != SHN_UNDEF) - && __glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC) - && __glibc_likely (!skip_ifunc)) - value = ((Elf32_Addr (*) (void)) value) (); - - switch (ELF32_R_TYPE (reloc->r_info)) - { - case R_386_SIZE32: - /* Set to symbol size plus addend. */ - value = sym->st_size; - /* Fall through. */ - case R_386_GLOB_DAT: - case R_386_JMP_SLOT: - case R_386_32: - *reloc_addr = value + reloc->r_addend; - break; - /* Not needed for dl-conflict.c. */ - case R_386_PC32: - *reloc_addr = (value + reloc->r_addend - (Elf32_Addr) reloc_addr); - break; - - case R_386_TLS_DTPMOD32: - /* Get the information from the link map returned by the - resolv function. */ - if (sym_map != NULL) - *reloc_addr = sym_map->l_tls_modid; - break; - case R_386_TLS_DTPOFF32: - /* During relocation all TLS symbols are defined and used. - Therefore the offset is already correct. */ - *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend; - break; - case R_386_TLS_DESC: - { - struct tlsdesc volatile *td = - (struct tlsdesc volatile *)reloc_addr; - -# ifndef RTLD_BOOTSTRAP - if (!sym) - { - td->arg = (void*)reloc->r_addend; - td->entry = _dl_tlsdesc_undefweak; - } - else -# endif - { -# ifndef RTLD_BOOTSTRAP -# ifndef SHARED - CHECK_STATIC_TLS (map, sym_map); -# else - if (!TRY_STATIC_TLS (map, sym_map)) - { - td->arg = _dl_make_tlsdesc_dynamic - (sym_map, sym->st_value + reloc->r_addend); - td->entry = _dl_tlsdesc_dynamic; - } - else -# endif -# endif - { - td->arg = (void*)(sym->st_value - sym_map->l_tls_offset - + reloc->r_addend); - td->entry = _dl_tlsdesc_return; - } - } - } - break; - case R_386_TLS_TPOFF32: - /* The offset is positive, backward from the thread pointer. */ - /* We know the offset of object the symbol is contained in. - It is a positive value which will be subtracted from the - thread pointer. To get the variable position in the TLS - block we subtract the offset from that of the TLS block. */ - if (sym != NULL) - { - CHECK_STATIC_TLS (map, sym_map); - *reloc_addr = sym_map->l_tls_offset - sym->st_value - + reloc->r_addend; - } - break; - case R_386_TLS_TPOFF: - /* The offset is negative, forward from the thread pointer. */ - /* We know the offset of object the symbol is contained in. - It is a negative value which will be added to the - thread pointer. */ - if (sym != NULL) - { - CHECK_STATIC_TLS (map, sym_map); - *reloc_addr = sym->st_value - sym_map->l_tls_offset - + reloc->r_addend; - } - break; - case R_386_COPY: - if (sym == NULL) - /* This can happen in trace mode if an object could not be - found. */ - break; - if (__glibc_unlikely (sym->st_size > refsym->st_size) - || (__glibc_unlikely (sym->st_size < refsym->st_size) - && GLRO(dl_verbose))) - { - const char *strtab; - - strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]); - _dl_error_printf ("\ -%s: Symbol `%s' has different size in shared object, consider re-linking\n", - RTLD_PROGNAME, strtab + refsym->st_name); - } - memcpy (reloc_addr_arg, (void *) value, - MIN (sym->st_size, refsym->st_size)); - break; - case R_386_IRELATIVE: - value = map->l_addr + reloc->r_addend; - if (__glibc_likely (!skip_ifunc)) - value = ((Elf32_Addr (*) (void)) value) (); - *reloc_addr = value; - break; - default: - /* We add these checks in the version to relocate ld.so only - if we are still debugging. */ - _dl_reloc_bad_type (map, r_type, 0); - break; - } - } -} -# endif /* !RTLD_BOOTSTRAP */ static inline void __attribute ((always_inline)) @@ -664,48 +517,4 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], _dl_reloc_bad_type (map, r_type, 1); } -# ifndef RTLD_BOOTSTRAP - -static inline void -__attribute__ ((always_inline)) -elf_machine_lazy_rela (struct link_map *map, struct r_scope_elem *scope[], - Elf32_Addr l_addr, const Elf32_Rela *reloc, - int skip_ifunc) -{ - Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); - const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); - if (__glibc_likely (r_type == R_386_JMP_SLOT)) - ; - else if (__glibc_likely (r_type == R_386_TLS_DESC)) - { - const Elf_Symndx symndx = ELFW (R_SYM) (reloc->r_info); - const ElfW (Sym) *symtab = (const void *)D_PTR (map, l_info[DT_SYMTAB]); - const ElfW (Sym) *sym = &symtab[symndx]; - const struct r_found_version *version = NULL; - - if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL) - { - const ElfW (Half) *vernum = - (const void *)D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]); - version = &map->l_versions[vernum[symndx] & 0x7fff]; - } - - /* Always initialize TLS descriptors completely at load time, in - case static TLS is allocated for it that requires locking. */ - elf_machine_rela (map, scope, reloc, sym, version, reloc_addr, - skip_ifunc); - } - else if (__glibc_unlikely (r_type == R_386_IRELATIVE)) - { - Elf32_Addr value = map->l_addr + reloc->r_addend; - if (__glibc_likely (!skip_ifunc)) - value = ((Elf32_Addr (*) (void)) value) (); - *reloc_addr = value; - } - else - _dl_reloc_bad_type (map, r_type, 1); -} - -# endif /* !RTLD_BOOTSTRAP */ - #endif /* RESOLVE_MAP */