From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 0B8123858D35 for ; Sun, 30 Jul 2023 14:03:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B8123858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-686b91c2744so2645475b3a.0 for ; Sun, 30 Jul 2023 07:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690725825; x=1691330625; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nriRx1j/LOsKU32kIPZi2U2GZtvfhKJQs/5BbzNZ1rY=; b=En+r5GHtB/ZSLSKeqbtj3UZfBWjVwAAky1eEfLNxMIE2UmpJUXSaehpON5+tuKE0uE lBBQxjfcoSLCClW7U0fWqA9mos6AvafyWaRoPfrITKseWWGc8eLKIz9oeo+bOyCXdKdM fWMDgXPu4OS3LJm/tBHUSHIhCyIgDaIgFEVPNaI7joQkRrGEqgE34/tCNa4L4TthLLaS KwhaPiO5nj7vsFCBijWaXmHDD4JItrkprsO4Fo4jxhr/v+wT7qclHBtUvx+qgWJQt4ZA 8dGi5EBfSa5G+dnKD9Q2A6kKadcukgiZJpHN18sLBMoI4PC/IBIxSiJFk0weZjBfxTiv Ceuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690725825; x=1691330625; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nriRx1j/LOsKU32kIPZi2U2GZtvfhKJQs/5BbzNZ1rY=; b=lz+A/HfkuijF0MWBTGE9hRqomg68srYxqE00fv1c9lrwBWMhipnezkawIEZzbi8dnF JyLPQrftR9kqaEAW0ac1cI9suHd8O+aF7aywmIgt7LXFpBsLP6/HUCZdGPlaKipI0R7s aJb3NFysT3WQiTItwfoOh4BwpeFFa2nXV5BbRQiwId+sz5/1y4OYluf9bwJ7WPfgbq54 fj5ZXC9QFGj6k3aMcv1ScpaSm1pC1l4CmQ6Wdjt04prXOfVKuSRyG45+aWtPxXBx/EGV JUOm9Ghw2chdzbfEcGW9TiP0I27CKrQVxvn3uJPuUosDEl/7svyZiNt7ync/4jWl1RoU 2tLw== X-Gm-Message-State: ABy/qLbW9GpIGPCNVJhfBP60VK/jC0v2tK4idhgS3tnxl6YsakiU/kO5 PtYwAu6zwd6zlPRMtCnDSMHIGA== X-Google-Smtp-Source: APBJJlFvnDwqdHxvrGbJqlsHxmkaIubKXdOyVLMA6KS3/0p/6PCX2AhVsaCZE94tn7u0YvfbG1HNkA== X-Received: by 2002:a05:6a00:16c4:b0:668:99aa:3f17 with SMTP id l4-20020a056a0016c400b0066899aa3f17mr9852051pfc.16.1690725824843; Sun, 30 Jul 2023 07:03:44 -0700 (PDT) Received: from ?IPV6:2602:47:d490:6901:a7b4:380e:e513:5ef2? ([2602:47:d490:6901:a7b4:380e:e513:5ef2]) by smtp.gmail.com with ESMTPSA id w9-20020aa78589000000b0065438394fa4sm6172846pfn.90.2023.07.30.07.03.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 30 Jul 2023 07:03:44 -0700 (PDT) Message-ID: <320512fc-0ffe-3ddf-7158-e8398357cf1d@linaro.org> Date: Sun, 30 Jul 2023 07:03:42 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: build failure on ia64 (+ patch), "relocation truncated to fit: GPREL22 against `.text'" To: Adhemerval Zanella Netto , Florian Weimer , "Andreas K. Huettel via Libc-alpha" Cc: vapier@gentoo.org, "Andreas K. Huettel" References: <4817905.GXAFRqVoOG@pinacolada> <87leex250z.fsf@mid.deneb.enyo.de> <2d78fafb-cba0-684f-d61b-c57b0e65d349@linaro.org> Content-Language: en-US From: Richard Henderson In-Reply-To: <2d78fafb-cba0-684f-d61b-c57b0e65d349@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 7/30/23 06:14, Adhemerval Zanella Netto via Libc-alpha wrote: > > > On 30/07/23 05:10, Florian Weimer wrote: >> * Andreas K. Huettel via Libc-alpha: >> >>> diff --git a/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h b/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h >>> index 3e4d5da820..eb7681b704 100644 >>> --- a/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h >>> +++ b/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h >>> @@ -32,7 +32,9 @@ >>> #ifndef __ASSEMBLER__ >>> /* Don't declare this as a function---we want it's entry-point, not >>> it's function descriptor... */ >>> -extern int _dl_sysinfo_break attribute_hidden; >>> +/* Use section ".text" to force far GPREL64 relocation instead of >>> + GPREL22 . */ >>> +extern int _dl_sysinfo_break attribute_hidden __attribute__((section(".text"))); >> >> More context: >> >> | /* Don't declare this as a function---we want it's entry-point, not >> | it's function descriptor... */ >> | extern int _dl_sysinfo_break attribute_hidden; >> | # define DL_SYSINFO_DEFAULT ((uintptr_t) &_dl_sysinfo_break) >> | # define DL_SYSINFO_IMPLEMENTATION \ >> | asm (".text\n\t" \ >> | ".hidden _dl_sysinfo_break\n\t" \ >> | ".proc _dl_sysinfo_break\n\t" \ >> | "_dl_sysinfo_break:\n\t" \ >> | ".prologue\n\t" \ >> | ".altrp b6\n\t" \ >> | ".body\n\t" \ >> | "break 0x100000;\n\t" \ >> | "br.ret.sptk.many b6;\n\t" \ >> | ".endp _dl_sysinfo_break\n\t" \ >> | ".previous"); >> | #endif >> >> So this seems actually correct because the symbol is defined in .text. >> (I was wondered why this would make .text writable.) > > That was my understanding back then as well, and I tested myself the testcase > Sergei has created [1] and at least with gcc from 6 to 13 built with > build-many-glibcs.py I don't see any relocation failure. But at same time > I don't see any relocation failure with current code either, so I am not > sure why this is happening with Gentoo toolchain (maybe a incomplete backport?). > > --- > $ cat mk.bash > #!/usr/bin/bash > > if [ $# -eq 0 ]; then > echo "usage: mk.bash compiler" > exit 0; > fi > > CC=$1 > > cat > conftest.c << EOF > #ifdef USE_TEXT > extern int asm_f __attribute__((visibility("hidden"))) __attribute__((section(".text"))); > #else > extern int asm_f __attribute__((visibility("hidden"))); > #endif > > long asm_f_ref; > > asm ( > ".text\n\t" \ > ".hidden asm_f\n\t" > ".proc asm_f\n\t" > "asm_f:\n\t" > ".prologue\n\t" > ".body\n\t" > "br.ret.sptk.many b0;\n\t" > ".endp asm_f\n\t" > ".previous" > ); > EOF Certainly this won't fail, because it doesn't have the actual use. You needed int main() { asm_f_ref = (long)asm_f; return 0; } to complete the test. Even then I might expect that the test is too small, and a 22-bit gprel relocation may well succeed here. Perhaps '.space 1 << 22' after '.endp asm_f' r~ > > for define in "" "-DUSE_TEST"; do > for static in "" "-static"; do > for fpie in "" "-fPIE"; do > for common in "-fcommon" "-fno-common"; do > echo -n "define=${define} static=${static} common=${common} fpie=${fpie}: " > $CC conftest.c -o a -O2 -nostdlib -nostartfiles -e asm_f_ref \ > ${static} ${define} ${fpie} ${common} 2>&1 >/dev/null > if [ $? -eq 0 ]; then > echo "OK" > else > echo "FAIL" > fi > done > done > done > done > > rm conftest.c > --- > > > [1] https://sourceware.org/pipermail/libc-alpha/2020-May/114493.html