[PATCH] D134710: [LoongArch] Set correct encodings for DWARF exception handling

Ray Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 18:56:54 PDT 2022


wangleiat added a comment.

In D134710#3819861 <https://reviews.llvm.org/D134710#3819861>, @xry111 wrote:

> In D134710#3819859 <https://reviews.llvm.org/D134710#3819859>, @xen0n wrote:
>
>> LGTM but I haven't cross-checked with gcc.
>
> https://gcc.gnu.org/git?p=gcc.git;a=blob;f=gcc/config/loongarch/loongarch.h#l1133:
>
>   #ifdef HAVE_AS_EH_FRAME_PCREL_ENCODING_SUPPORT
>   #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
>     (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4)
>   #else
>   #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
>     (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr)
>   #endif
>
> The `ifdef` is just for old GNU assemblers, we don't need to care about it because normally LLVM doesn't use an external assembler.

Considering that the old binutils might be used, gcc keeps this definition:

  #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
    (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr)



> I'm not sure about the difference with `DW_EH_PE_indirect` though (I know literally, nothing about debug symbols).

The definition here is simply to keep consistent with gcc. As for `DW_EH_PE_indirect`, it seems to be for the read-only attribute of `.eh_frame` section.



================
Comment at: llvm/test/CodeGen/LoongArch/dwarf-eh.ll:4
+; RUN: llc --mtriple=loongarch64  < %s | FileCheck %s
+; RUN: llc --mtriple=loongarch64  --relocation-model=pic < %s | FileCheck %s
+
----------------
xen0n wrote:
> nit: one single space
> nit: one single space

Thanks, I will remove the extra spaces.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134710/new/

https://reviews.llvm.org/D134710



More information about the llvm-commits mailing list