public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lulu Cheng <chenglulu@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, gcc-patches@gcc.gnu.org
Cc: xuchenghua@loongson.cn, Wang Xuerui <i@xen0n.name>
Subject: Re: [PATCH][wwwdocs] gcc-13: Add loongarch '-mexplicit-relocs' support
Date: Thu, 28 Jul 2022 10:59:26 +0800	[thread overview]
Message-ID: <da7487f8-116a-51cc-5f47-2201e7a08fc2@loongson.cn> (raw)
In-Reply-To: <a2119793bec7492b0da2067e255f883e1428ebda.camel@xry111.site>


在 2022/7/26 下午8:01, Xi Ruoyao 写道:
> On Tue, 2022-07-26 at 19:42 +0800, Lulu Cheng wrote:
>
>> 在 2022/7/26 下午5:44, Xi Ruoyao 写道:
>>> Should we indicate that our .eh_frame section format has changed?
> I don't really understand C++ exception handling, so: does the change
> breaks something?  For example, if foo links to libbar, libbar is built
> with GCC 12 (or vice versa), would an exception thrown from libbar
> properly caught by foo?
>
> Generally changes.html is for compiler users (instead of developers),
> and I believe at least 90% of users (including I) don't know the
> potential consequences from a .eh_frame format change.  So it's better
> to describe the breakage and possible workaround here.  If nothing will
> be broken, we can just skip the change in changes.html.
>
>
The ASM_PREFERRED_EH_DATA_FORMAT macro before and after modification is 
as follows:

  #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \

-  (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr)
+  (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4)

Use the following tests to describe the effect of modifying this macro 
on the generated assembly code: #include <iostream> #include <exception> 
using namespace std; int main() {   try {   throw 1;   }   catch 
(int i)   {     cout << i << endl;   } } The main comparisons 
related to the eh_frame section are as follows:        OLD NEW 
.LFB1997 = . | .LFB1780 = . .cfi_startproc | .cfi_startproc 
.cfi_personality 0x80,DW.ref.__gxx_personality_v0 | .cfi_personality 
0x9b,DW.ref.__gxx_personality_v0 .cfi_lsda 0,.LLSDA1997 | .cfi_lsda 
0x1b,.LLSDA1780 If the assembly file generated by the new gcc is 
compiled with the binutils of version 2.38, the following error will be 
reported: test.s:74: Error: invalid or unsupported encoding in 
.cfi_personality test.s:75: Error: invalid or unsupported encoding in 
.cfi_lsda

So I think I should judge whether binutils supports this encoding when 
gcc is configured, and then choose how to define macro 
ASM_PREFERRED_EH_DATA_FORMAT.


  parent reply	other threads:[~2022-07-28  2:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  7:21 Lulu Cheng
2022-07-26  9:44 ` Xi Ruoyao
2022-07-26 11:42   ` Lulu Cheng
2022-07-26 12:01     ` Xi Ruoyao
2022-07-26 13:26       ` Lulu Cheng
2022-07-26 14:15         ` [PATCH] LoongArch: adjust the default of -mexplicit-relocs by checking gas feature Xi Ruoyao
2022-07-27  1:34           ` Lulu Cheng
2022-07-27  2:22             ` Xi Ruoyao
2022-07-28  2:59       ` Lulu Cheng [this message]
2022-07-28 10:41         ` [PATCH][wwwdocs] gcc-13: Add loongarch '-mexplicit-relocs' support Xi Ruoyao
2022-07-28 13:06           ` Lulu Cheng
2022-07-26 11:32 ` Gerald Pfeifer
2022-07-26 12:28   ` Lulu Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=da7487f8-116a-51cc-5f47-2201e7a08fc2@loongson.cn \
    --to=chenglulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=i@xen0n.name \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).