From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by sourceware.org (Postfix) with ESMTPS id 37FA33857024 for ; Wed, 22 Jul 2020 14:40:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 37FA33857024 Received: by mail-il1-x142.google.com with SMTP id s21so1491470ilk.5 for ; Wed, 22 Jul 2020 07:40:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WdNQw5khgbE//5n6E+jFLgAMA80sl7YYaoyvAT2A1os=; b=WSgOvdTTaL1yXq7f6PYeORMD/jCIgn5giYLkgXk4fmvpsQPqpls4pPNuMaly1m8hPt 9WOsMIX1hLL5r+njL8VXpv+0AOw5+dVhCTwpsi6rx9bciygE3yB8semTaqMKZbm341vm wYJ0LoJBz8Z9aO/lGgx/Axs70tUzTg7PkHsMe7RI8Qy+4NmwykCw2I6Xs10+L3vwukyU mnzauiGdZAkuuNEJ1I1PvHL+i7kEFhppDQIaeHWTN5drF7VXCz8v7X9kaf1dWUYcR1e9 hgjVTSODSJIQHuk16igZVoO4wHYhTTHpBhmuwtjBo9f75CuF7/yZz2NQRHqswydghh3d O4/A== X-Gm-Message-State: AOAM533ENy51iw5vYiyfpaqUuL5e5irLRU206z9lyp5ginl30CpMRHdW zYPcNHg8nLsnogWyuoY9pYOPVUGj+TU5ya8Mnw4r6c1/ X-Google-Smtp-Source: ABdhPJyCetLuQ7qLz/jlTvPP0XRFWKSroT05/NjhZFDovZHsFpUb1rOg3Iv/6TurguLGp8QHYRvMgaLf+91iQUY9650= X-Received: by 2002:a92:d3c7:: with SMTP id c7mr222087ilh.292.1595428843708; Wed, 22 Jul 2020 07:40:43 -0700 (PDT) MIME-Version: 1.0 References: <20200722142302.wi2rotbr3hbz57iw@arm.com> In-Reply-To: <20200722142302.wi2rotbr3hbz57iw@arm.com> From: "H.J. Lu" Date: Wed, 22 Jul 2020 07:40:08 -0700 Message-ID: Subject: Re: [PATCH] gas: Fix internal error in S_SET_SEGMENT To: Alex Coplan Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.1 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 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Wed, 22 Jul 2020 14:40:45 -0000 On Wed, Jul 22, 2020 at 7:24 AM Alex Coplan wrote: > > Hello, > > This patch fixes an internal error in GAS when defining a section using > a symbol that has already been named but not defined. For a minimal > reproducer, try the following input: > > a=b > .sect a > > The problem is that obj_elf_change_section() happily reuses the symbol > "a" created by equals() without clearing the sy_value field: prior to > this patch, it just set bsym. This caused a problem when attempting to > resolve the section symbol, since resolve_symbol_value() ended up > resolving the symbol as if it were the original symbol created by > equals(), which ends up leaving the section symbol in the undefined > section instead of in section a, hence the call to abort() in > S_SET_SEGMENT(). > > Testing: > * New test fails before and passes after the change. > * Regression tested on a wide variety of targets. > > OK for master? > > Thanks, > Alex > > --- > > gas/ChangeLog: > > 2020-07-22 Alex Coplan > > * config/obj-elf.c (obj_elf_change_section): When > repurposing an existing symbol, ensure that we set sy_value as > per other (fresh) section symbols. > * testsuite/gas/aarch64/section-symbol-redef.d: New test. > * testsuite/gas/aarch64/section-symbol-redef.s: Input for test. > Why are tests arm specific? Can you put them to ELF tests? -- H.J.