From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 000F03858002 for ; Mon, 27 Jun 2022 13:21:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 000F03858002 Received: by mail-pj1-x102b.google.com with SMTP id d14so9279614pjs.3 for ; Mon, 27 Jun 2022 06:21:03 -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:cc:content-transfer-encoding; bh=McIGv7SDmWzSCnSgXTOlDlXUXpD43EmrSUw9hISXz60=; b=G0uSWNIr8WyfL4l+rqJzEdfbFP+EDejXaFNV/9av6BzaZMC958oQ2hqMBMmqQrxMwD XvZaL3voOu3MWsrdSV61wl3rNctrA2K4tPKZB1AM1DzzzkRfWyOP5q8Kmlp7+3nBhGRZ +DpeoLnS3w5Wyil1/TsQzmdOYQO0ZGJbdAip93p5ag09mUiuzDwyXZJ5UOhRrfZ5jbdq rn57p2hM0goLpYwpeALVQiDxg8VTWWLNhPGfUmhsPqm2gRs3Y6sXNchxwVmaapq6TRtU ZXx2QfvGsuim/VSOcignJYd0kNACL41RsXUBTo06bQeT8MZ6v6mtIZvr2eeRb1h8o9MZ 3Iwg== X-Gm-Message-State: AJIora++Gmqrh+DY6oxrfZq5I6u+8wM6KUm0C3Y99EwItWRZcU8H7NJe Glhr4wSpHbvneNUYeonq9vppzKddvrBXEQsjvQSCLJH6cCI= X-Google-Smtp-Source: AGRyM1vlrRL24HSSydWzBppWzJoLwZ+nAM7HWmBqrUob0rDgjdkx1RfXA6+/yRNhKoyk+70tmcC9U5War14eNSVeAv0= X-Received: by 2002:a17:902:a502:b0:15e:c251:b769 with SMTP id s2-20020a170902a50200b0015ec251b769mr14737835plq.115.1656336062898; Mon, 27 Jun 2022 06:21:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "H.J. Lu" Date: Mon, 27 Jun 2022 06:20:27 -0700 Message-ID: Subject: Re: Is `SYMBOL_REFERENCES_LOCAL` safe to call in `*check_relocs` hook? To: Matthew Malcomson Cc: "binutils@sourceware.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3018.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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: Mon, 27 Jun 2022 13:21:11 -0000 On Mon, Jun 27, 2022 at 5:33 AM Matthew Malcomson via Binutils wrote: > > Hello, > > As the title mentions I want to call SYMBOL_REFERENCES_LOCAL at the time = that the check_relocs hook is being called. > For context: the reason I'm curious is that the AArch64 backend determine= s whether to relax a TLS access sequence to local-exec based on whether the= symbol is marked local (i.e. h =3D=3D NULL) or not rather than based on wh= ether the symbol we access is in the executable or not. > > I did a grep across the codebase and it seems there's only one place that= we call SYMBOL_REFERENCES_LOCAL so early, and that's in the x86 backend. > However it's through a wrapper SYMBOL_REFERENCES_LOCAL_P which is impleme= nted by a function that has a comment specifically mentioning being safe to= call from check_relocs, and that seems like it should increase suspicion r= ather than allay it. > > If it's not, what is the problem? > (I assume something about the symbol not being fully set up, based on tha= t same comment above the x86 function maybe something to do with version sc= ripts?) It should be safe to use it now in the check_relocs hook since the hook is called after loading all input files. --=20 H.J.