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

Gary Benson via Gdb-patches
2020-11-04T11:27:11Z

Hi Tom, Andreas,

Tom Tromey wrote:
> >> Shouldn't .eh_frame always be read-only?
>
> Gary> I don't know.
>
> For a test in particular I think the question is whether the change
> can somehow negatively affect the test itself; and maybe secondarily
> whether some plausible and/or planned future change would break the
> test.
>
> If not then it seems fine to move forward.

GCC doesn't complain about making that section read-only, so I've
updated the test to make the section read-only always.

> Generally I think we'd be better off eliminating these assembly
> tests in favor of something like the test suite's DWARF assembler,
> though I didn't look to see whether this one would qualify.

Sure, but I'm not volunteering to do this one today! ;)

I've inlined an updated patch below. As before I checked it on
Fedora 32 x86_64, with GCC and Clang. Is it ok for me to commit?

Thanks,
Gary

---
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, as "a" rather than as "aw", thus making the
section read-only.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/clztest.S (.eh_frame): Make read-only.
---
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.dwarf2/clztest.S | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.dwarf2/clztest.S b/gdb/testsuite/gdb.dwarf2/clztest.S
index a904fee..5e6cdae 100644
--- a/gdb/testsuite/gdb.dwarf2/clztest.S
+++ b/gdb/testsuite/gdb.dwarf2/clztest.S
@@ -178,7 +178,7 @@ _start:
.LEFDE4:
#NO_APP
#APP
- .section .eh_frame,"aw",@progbits
+ .section .eh_frame,"a",@progbits
.Lframe1:
.long .LECIE1-.LSCIE1 # Length of Common Information Entry
.LSCIE1:
--
1.8.3.1