From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E2E123858D20 for ; Fri, 17 May 2024 13:58:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2E123858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E2E123858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715954284; cv=none; b=a5JkeeiWMxWpQjOdY14OVQJ9joljo0X3CGtDiD3jur4YG7JIB1aXs17wsayjSHOzwBOlii9Jd62TDtp/rnbejdewFdS+ISLQJhUo9PuJZRwsu0NKkFzMmqKaD9tfCXQ86N8NYoKHnqb05695RwX631Gz2oTKuoksT0N3pNmQexo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715954284; c=relaxed/simple; bh=YWONhXlrKM3dGbqzR+qZq/XDVbWvzozkDZVzEGr3chk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=a8TwbwlAk2P+JwE1AB6ZTul5b0i7er3SdoXZ5kmediCWzpduqXfAQ+bkLu+EmBHD/tW+e74nf/K72iBj+7liiunE06CX2GjhPp3qv3rREV5w0sdnUT3iDBc880YbI2qc0WixmUeqRmhRyXh7Grxr/AQmKurQUEaMplhLUr/lVps= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715954281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gwbKrESGwCQsP1VdLFbTQf7qN9TYoQoe7dj/5tX1zsU=; b=bEq5gzXTUJC1YcaNCK9GgURy0GpYBym3TwV630rqK/s1wuRG/pMSWH5Rbu4NN8pDE3Ai3p YpneAy09geqSJBei8qS9cArs32zbs8VEXeMU5Qffy1gXSygTPO7neMZRAAsb0iQCA+w11A 7f95QvKDXfH9DsDb9B7sJcZ0AAudCUQ= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-10-SQ5cbPgnPEC8TJbrwxbNsw-1; Fri, 17 May 2024 09:58:00 -0400 X-MC-Unique: SQ5cbPgnPEC8TJbrwxbNsw-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a59aedbd9a9so651862166b.0 for ; Fri, 17 May 2024 06:58:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715954279; x=1716559079; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gwbKrESGwCQsP1VdLFbTQf7qN9TYoQoe7dj/5tX1zsU=; b=L6Birr2C0tKTgtsGsXYy0pfv0XbDhE87P3tyxZjmb0YYypgeWXIoJRKDo0s8lTuli8 butuGmuH7J/d0CG8B19VwBW5tCkq2QBHnrTRwK2+Ou1mFNVsgkA1wSUU6dLMmp40f496 fZKcqd9NenumJlG6X7S7QgCARY2YWWbLJDR7fhXUa8gn5CkwEd0mc2w2lyFTv5OYJvNp Spwp85qXOoa28UP8zKdDqILoL3CprDccwEwFrE5LdLjvwLgb6RM8aMMNEvDSUTOU2KaB 6kCFGAg9Q0os1ex9viD58Xt8YnRy6DFo4FCBxogF1lPNRzNn7wYIvaEvz4Lmm/ghfAbp gf3w== X-Forwarded-Encrypted: i=1; AJvYcCU8x6SiWa63/ki3TZ8DDhD96ETd6FJKpRZJGgXbcqUQKxWAxR5oTiUDzA9HKB8G+KX0r2TnXdW3rN1s+0R/lCCxX3HqrNk66w== X-Gm-Message-State: AOJu0YwKU6trRcU3zEUlVIi0UOzJ6QqVsXHl1SHhVeB4BRXgCLQG7xK+ Aw4YXuzGmGcfZ59TqJdLBat9CI3v+ryAmj5CsksEIsdnJRn3sGvzsJ7GqDOoseiirfjfw+qjkBL x+0c20ztKEzD8vJQpqGjh8Ks7Kn6rrlhOC2v+VKxPgkQKgM60SIIySw0= X-Received: by 2002:a17:906:a010:b0:a5a:2e0:93ac with SMTP id a640c23a62f3a-a5a2d54c514mr1329136066b.5.1715954278751; Fri, 17 May 2024 06:57:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYPpNGlE0AjZmrjz/zIYb//6Ke2JxmzapBwHhOOPC+LPWpLIQ8LLzTZ7UDaO5wh7pp4+f8xQ== X-Received: by 2002:a17:906:a010:b0:a5a:2e0:93ac with SMTP id a640c23a62f3a-a5a2d54c514mr1329134966b.5.1715954278250; Fri, 17 May 2024 06:57:58 -0700 (PDT) Received: from localhost ([31.111.84.240]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c7f32sm1128257966b.106.2024.05.17.06.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 06:57:58 -0700 (PDT) From: Andrew Burgess To: Sung-hun Kim , binutils@sourceware.org Cc: sungguk.na@samsung.com, dongkyun.s@samsung.com, sw0312.kim@samsung.com, sfoon.kim@samsung.com Subject: Re: [PATCH] RISC-V: gas: Change initial CFI operation from DW_CFA_def_cfa_register to DW_CFA_def_cfa In-Reply-To: <20240513081149.32515-1-sfoon.kim@samsung.com> References: <20240513081149.32515-1-sfoon.kim@samsung.com> Date: Fri, 17 May 2024 14:57:57 +0100 Message-ID: <874jawr15m.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP 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: Sung-hun Kim writes: > The DWARF specification (especially, DWARF4 and 5 [1,2]) states that > DW_CFA_def_cfa_register cannot be used as the first CFI operation. > It said DW_CFA_def_cfa_register as follows: > > ... This operation is valid only if the current CFA rule is defined > to use a register and offset. > > So, DW_CFA_def_cfa_register can be used after that other definition > operation such as DW_CFA_def_cfa is called. However, the current gas > code emits DW_CFA_def_cfa_register as an initial CFI operation for RISCV. > > In the libgcc, the unwinding function does not care about it, so it can > unwind the call stack. However, on the third party library such as > libunwindstack in Android, it causes a fatal error. > > This patch changes the initial CFI operation to DW_CFA_def_cfa with > offset 0. It works as same as the previous one, but it does not have > any limitation so it satisfies the DWARF spec. This change resolves > the compatibility issue while preserving the original behaviour. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31733 I'm not a binutils maintainer, so can't approve this patch. But, for what it's worth, I think this is the right change to make. Reviewed-By: Andrew Burgess Thanks, Andrew > > [1] DWARF4 specification, https://dwarfstd.org/doc/DWARF4.pdf > [2] DWARF5 specification, https://dwarfstd.org/doc/DWARF5.pdf > > Signed-off-by: Sung-hun Kim > --- > gas/config/tc-riscv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c > index 1757ff6e9e2..8d749581c1d 100644 > --- a/gas/config/tc-riscv.c > +++ b/gas/config/tc-riscv.c > @@ -5209,7 +5209,7 @@ RISC-V options:\n\ > void > riscv_cfi_frame_initial_instructions (void) > { > - cfi_add_CFA_def_cfa_register (X_SP); > + cfi_add_CFA_def_cfa (X_SP, 0); > } > > int > -- > 2.25.1