From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by sourceware.org (Postfix) with ESMTPS id 917393895FE0 for ; Thu, 23 Jun 2022 03:38:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 917393895FE0 Received: by mail-yb1-xb2a.google.com with SMTP id r3so33640206ybr.6 for ; Wed, 22 Jun 2022 20:38:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=MmjD1yAzyXedP+Kge0+RW6f3Qx+TXX8luXzV50YYQGk=; b=jcNRpoQyAf+cESYrw4JhbeBD2AO9w8CVEu4mPV86oZZz6PRZ6fe4Y/MiEhadnJp5Gd ltqxhuy/3m9O4B6VwHS1svD/OZ3abxLuL/bpJngHExdekjc9ld4h4ogszR7tmuKIBiqe MmXbCN0pk/2IXQk0vDTiwVZzatCfx6cyM6h/9GnTZFSIAT6p7XslYuTxXwgZPrs7wmO8 msrTE1YOeoX6xMqvWi+0ARNsmlqPkk0PhkXv28hHCT8v93DyrB+y6RN4sdreOzIYP8ui 0Hk8QoqV6WM+5HMEwyERxF7J4JtfVE+Pi6zLkRGWpPZKij51S0QI3vHl4MLzm4oXCwxv WR3Q== X-Gm-Message-State: AJIora9koEhG3jXrwZIE0to1ijftIRYBRckc86F7KuaVqn3bbKtscsvl QCyvisBWCCCQUZn4St5qnE5/MQ6qFNZ/oPJmCd5J8ZgmMAc= X-Google-Smtp-Source: AGRyM1u6CEEgfFmKn2jkOlKo2mn61+ndI4LMzZQXntnRJa0QsGmTm3vLTrGjC0xsQ+dnt5XWmw1hbKIN+7E30/voH4g= X-Received: by 2002:a25:c7d1:0:b0:668:ade9:3c1c with SMTP id w200-20020a25c7d1000000b00668ade93c1cmr7326989ybe.572.1655955532669; Wed, 22 Jun 2022 20:38:52 -0700 (PDT) MIME-Version: 1.0 References: <20220602042715.2999013-1-maskray@google.com> In-Reply-To: <20220602042715.2999013-1-maskray@google.com> From: Fangrui Song Date: Wed, 22 Jun 2022 20:38:41 -0700 Message-ID: Subject: Re: [PATCH] arm: Define elf_backend_extern_protected_data to 0 To: binutils@sourceware.org, Szabolcs Nagy Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-23.9 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 03:38:55 -0000 On Wed, Jun 1, 2022 at 9:27 PM Fangrui Song wrote: > > From: Fangrui Song > > If an executable has copy relocations for extern protected data, that > can only work if the library containing the definition is built with > assumptions (a) the compiler emits GOT-generating relocations (b) the > linker produces R_*_GLOB_DAT instead of R_*_RELATIVE. Otherwise the > library uses its own definition directly and the executable accesses a > stale copy. > > Commit b68a20d6675f1360ea4db50a9835c073675b9889 changed ld to produce > R_ARM_GLOB_DAT but that defeated the purpose of protected visibility > as an optimization. Restore the previous behavior (which matches > ld.lld) by defining elf_backend_extern_protected_data to 0. > --- > bfd/elf32-arm.c | 2 +- > ld/testsuite/ld-arm/protected-data.d | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c > index 5b8f5e5a0e6..36f09cb3427 100644 > --- a/bfd/elf32-arm.c > +++ b/bfd/elf32-arm.c > @@ -20315,7 +20315,7 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym) > #define elf_backend_dtrel_excludes_plt 1 > > #define elf_backend_got_header_size 12 > -#define elf_backend_extern_protected_data 1 > +#define elf_backend_extern_protected_data 0 > > #undef elf_backend_obj_attrs_vendor > #define elf_backend_obj_attrs_vendor "aeabi" > diff --git a/ld/testsuite/ld-arm/protected-data.d b/ld/testsuite/ld-arm/protected-data.d > index 3f266dea1b4..7dffe9ab958 100644 > --- a/ld/testsuite/ld-arm/protected-data.d > +++ b/ld/testsuite/ld-arm/protected-data.d > @@ -2,4 +2,4 @@ > #ld: -shared > #readelf: -r -W > #... > -.* R_ARM_GLOB_DAT .* var.* > +.* R_ARM_RELATIVE .* > -- > 2.36.1.255.ge46751e96f-goog > Ping:)