public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH][gdb/testsuite] Fix gdb.opt/inline-small-func.exp with clang
Date: Tue, 26 Jul 2022 13:59:50 +0100	[thread overview]
Message-ID: <7b9c0be4-bbe7-2ff9-b3cf-69003789c872@arm.com> (raw)
In-Reply-To: <20220726113024.GA17827@delia.home>

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.

      reply	other threads:[~2022-07-26 13:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 11:30 Tom de Vries
2022-07-26 12:59 ` Luis Machado [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b9c0be4-bbe7-2ff9-b3cf-69003789c872@arm.com \
    --to=luis.machado@arm.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).