]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix max-depth test case for AIX.
authorAditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Wed, 10 Apr 2024 05:52:05 +0000 (00:52 -0500)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Wed, 17 Apr 2024 10:43:25 +0000 (12:43 +0200)
In AIX, if in the main program the global variables are unused then the linker optimises
these variables and the dwarf will not have proper address to the same. Hence we cannot access these
variables.

This patch is a fix to the same so that all the test case of max-depth can passs in AIX as well.

gdb/testsuite/gdb.base/max-depth.c

index fee5de5af341917e434a9b0a98607c1aaf2f0152..7e46b134c109183684df070cf9ebc9e4e5416ade 100644 (file)
@@ -225,8 +225,17 @@ struct V7 : virtual V4, virtual V5, virtual V6 { int v7 = 1; } v7;
 
 #endif /* __cplusplus */
 
+void Do_nothing (struct s1 sone)
+{
+  /*  This Function does nothing.  */
+}
+
 int
 main ()
 {
+  /*  In targets like AIX, linker optimises out unused global
+      variables.  The do_nothing () function stops the linker
+      from doing so.  */
+  Do_nothing (s1);
   return 0;
 }