public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Fix gdb.opt/inline-small-func.exp with clang
@ 2022-07-26 11:30 Tom de Vries
  2022-07-26 12:59 ` Luis Machado
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2022-07-26 11:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Hi,

When running test-case gdb.opt/inline-small-func.exp with clang 12.0.1, I run
into:
...
gdb compile failed, /usr/bin/ld: inline-small-func0.o: in function `main':
inline-small-func.c:21: undefined reference to `callee'
clang-12.0: error: linker command failed with exit code 1 \
  (use -v to see invocation)
UNTESTED: gdb.opt/inline-small-func.exp: failed to prepare
...

Fix this by using __attribute__((always_inline)).

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix gdb.opt/inline-small-func.exp with clang

---
 gdb/testsuite/gdb.opt/inline-small-func.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.opt/inline-small-func.h b/gdb/testsuite/gdb.opt/inline-small-func.h
index 66323952cf4..44b6e86fc15 100644
--- a/gdb/testsuite/gdb.opt/inline-small-func.h
+++ b/gdb/testsuite/gdb.opt/inline-small-func.h
@@ -13,9 +13,15 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef __GNUC__
+#define ATTR __attribute__((always_inline))
+#else
+#define ATTR
+#endif
+
 int counter = 42;
 
-inline void
+inline ATTR void
 callee () {
   counter = 0;	/* callee: body.  */
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][gdb/testsuite] Fix gdb.opt/inline-small-func.exp with clang
  2022-07-26 11:30 [PATCH][gdb/testsuite] Fix gdb.opt/inline-small-func.exp with clang Tom de Vries
@ 2022-07-26 12:59 ` Luis Machado
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Machado @ 2022-07-26 12:59 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Andrew Burgess

On 7/26/22 12:30, Tom de Vries via Gdb-patches wrote:
> Hi,
> 
> When running test-case gdb.opt/inline-small-func.exp with clang 12.0.1, I run
> into:
> ...
> gdb compile failed, /usr/bin/ld: inline-small-func0.o: in function `main':
> inline-small-func.c:21: undefined reference to `callee'
> clang-12.0: error: linker command failed with exit code 1 \
>    (use -v to see invocation)
> UNTESTED: gdb.opt/inline-small-func.exp: failed to prepare
> ...
> 
> Fix this by using __attribute__((always_inline)).
> 
> Tested on x86_64-linux.
> 
> Any comments?
> 
> Thanks,
> - Tom
> 
> [gdb/testsuite] Fix gdb.opt/inline-small-func.exp with clang
> 
> ---
>   gdb/testsuite/gdb.opt/inline-small-func.h | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.opt/inline-small-func.h b/gdb/testsuite/gdb.opt/inline-small-func.h
> index 66323952cf4..44b6e86fc15 100644
> --- a/gdb/testsuite/gdb.opt/inline-small-func.h
> +++ b/gdb/testsuite/gdb.opt/inline-small-func.h
> @@ -13,9 +13,15 @@
>      You should have received a copy of the GNU General Public License
>      along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>   
> +#ifdef __GNUC__
> +#define ATTR __attribute__((always_inline))
> +#else
> +#define ATTR
> +#endif
> +
>   int counter = 42;
>   
> -inline void
> +inline ATTR void
>   callee () {
>     counter = 0;	/* callee: body.  */
>   }

The above looks good to me.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-26 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 11:30 [PATCH][gdb/testsuite] Fix gdb.opt/inline-small-func.exp with clang Tom de Vries
2022-07-26 12:59 ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).