From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by sourceware.org (Postfix) with ESMTPS id 8CF7E3858416 for ; Fri, 15 Mar 2024 13:45:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CF7E3858416 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8CF7E3858416 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710510311; cv=none; b=uKBdTwfNlth89BpaJT/jkuAh3Wej9SpeAad0U9TMhUEW23j50wWlcZgRoeHGYwXJz1/dSJXl3Zam/XfCIyp+P07ixZsHh5NK1F10bNCP6VuWHHEfKQORzff7w834+3WSTQDV23omajfzWfh3FzH9DLdX1ZILkUG/FXdk5/hSayc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710510311; c=relaxed/simple; bh=dWKyyOiW5+qC5ZvIHcjhk/XEsoWTMW+d/CQAKc71oxc=; h=MIME-Version:From:Date:Message-ID:Subject:To; b=mpxSruU6QV+JiKzjCDBZc6TBv/JShufqWtyzLn0SSaYVkYPKHanzwEZGBeuJdGOLR301S+WZBSPzPR/PXxvwaK0x0AaNdhp2MHyJ3CGNra9GB0QkVLzSGl+aiWIAauL8FJhnTmofylZfFwNj67lUHhbK48qDFU1D7ar6eq4HPys= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1de0f92e649so13567335ad.0 for ; Fri, 15 Mar 2024 06:45:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710510308; x=1711115108; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NZVqKvUOMBc1951njWTS5FpMvit8bPOzzqWkTUjIpHA=; b=H/AaU+0+sClD2xlTAEj8vx4jsrB9CSipW0hwaP3qxi3wVyRBhTm2sfXX01cT/RbWeD AFUbTEW50N0Uq0+j9Qglj0r5hUqBJ7adqIUnrt9ArCB1961MS1S6x/0XYVVbmNPvb43w ZYi/FxiEqLiVtHiGdN9mO6zyUpmyi1YtYXGe9GkzCx4D4YDqotwxpB4BLLCBiEePUu1C HNLValQ6LiYKRq81b6rAkgxLCIGynRsEGOjVsVGxkMkx+eY/D+bC2bZBkm4pNuCABeUs 37UQRGPN8DtuxoqikHSQhh1psWGDeHhRZ7grl1Frlw6KmmndBYGbZSWWWIwXzA/cDsxU xJXg== X-Forwarded-Encrypted: i=1; AJvYcCUotPG8Zu7Cdz24qSMv13nM9xEB3jMHpvpUR9j8fTt4dnRfUt0UEJ1+RuDmVZIoQm3+q4+35kbeH/vqRQh1sqpbcAO1M5zlfg== X-Gm-Message-State: AOJu0YxoGKXVm4IpjHO9A+bSwS47F63MYvtvPecyNLatQNZRFaxqVzcH iJ5Qwvzrl8Su7gaYLqlmUTub9uae/MGpU8hrfB9snwMEJvrMVT53iMWDg8EHfBM= X-Google-Smtp-Source: AGHT+IE0chrvTLfhocPOv40kcC8Z4kRQf4eOZdIQmDlU9ACrbDUdcvbsO3Z+CCVgveyKUyKETHqaFw== X-Received: by 2002:a17:902:e808:b0:1dd:a285:b41c with SMTP id u8-20020a170902e80800b001dda285b41cmr6841772plg.7.1710510308172; Fri, 15 Mar 2024 06:45:08 -0700 (PDT) Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com. [209.85.214.175]) by smtp.gmail.com with ESMTPSA id b18-20020a170903229200b001dd67d69848sm3823088plh.82.2024.03.15.06.45.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Mar 2024 06:45:08 -0700 (PDT) Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1dd9066b7c3so15035625ad.2 for ; Fri, 15 Mar 2024 06:45:08 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVgs0fAT+h5bBB7vcdjGSn/eQxehlqFXUm+ltU+/0/IxnomISwh9Txs/EFiOGG8VEU+TqGl2F3KglKmzOvw6+AUzVhESZ6mdw== X-Received: by 2002:a17:903:25d2:b0:1dc:fc5c:9e22 with SMTP id jc18-20020a17090325d200b001dcfc5c9e22mr4325573plb.33.1710510307810; Fri, 15 Mar 2024 06:45:07 -0700 (PDT) MIME-Version: 1.0 References: <20240131083244.718579-1-syq@gcc.gnu.org> <2be4441c3a739fe4c3f7a83097270257c3fcd646.camel@xry111.site> <11a02e57-b292-4f1e-b879-a54ca08c2234@redhat.com> In-Reply-To: From: YunQiang Su Date: Fri, 15 Mar 2024 21:44:54 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] MIPS: support PCREL GOT access To: "Maciej W. Rozycki" Cc: Nick Clifton , Xi Ruoyao , binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 List-Id: Maciej W. Rozycki =E4=BA=8E2024=E5=B9=B43=E6=9C=882=E6= =97=A5=E5=91=A8=E5=85=AD 01:38=E5=86=99=E9=81=93=EF=BC=9A > > On Mon, 26 Feb 2024, YunQiang Su wrote: > > > > We can try and do our best to produce correctly linked executables a= nd > > > shared libraries and provide testsuite coverage for what we do, and t= hen > > > > What my plan is (although I have no idea how to archive it with dejagnu= ): > > 1. f.c > > int f() {return 0;} > > mipsel-linux-gnu-gcc -O2 -mabi=3D32 f.c -shared -o libf.so > > 2. f1.c > > extern int f(); > > int f1 () {return f();} > > mipsel-linux-gnu-gcc -O2 f1.c -shared -L. -lf -o libf1.so > > But why do you want to write this code in C? It's so trivial you can > produce assembly for all the ABIs you want to cover (you can even start > with compiler output if you don't want to handcode it from scratch) and > use that as the test sources. We'll be able to verify it reliably then, > without a need for external components. > Sure, asm code is preferred by binutils testcase. The above C examples are just to describe what we need to do. In the real patch, I will use asm code. > > 3. Let's inspect libf1.so with `objdump -DTC` > > 3.1 We can see the symbol 'f' is in an address, 00000520. > > 00000520 DF *UND* 00000000 f > > 3.2 We can see a line "00000520 <_MIPS_STUBS_>" > > 3.3 We can see the address of .got is "00010570 <__TMC_END__>" > > 3.3 We can see " 50c: 8f998040 lw t9,-32704(gp)" > > in , and > > GOT_ADR + GP_MAGIC + LW_OFFSET =3D GOT_SLOT_OF_F > > 0x00010570 + 0x7ff0 + (-32704) =3D 0x1= 05a0 > > 3.4 The content of address GOT_SLOT_OF_F (0x105a0) is 0x00000520= . > > There are existing test cases in ld/testsuite/ld-mips-elf/mips-elf.exp > that do various kinds of checks, including running multiple dump tools on > single linker output. Check the various `run_ld_link_tests' invocations. > You can examine GOT entries in a cooked way with `readelf -A' BTW. > Thanks. I will have a try. > Maciej