[PATCH] Fix gdb.dwarf2/clztest.exp with Clang

Gary Benson via Gdb-patches
2020-11-02T17:08:58Z

Hi all,

Clang fails to compile gdb.dwarf2/clztest.S, with the following error:

gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.dwarf2/clztest.S:181:2:
error: changed section flags for .eh_frame, expected: 0x2

This commit fixes the testcase by defining .eh_frame's flags
as Clang expects, when building with Clang (i.e. as "a" rather
than as "aw".)

Checked on Fedora 32 x86_64, with GCC and Clang. Ok to commit?

Cheers,
Gary

---
gdb/testsuite/ChangeLog:

* gdb.dwarf2/clztest.S (EH_FRAME_SH_FLAGS): New macro.
(.eh_frame): Use the above.
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.dwarf2/clztest.S | 8 +++++++-
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.dwarf2/clztest.S b/gdb/testsuite/gdb.dwarf2/clztest.S
index a904fee..08a8bac 100644
--- a/gdb/testsuite/gdb.dwarf2/clztest.S
+++ b/gdb/testsuite/gdb.dwarf2/clztest.S
@@ -22,6 +22,12 @@

*/

+#if defined(__clang__)
+# define EH_FRAME_SH_FLAGS "a"
+#else
+# define EH_FRAME_SH_FLAGS "aw"
+#endif
+
.file "clztest.c"
.text
.Ltext0:
@@ -178,7 +184,7 @@ _start:
.LEFDE4:
#NO_APP
#APP
- .section .eh_frame,"aw",@progbits
+ .section .eh_frame,EH_FRAME_SH_FLAGS,@progbits
.Lframe1:
.long .LECIE1-.LSCIE1 # Length of Common Information Entry
.LSCIE1:
--
1.8.3.1