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 D881E3858C2D for ; Tue, 8 Feb 2022 13:21:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D881E3858C2D Received: by mail-pj1-x102b.google.com with SMTP id a11-20020a17090a740b00b001b8b506c42fso2127570pjg.0 for ; Tue, 08 Feb 2022 05:21:11 -0800 (PST) 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; bh=FnkLd/tGKrjb+tshO4ZO8JnFkCeRqIl2cfNX8LRInzo=; b=XflBfHZdgO3W+hozhpFySYnvuN5TgT+jv1qVsUubZPdlRUaoUqiphoiAOCYqO70KeX U6FQNilI3BimKG/AbrG5mR4ReWgFsaRRqNjIZPqK7SYf7tFqR91H7aJiRpxydUlBoXT7 oKS/xVGywwrWUWpCPP+9p9O7aZ2CO2mmbXkbpTeKeM8An3txZwo98ROldT+onnLYkcNt eFg5iBsFC5NwzqlP/H8vBNWMndrfiUllB2lEUG++vuS8JHzBCu/eq4zvBcien3fmURy2 4J+vJHhqx/QeNNkWzoBmah/MydwO4gLr8YLfjoWOosYnNPXxtg2xU0PAgncVLGoyyeQ4 mzNw== X-Gm-Message-State: AOAM532DFavjpsnAeg3/RYML6hiiVYtC6DVYoq9ifoa1DpRGZ5Xidno1 xQB7QbqQE0E8x5OzFGbuFYod53PrsKY5eLN/a6DgA1XZcU0= X-Google-Smtp-Source: ABdhPJy38Nv+iIMoaTGig4eFHj7X7jz9bF4QEyOBGYtI82gpHXAwwvGeB0tDhQGgn22iepJhxmrL3f+kVdCX2kaobYE= X-Received: by 2002:a17:90b:1b46:: with SMTP id nv6mr1312673pjb.143.1644326470861; Tue, 08 Feb 2022 05:21:10 -0800 (PST) MIME-Version: 1.0 References: <20220208000322.4108601-1-hjl.tools@gmail.com> <4785d6f1-cd0c-2ad4-9a13-6a05f6557b69@suse.com> <272c580b-7428-3cc6-9a21-e9aa802eeb90@suse.com> In-Reply-To: <272c580b-7428-3cc6-9a21-e9aa802eeb90@suse.com> From: "H.J. Lu" Date: Tue, 8 Feb 2022 05:20:35 -0800 Message-ID: Subject: Re: [PATCH] i386: Allow GOT32 relocations against ABS symbols To: Jan Beulich Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3021.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 08 Feb 2022 13:21:13 -0000 On Tue, Feb 8, 2022 at 5:11 AM Jan Beulich wrote: > > On 08.02.2022 14:02, H.J. Lu wrote: > > On Tue, Feb 8, 2022 at 12:37 AM Jan Beulich wrote: > >> > >> On 08.02.2022 01:03, H.J. Lu via Binutils wrote: > >>> GOT32 relocations are allowed since absolute value + addend is stored in > >>> the GOT slot. > >> > >> Before permitting this and with you specifically mentioning addends > >> here, I think it needs to be clarified what ... > >> > >>> --- /dev/null > >>> +++ b/ld/testsuite/ld-i386/pr28870.s > >>> @@ -0,0 +1,6 @@ > >>> + .text > >>> + .globl _start > >>> +_start: > >>> + addl foo@GOT(%ebx), %eax > >>> + cmpl $0, foo@GOT(%ebx) > >>> +foo = 2 > >> > >> ... missing (here) variants thereof actually mean (and whether the use > >> of addends actually works as intended): > >> > >> mov $v@got+3, %eax # bogus, meaningless operand > >> mov $(v+3)@got, %eax # wrong (gets treated same as above) > >> > >> Comments are my own, preliminary judgement. > > > > GOT relocations should only be used as @got or @got(%reg). > > Other variants are undefined. > > Which raises two questions: > > 1) Why did you say "absolute value + addend is stored in the GOT slot" in > the description? Where would an addend come from if it can't be specified > in the assembly source? addend came from GOTPCREL relocation. There is no addend for GOT32. > 2) Why isn't the assembler at least warning about such undefined uses? A warning is useful. -- H.J.