diff options
author | Ian Lance Taylor <iant@golang.org> | 2023-03-29 09:01:23 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2023-03-29 09:01:23 -0700 |
commit | 6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced (patch) | |
tree | 1deecdcfbf185c7044bc861d0ace51285c96cb62 /gcc/testsuite/gcc.dg/debug | |
parent | 795cffe109e28b248a54b8ee583cbae48368c2a7 (diff) | |
parent | aa8f4242efc99f24de73c59d53996f28db28c13f (diff) | |
download | gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.zip gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.tar.gz gcc-6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced.tar.bz2 |
Merge from trunk revision aa8f4242efc99f24de73c59d53996f28db28c13f.
Diffstat (limited to 'gcc/testsuite/gcc.dg/debug')
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c | 44 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c | 25 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf-variables-4.c | 24 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf-variables-5.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/btf/btf.exp | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/ctf/ctf.exp | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/debug.exp | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp | 2 |
13 files changed, 169 insertions, 10 deletions
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c new file mode 100644 index 0000000..f4b298c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c @@ -0,0 +1,28 @@ +/* Test BTF generation of DATASEC records for extern functions. + + Only functions declared extern should have entries in DATASEC records. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Expect one DATASEC with vlen=1 (.foo_sec) and one with vlen=2 (.bar_sec) */ +/* { dg-final { scan-assembler-times "0xf000002\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */ + +/* Function entries should have offset and size of 0 at compile time. */ +/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 3 } } */ +/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_size" 3 } } */ + +extern int foo (int a) __attribute__((section(".foo_sec"))); + + +extern int bar (int b) __attribute__((section(".bar_sec"))); +extern void chacha (void) __attribute__((section(".bar_sec"))); + +__attribute__((section(".foo_sec"))) +void baz (int *x) +{ + chacha (); + + *x = foo (bar (*x)); +} diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c index 728493b..2887cb1 100644 --- a/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c @@ -1,10 +1,10 @@ /* Test BTF generation for enums. */ /* { dg-do compile } */ -/* { dg-options "-O0 -gbtf -dA" } */ +/* { dg-options "-O0 -gbtf -fno-short-enums -dA" } */ /* { dg-final { scan-assembler-times "\[\t \]0x6000004\[\t \]+\[^\n\]*btt_info" 1 } } */ -/* { dg-final { scan-assembler-times "\[\t \]0x6000003\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x86000003\[\t \]+\[^\n\]*btt_info" 1 } } */ /* { dg-final { scan-assembler-times "ascii \"QAD.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ /* { dg-final { scan-assembler-times "ascii \"QED.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ /* { dg-final { scan-assembler-times "ascii \"QOD.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c new file mode 100644 index 0000000..5d1487c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c @@ -0,0 +1,44 @@ +/* Test BTF generation for 64 bits enums. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \].size\[\t \]_?myenum1,\[\t \]8" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \].size\[\t \]_?myenum2,\[\t \]8" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \].size\[\t \]_?myenum3,\[\t \]8" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x13000003\[\t \]+\[^\n\]*btt_info" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x93000003\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xffffffaa\[\t \]+\[^\n\]*bte_value_lo32" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xff\[\t \]+\[^\n\]*bte_value_hi32" 3 } } */ +/* { dg-final { scan-assembler-times "ascii \"B1.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"B2.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"B3.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"C1.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"C2.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"C3.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"D1.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"D2.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"D3.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "bte_value_lo32" 9 } } */ +/* { dg-final { scan-assembler-times "bte_value_hi32" 9 } } */ + +enum default_enum +{ + B1 = 0xffffffffaa, + B2 = 0xbbbbbbbb, + B3 = 0xaabbccdd, +} myenum1 = B1; + +enum explicit_unsigned +{ + C1 = 0xffffffffbbUL, + C2 = 0xbbbbbbbb, + C3 = 0xaabbccdd, +} myenum2 = C1; + +enum signed64 +{ + D1 = 0xffffffffaa, + D2 = 0xbbbbbbbb, + D3 = -0x1, +} myenum3 = D1; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c index c83b823..884d25c 100644 --- a/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c @@ -7,7 +7,7 @@ has type_id=0. */ /* { dg-do compile } */ -/* { dg-options "-O0 -gbtf -dA" } */ +/* { dg-options "-O0 -gbtf -dA -Wno-psabi" } */ /* { dg-final { scan-assembler-times "\[\t \]0xd000003\[\t \]+\[^\n\]*btt_info" 1 } } */ /* { dg-final { scan-assembler-times "farg_name" 3 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c new file mode 100644 index 0000000..48a946a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c @@ -0,0 +1,19 @@ +/* Test BTF extern linkage for functions. + + We expect to see one BTF_KIND_FUNC type with global linkage (foo), and + one BTF_KIND_FUNC type with extern linkage (extfunc). */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "btt_info: kind=12, kflag=0, linkage=2" 1 } } */ +/* { dg-final { scan-assembler-times "btt_info: kind=12, kflag=0, linkage=1" 1 } } */ + +extern int extfunc(int a, int b); + +int foo (int x) { + + int y = extfunc (x, x+1); + + return y; +} diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c b/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c new file mode 100644 index 0000000..f90fa77 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c @@ -0,0 +1,25 @@ +/* Test BTF generation for extern const void symbols. + BTF_KIND_VAR records should be emitted for such symbols if they are used, + as well as a corresponding entry in the appropriate DATASEC record. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Expect 1 variable record only for foo, with 'extern' (2) linkage. */ +/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*btv_linkage" 1 } } */ + +/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ + +/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 1 } } */ +/* { dg-final { scan-assembler-times "1\[\t \]+\[^\n\]*bts_size" 1 } } */ + +extern const void foo __attribute__((weak)) __attribute__((section (".ksyms"))); +extern const void bar __attribute__((weak)) __attribute__((section (".ksyms"))); + +unsigned long func () { + unsigned long x = (unsigned long) &foo; + + return x; +} + diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-4.c b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-4.c new file mode 100644 index 0000000..d77600b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-4.c @@ -0,0 +1,24 @@ +/* Test BTF generation for extern variables. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Expect 4 variables. */ +/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 4 } } */ + +/* 2 extern, 1 global, 1 static. */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btv_linkage" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btv_linkage" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*btv_linkage" 2 } } */ + +extern int a; +extern const int b; +int c; +static const int d = 5; + +int foo (int x) +{ + c = a + b + x; + + return c + d; +} diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-5.c b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-5.c new file mode 100644 index 0000000..8aae76c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-5.c @@ -0,0 +1,19 @@ +/* Test BTF generation for extern variable with both non-defining and + defining declarations. + + In this case, only a single variable record should be emitted, + with 'global' linkage. However two array types will be generated. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Expect 1 variable with global (1) linkage. */ +/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btv_linkage" 1 } } */ + +/* Expect 2 array types, one of which is unsized. */ +/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*bta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*bta_nelems" 1 } } */ + +extern const char FOO[]; +const char FOO[] = "foo"; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf.exp b/gcc/testsuite/gcc.dg/debug/btf/btf.exp index 0b2a384..89246dd 100644 --- a/gcc/testsuite/gcc.dg/debug/btf/btf.exp +++ b/gcc/testsuite/gcc.dg/debug/btf/btf.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 Free Software Foundation, Inc. +# Copyright (C) 2002-2023 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c index a36dd9b..e6c3199 100644 --- a/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c @@ -14,8 +14,8 @@ #include <complex.h> -double complex z1 = I * I; +double complex z1 = -1; -const long double complex z2 = I * I; +const long double complex z2 = -1; -float complex z4 = 1+2.11*I; +float complex z4 = 1; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp b/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp index d9ea481..a539b6b 100644 --- a/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 Free Software Foundation, Inc. +# Copyright (C) 2002-2023 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/gcc.dg/debug/debug.exp b/gcc/testsuite/gcc.dg/debug/debug.exp index c65e641..fab43d5 100644 --- a/gcc/testsuite/gcc.dg/debug/debug.exp +++ b/gcc/testsuite/gcc.dg/debug/debug.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 Free Software Foundation, Inc. +# Copyright (C) 2002-2023 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp index f29edbd..8ce59b5 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 Free Software Foundation, Inc. +# Copyright (C) 2002-2023 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by |