[PATCH v5 4/7] gdb/testsuite: fix gdb.base/msym-bp-shl when running with Clang

Bruno Larsen blarsen@redhat.com
Wed Sep 14 13:14:24 GMT 2022


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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c b/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c
index e047ac1145a..009656fd9ea 100644
--- a/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c
+++ b/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c
@@ -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)
 {
 }
-- 
2.37.3



More information about the Gdb-patches mailing list