From patchwork Thu Sep 15 19:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 1678403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TXVCSyCK; dkim-atps=neutral Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MT6lG1SR0z1ynm for ; Fri, 16 Sep 2022 05:31:38 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id F3DEC35206C5; Thu, 15 Sep 2022 21:31:32 +0200 (CEST) Authentication-Results: helium.openadk.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TXVCSyCK; dkim-atps=neutral Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by helium.openadk.org (Postfix) with ESMTPS id 36AA63520778 for ; Thu, 15 Sep 2022 21:31:19 +0200 (CEST) Received: by mail-pg1-f176.google.com with SMTP id q9so9109532pgq.8 for ; Thu, 15 Sep 2022 12:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=FqzC2H3gUVeC4Tvz1i/odQjzv68bPKhYDtq5fGmgBqU=; b=TXVCSyCKPT1Cm59K8AOOj2a5bYuB0BCjFKV7EI0j/hHFb6amuDgvxOWsLGUmYnD1F2 dAm5VQTtx1qVmhowxWQWkvd6RfB7GottJZFCD8O9bcbec3+WoLKwAzUFotbKk0h6UT/I wlPT82QD7mC6t/74riTbbbDEIJQXZCoQjdxuhBvY7XYW8nSUhWKE8dDqdKERCy96Wy9J 4GWLgEvDTIEb2HfVzvrmmcDR4/8BRftEdrtP7DhO1OGvCn8bupT+YfwcxvPaQkp475kX 8YFmmpaxEsx9FrWdDQp6ldsobjsC4g44Kxc7iPIrtAoCVkyh5zhrNkOIu0kG2Jf3ve+h 5OOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=FqzC2H3gUVeC4Tvz1i/odQjzv68bPKhYDtq5fGmgBqU=; b=VhO+cPtIt8giF1GAIZWKEpJnBSBJd2Q8SngczkmG0yWdpEvzX5npx3Awd6Nb5p/k0n ppJkz7zLt1C5Ebpa9JF2NxKrpVcPFWD/DQV0QiT26Nto9/4rnFuMDxsnOtK1AUX1b2G/ pk5mNBUTvk3G9ihsVHvAPUSB2FVToBivzpJzdp3g2VVq7BkKcsQG2qE/4BT53oVdDQag LYWKygDDeYB4C1nCKrvj/hygPtzNp43OzIS49JNrqajJ8HJp4ol9YDIPQqmb1EPQ0Hjd ZMl1OC0wuLVAPss6CMUGqRpwS4rfhL8BAVXlFEgSQ+bn8x0t7/5GnIeGatqfehMfP5kt dzdA== X-Gm-Message-State: ACrzQf2VPft5c4wDGG6+8lDOgc9tvhKYhiWgtE3OJSPJFQggefYbKLgQ XKAJWiqr0bulIVdNqJhklbObSePpRmUasw== X-Google-Smtp-Source: AMsMyM6GUxfHa1kcKlv3skzx/A8A2b0xDwTz9o7Rj30JnksXvb16gzV+m2ZV70TsvqBjd+rImQT/Mg== X-Received: by 2002:a05:6a00:124f:b0:542:6c43:5be8 with SMTP id u15-20020a056a00124f00b005426c435be8mr1377308pfi.5.1663270275767; Thu, 15 Sep 2022 12:31:15 -0700 (PDT) Received: from octofox.metropolis (c-24-130-93-68.hsd1.ca.comcast.net. [24.130.93.68]) by smtp.gmail.com with ESMTPSA id n9-20020a170902e54900b00174be817124sm13418743plf.221.2022.09.15.12.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 12:31:15 -0700 (PDT) From: Max Filippov To: devel@uclibc-ng.org Date: Thu, 15 Sep 2022 12:30:51 -0700 Message-Id: <20220915193054.2916840-3-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220915193054.2916840-1-jcmvbkbc@gmail.com> References: <20220915193054.2916840-1-jcmvbkbc@gmail.com> MIME-Version: 1.0 Message-ID-Hash: B5NZ7OZLXYQUIAYO6NHRTM7RZDYUIMMV X-Message-ID-Hash: B5NZ7OZLXYQUIAYO6NHRTM7RZDYUIMMV X-MailFrom: jcmvbkbc@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: linted X-Mailman-Version: 3.3.3 Precedence: list Subject: [uclibc-ng-devel] [PATCH v2 2/5] ldso: clean up PERFORM_BOOTSTRAP_GOT ifdeferry List-Id: uClibc-ng Development Archived-At: List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 3 architectures currently define PERFORM_BOOTSTRAP_GOT: avr32, mips and xtensa. A block of code that applies relative relocations in the DL_START is disabled when PERFORM_BOOTSTRAP_GOT is defined, unless it's avr32 or mips, effectively disabling it only for xtensa. This may be simplified by removing the call to elf_machine_relative from the xtensa PERFORM_BOOTSTRAP_GOT and always using common code. Signed-off-by: Max Filippov --- Changes v1->v2: - new patch ldso/ldso/dl-startup.c | 3 --- ldso/ldso/xtensa/dl-startup.h | 11 ----------- 2 files changed, 14 deletions(-) diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index 24b046c62b0b..a1b3d49fdd39 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -255,8 +255,6 @@ DL_START(unsigned long args) PERFORM_BOOTSTRAP_GOT(tpnt); #endif -#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__) || defined(__mips__) - /* OK, now do the relocations. We do not do a lazy binding here, so that once we are done, we have considerably more flexibility. */ SEND_EARLY_STDERR_DEBUG("About to do library loader relocations\n"); @@ -337,7 +335,6 @@ DL_START(unsigned long args) #endif } } -#endif SEND_STDERR_DEBUG("Done relocating ldso; we can now use globals and make function calls!\n"); diff --git a/ldso/ldso/xtensa/dl-startup.h b/ldso/ldso/xtensa/dl-startup.h index db223feadc90..92877aa016fb 100644 --- a/ldso/ldso/xtensa/dl-startup.h +++ b/ldso/ldso/xtensa/dl-startup.h @@ -92,8 +92,6 @@ __asm__ ( do { \ xtensa_got_location *got_loc; \ unsigned long l_addr = tpnt->loadaddr; \ - Elf32_Word relative_count; \ - unsigned long rel_addr; \ Elf32_Addr prev_got_start = 0, prev_got_end = 0; \ int x; \ \ @@ -125,13 +123,4 @@ do { \ prev_got_end - prev_got_start, \ PROT_READ | PROT_WRITE | PROT_EXEC); \ } \ -\ - /* The following is a stripped down version of the code following \ - the invocation of PERFORM_BOOTSTRAP_GOT in dl-startup.c. That \ - code is skipped when PERFORM_BOOTSTRAP_GOT is defined, so it has \ - to be done here instead. */ \ - relative_count = tpnt->dynamic_info[DT_RELCONT_IDX]; \ - rel_addr = tpnt->dynamic_info[DT_RELOC_TABLE_ADDR]; \ - if (rel_addr) \ - elf_machine_relative(load_addr, rel_addr, relative_count); \ } while (0)