public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ro at CeBiTec dot Uni-Bielefeld.DE" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/112563] [14 regression] libsanitizer doesn't assemble with Solaris/sparc as
Date: Wed, 22 Nov 2023 13:37:01 +0000	[thread overview]
Message-ID: <bug-112563-4-6ln5lXsZa6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112563-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112563

--- Comment #11 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to ro@CeBiTec.Uni-Bielefeld.DE from comment #9)
[...]
>> I've now come up with an alternative.  It's a bit ugly, but it gets the
>> work done:
>> 
>> diff --git a/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
>> b/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
>> --- a/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
>> +++ b/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h
>> @@ -17,6 +17,17 @@
>>  // The asm hack only works with GCC and Clang.
>>  #    if !defined(_WIN32)
>>  
>> +// FIXME: Explain.
>> +#    if defined(__sparc__)
>> +#    define ASM_MEM_DEF(FUNC) \
>> +        __asm__(".global " #FUNC "\n" \
>> +                ".type " #FUNC ",function\n" \
>
> Not @function ?

No, this should be #function: that's the only variant sparc as
understands, and gas does for compatibility.

>> +                ".weak " #FUNC "\n" \
>> +                #FUNC ":\n");
>> +ASM_MEM_DEF(__sanitizer_internal_memcpy)
>> +ASM_MEM_DEF(__sanitizer_internal_memmove)
>> +ASM_MEM_DEF(__sanitizer_internal_memset)
>> +#    endif
>>  asm("memcpy = __sanitizer_internal_memcpy");
>>  asm("memmove = __sanitizer_internal_memmove");
>>  asm("memset = __sanitizer_internal_memset");
>> 
>> I've run libsanitizer builds on sparc without this patch (gas only since
>> as fails) and with it (as and gas).  It fixes the as build failure and
>> leaves the same number of calls to mem* functions in libasan.so as an
>> unpatched tree with gas.
>
> If it works, nice.  Can you file it on github.com/llvm/llvm-project as an issue
> and see if upstream is willing to accept it?  I think they'll want some

Can do, either as an issue or directly as a pull request.  I'll run it
through a full llvm build, too, first.

> indentation changes (if defined(__sparc__) is below the _WIN32 #if, so they
> probably want it
> indented more and the define even more.  And dunno if defined(__sparc__) or
> SANITIZER_SPARC should be used.

I know: LLVM has clang/tools/clang-format/clang-format-diff.py to handle
this.  I usually run my patches through that first, unlike it messes up
the existing formatting as was the case for pull request #72973.

The patches also needs an explanatory comment; this was just a proof of
concept.  It might be even better to restrict the hack to __sparc__ &&
__sun__ && __svr4__ to avoid interfering with Linux/sparc64.

  parent reply	other threads:[~2023-11-22 13:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16 10:20 [Bug sanitizer/112563] New: " ro at gcc dot gnu.org
2023-11-16 10:20 ` [Bug sanitizer/112563] " ro at gcc dot gnu.org
2023-11-16 12:47 ` rguenth at gcc dot gnu.org
2023-11-19 21:16 ` jakub at gcc dot gnu.org
2023-11-20  9:28 ` jakub at gcc dot gnu.org
2023-11-20 13:42 ` ro at CeBiTec dot Uni-Bielefeld.DE
2023-11-20 15:47 ` jakub at gcc dot gnu.org
2023-11-20 19:29 ` jakub at gcc dot gnu.org
2023-11-20 19:38 ` jakub at gcc dot gnu.org
2023-11-20 20:09 ` jakub at gcc dot gnu.org
2023-11-21 17:31 ` jakub at gcc dot gnu.org
2023-11-22 13:22 ` ro at CeBiTec dot Uni-Bielefeld.DE
2023-11-22 13:29 ` jakub at gcc dot gnu.org
2023-11-22 13:37 ` ro at CeBiTec dot Uni-Bielefeld.DE [this message]
2023-11-27 10:41 ` ro at CeBiTec dot Uni-Bielefeld.DE
2023-11-27 12:57 ` ro at gcc dot gnu.org
2023-11-28 13:54 ` cvs-commit at gcc dot gnu.org
2023-11-28 13:56 ` cvs-commit at gcc dot gnu.org
2023-11-28 15:07 ` ro at gcc dot gnu.org

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=bug-112563-4-6ln5lXsZa6@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).