]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix a couple gdb.dwarf2/ testcases with "clang -flto"
authorPedro Alves <pedro@palves.net>
Sun, 13 Sep 2020 17:17:18 +0000 (18:17 +0100)
committerPedro Alves <pedro@palves.net>
Sun, 13 Sep 2020 17:17:18 +0000 (18:17 +0100)
gdb.dwarf2/atomic-type.exp and gdb.dwarf2/ada-linkage-name.exp fail
when testing with "clang -flto" as compiler, like:

 $ make check TESTS="gdb.dwarf2/ada-linkage-name.exp" RUNTESTFLAGS="CC_FOR_TARGET='clang -flto'"

because with -flto, functions that aren't referenced anywhere are not
emitted in the final binary.  Fix it by adding uses of the functions.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/ada-linkage-name.c (main): Move to the bottom of the
file and add calls to first and second.
* gdb.dwarf2/atomic.c (main): Move to the bottom of the file and
add call to f.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/ada-linkage-name.c
gdb/testsuite/gdb.dwarf2/atomic.c

index 24a58adbdd5324e932d216793e7e6306b59045dd..0744c1e941d4ab5f08efffa271384fe8fa19158a 100644 (file)
@@ -1,3 +1,10 @@
+2020-09-13  Pedro Alves  <pedro@palves.net>
+
+       * gdb.dwarf2/ada-linkage-name.c (main): Move to the bottom of the
+       file and add calls to first and second.
+       * gdb.dwarf2/atomic.c (main): Move to the bottom of the file and
+       add call to f.
+
 2020-09-13  Pedro Alves  <pedro@palves.net>
 
        * gdb.mi/mi-break-qualified.cc: New file.
index adcb009cce3ed6b6d7a800883b956ee1a666c875..fe0414724e11f9fff72c167f396b7982bf37fa39 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-int
-main (void)
-{
-  asm ("main_label: .globl main_label");
-  return 0;
-}
-
 /* First dummy function.  */
 
 int
@@ -39,3 +32,14 @@ second (char *x)
   asm ("second_label: .globl second_label");
   return 0;
 }
+
+
+int
+main (void)
+{
+  asm ("main_label: .globl main_label");
+
+  first (0);
+  second (0);
+  return 0;
+}
index 1e279a40d276be5da0efb74b1c72820dfb37acb2..8929989053348119661b3e41bf1d421613e23f0b 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Dummy main function.  */
-
+/* dummy f function, DWARF will describe arguments and type differently.  */
 int
-main (void)
+f (char *x)
 {
-  asm ("main_label: .globl main_label");
+  asm ("f_label: .globl f_label");
   return 0;
 }
 
-/* dummy f function, DWARF will describe arguments and type differently.  */
+/* Dummy main function.  */
+
 int
-f (char *x)
+main (void)
 {
-  asm ("f_label: .globl f_label");
+  asm ("main_label: .globl main_label");
+
+  f (0);
   return 0;
 }
-