From f000c2b940e82736d8a58387d73ac48bc38a4220 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 31 Jan 2018 12:42:28 -0800 Subject: [PATCH] Fix testsuite/ld-elf/pr21964-5.c Mark my_var as used. Otherwise it fails at -O2. * testsuite/ld-elf/pr21964-5.c (my_var): Mark as used. --- ld/ChangeLog | 4 ++++ ld/testsuite/ld-elf/pr21964-5.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index ba42294a9ad..2db90b5157b 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2018-01-31 H.J. Lu + + * testsuite/ld-elf/pr21964-5.c (my_var): Mark as used. + 2018-01-31 Maciej W. Rozycki * testsuite/ld-elf/shared.exp: Fix a typo s/scrip/script/. diff --git a/ld/testsuite/ld-elf/pr21964-5.c b/ld/testsuite/ld-elf/pr21964-5.c index 56ed5a9eed2..bc77422a566 100644 --- a/ld/testsuite/ld-elf/pr21964-5.c +++ b/ld/testsuite/ld-elf/pr21964-5.c @@ -9,7 +9,7 @@ extern int __start___verbose[]; extern int __stop___verbose[]; int bar (void) { - static int my_var __attribute__((section("__verbose"))) = 6; + static int my_var __attribute__((section("__verbose"), used)) = 6; int *ptr; ptr = (int*) dlsym(RTLD_DEFAULT, "__start___verbose"); if (!ptr || *ptr != 6) -- 2.30.2