gdb/testsuite: fix gdb.base/msym-bp-shl when running with Clang
authorBruno Larsen <blarsen@redhat.com>
Wed, 20 Jul 2022 19:44:35 +0000 (16:44 -0300)
committerBruno Larsen <blarsen@redhat.com>
Thu, 22 Sep 2022 09:04:18 +0000 (11:04 +0200)
When trying to test gdb.base/msym-bp-shl.exp using clang, it would have
many failures because one of the version of the foo function was being
optimized away. Adding __attribute__ ((used)) to it fixed this.

gdb/testsuite/gdb.base/msym-bp-shl-main-2.c

index e047ac1145aa49e4abbfe7c1002e9029dd93cb2f..009656fd9eaa5042e201cbd5816c7408ee1855ec 100644 (file)
@@ -15,7 +15,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-static void
+static void __attribute__ ((used))
 foo (void)
 {
 }