@@ -3508,21 +3508,11 @@ set_debug_level (uint32_t dinfo, int extended, const char *arg,
}
else
{
- /* Make and retain the choice if both CTF and DWARF debug info are to
- be generated. */
- if (((dinfo == DWARF2_DEBUG) || (dinfo == CTF_DEBUG))
- && ((opts->x_write_symbols == (DWARF2_DEBUG|CTF_DEBUG))
- || (opts->x_write_symbols == DWARF2_DEBUG)
- || (opts->x_write_symbols == CTF_DEBUG)))
- {
- opts->x_write_symbols |= dinfo;
- opts_set->x_write_symbols |= dinfo;
- }
- /* However, CTF and BTF are not allowed together at this time. */
- else if (((dinfo == DWARF2_DEBUG) || (dinfo == BTF_DEBUG))
- && ((opts->x_write_symbols == (DWARF2_DEBUG|BTF_DEBUG))
- || (opts->x_write_symbols == DWARF2_DEBUG)
- || (opts->x_write_symbols == BTF_DEBUG)))
+ /* Any combination of DWARF, CTF and BTF is allowed. */
+ if (((dinfo == DWARF2_DEBUG) || (dinfo == CTF_DEBUG)
+ || (dinfo == BTF_DEBUG))
+ && ((opts->x_write_symbols | (DWARF2_DEBUG | CTF_DEBUG | BTF_DEBUG))
+ == (DWARF2_DEBUG | CTF_DEBUG | BTF_DEBUG)))
{
opts->x_write_symbols |= dinfo;
opts_set->x_write_symbols |= dinfo;
new file mode 100644
@@ -0,0 +1,8 @@
+/* Verify that BTF debug info can co-exist with DWARF. */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf -gbtf -dA" } */
+/* { dg-final { scan-assembler "0xeb9f.*btf_magic" } } */
+/* { dg-final { scan-assembler "DWARF version number" } } */
+
+void func (void)
+{ }
new file mode 100644
@@ -0,0 +1,8 @@
+/* Verify that BTF debug info can co-exist with CTF. */
+/* { dg-do compile } */
+/* { dg-options "-gctf -gbtf -dA" } */
+/* { dg-final { scan-assembler "0xeb9f.*btf_magic" } } */
+/* { dg-final { scan-assembler "0xdff2.*CTF preamble magic number" } } */
+
+void func (void)
+{ }
new file mode 100644
@@ -0,0 +1,9 @@
+/* Verify that BTF, CTF and DWARF can all co-exist happily. */
+/* { dg-do compile } */
+/* { dg-options "-gctf -gbtf -gdwarf -dA" } */
+/* { dg-final { scan-assembler "0xeb9f.*btf_magic" } } */
+/* { dg-final { scan-assembler "0xdff2.*CTF preamble magic number" } } */
+/* { dg-final { scan-assembler "DWARF version number" } } */
+
+void func (void)
+{ }