[lld] a9c5d09 - [ELF][test] Test identical CIE content with different personality

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 31 13:43:11 PDT 2022


Author: Fangrui Song
Date: 2022-07-31T13:43:07-07:00
New Revision: a9c5d09c5e8d8ccbd90229cc64193c78cf558143

URL: https://github.com/llvm/llvm-project/commit/a9c5d09c5e8d8ccbd90229cc64193c78cf558143
DIFF: https://github.com/llvm/llvm-project/commit/a9c5d09c5e8d8ccbd90229cc64193c78cf558143.diff

LOG: [ELF][test] Test identical CIE content with different personality

If we change
CieRecord *&rec = cieMap[{cie.data(), personality}];
to
CieRecord *&rec = cieMap[{cie.data(), nullptr}];

The new test can catch the failure.

Added: 
    

Modified: 
    lld/test/ELF/eh-frame-multilpe-cie.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/eh-frame-multilpe-cie.s b/lld/test/ELF/eh-frame-multilpe-cie.s
index a52e686d9d153..2f25673e04833 100644
--- a/lld/test/ELF/eh-frame-multilpe-cie.s
+++ b/lld/test/ELF/eh-frame-multilpe-cie.s
@@ -1,13 +1,50 @@
-// REQUIRES: x86
-// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
-// RUN: ld.lld --eh-frame-hdr %t.o -o /dev/null -shared
-// We would fail to parse multiple cies in the same file.
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: ld.lld --eh-frame-hdr -shared %t.o -o %t.so
+# RUN: llvm-dwarfdump --eh-frame %t.so | FileCheck %s
 
-        .cfi_startproc
-        .cfi_personality 0x9b, foo
-        .cfi_endproc
+# CHECK:      00000000 00000014 00000000 CIE
+# CHECK:        Augmentation:
+# CHECK-SAME:                "zR"
 
-        .cfi_startproc
-        .cfi_endproc
+# CHECK:      00000018 00000014 0000001c FDE cie=00000000 {{.*}}
 
-foo:
+# CHECK:      00000030 0000001c 00000000 CIE
+# CHECK:        Augmentation:
+# CHECK-SAME:                "zPR"
+# CHECK:        Personality Address:
+
+# CHECK:      00000050 00000014 00000024 FDE cie=00000030 {{.*}}
+
+# CHECK:      00000068 0000001c 00000000 CIE
+# CHECK:        Augmentation:
+# CHECK-SAME:                "zPR"
+# CHECK:        Personality Address:
+
+# CHECK:      00000088 00000014 00000024 FDE cie=00000068 {{.*}}
+
+foo0:
+.cfi_startproc
+.cfi_personality 0x9b, personality0
+  ret
+.cfi_endproc
+
+## This CIE cannot be merged into the previous one because the Personality is 
diff erent.
+foo1:
+.cfi_startproc
+.cfi_personality 0x9b, personality1
+  ret
+.cfi_endproc
+
+bar:
+.cfi_startproc
+  ret
+.cfi_endproc
+
+.globl personality0, personality1
+.hidden personality0, personality1
+personality0:
+  ret
+
+personality1:
+  ret


        


More information about the llvm-commits mailing list