From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 6298 invoked from network); 3 Apr 2020 06:28:21 -0000 Received-SPF: pass (mother.openwall.net: domain of lists.openwall.com designates 195.42.179.200 as permitted sender) receiver=inbox.vuxu.org; client-ip=195.42.179.200 envelope-from= Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with UTF8ESMTPZ; 3 Apr 2020 06:28:21 -0000 Received: (qmail 7529 invoked by uid 550); 3 Apr 2020 06:28:18 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7497 invoked from network); 3 Apr 2020 06:28:17 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=EFpcuDh5/5PFhE4yckaqdOxCScrPhEmp6DmDU1Lh+nU=; b=pzh8TbB+xpehSOpr/YaUAMaghX17M3R73Icbqe04eb5ptDwcHsIoh4MjY0L8TWRJ24 REdI55FcsH1eVrunlfQ/W1CPd1GM81EWKn1Gqm6F3aUUYyw+ra7mZlEBS/vkIIYfmYQ7 AcgVteKG0/aialY+IFmtRnswHUlkZxLWJI/psb5Y4OHbZdaqvSGxMC1zPLqw+T0dRVbQ KU+/i5o/lH/LHJn/zz/6K52RLgeHIdKsCcHD3uTZgFBm58+5WGO/ib5ZtIcWfgW25soT ycsZNVShbPOImH/i7XdpfC9DCGPTBAp6aGZBXs7B0PlbFi8gK5yrAN8F4bFI1tkLDr5m S6jQ== X-Gm-Message-State: AGi0PuaDoGYJIvlkmyC//Bgo+nFTKMnN7TVyUAf+jNR6rkHOD3As0KHs X+9tb5feXxc3Txp+a4QD6meR6Vw8 X-Google-Smtp-Source: APiQypJXSgzR5KM+IS6XZrxhYRwXFx7jUgTI2W5KcSHHLcSWaYQSgV1Yv3OeNcKQFr1B6Ay6YX+AzQ== X-Received: by 2002:aa7:8439:: with SMTP id q25mr5781473pfn.172.1585895285058; Thu, 02 Apr 2020 23:28:05 -0700 (PDT) Date: Thu, 2 Apr 2020 23:28:03 -0700 From: Fangrui Song To: musl@lists.openwall.com Message-ID: <20200403062803.wmxb46mnfhwalaet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [musl] [PATCH] fix the symbol value for a dynamic relocation referencing a SHN_ABS symbol fixes the example at https://sourceware.org/bugzilla/show_bug.cgi?id=19818#c3 the glibc bug also mentions dladdr() but that change seems more disruptive and i am now sure whether/how that should be fixed. --- ldso/dynlink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ldso/dynlink.c b/ldso/dynlink.c index afec985a..6f4b50c9 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -403,7 +403,10 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri def.dso = dso; } - sym_val = def.sym ? (size_t)laddr(def.dso, def.sym->st_value) : 0; + sym_val = def.sym + ? def.sym->st_shndx == SHN_ABS ? def.sym->st_value + : (size_t)laddr(def.dso, def.sym->st_value) + : 0; tls_val = def.sym ? def.sym->st_value : 0; if ((type == REL_TPOFF || type == REL_TPOFF_NEG) -- 2.26.0