public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] sanitizer: Fix build on SPARC/Solaris with Solaris as [PR112562]
@ 2023-11-21 20:05 Jakub Jelinek
  2023-11-22  9:16 ` Rainer Orth
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2023-11-21 20:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: Rainer Orth

Hi!

Solaris as apparently doesn't accept %function and requires @function
instead.

This cherry-picks upstream commit.

Bootstrapped/regtested on x86_64-linux and i686-linux and built tested
on sparc-solaris2.11, committed to trunk as obvious.

2023-11-21  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/112562
	* sanitizer_common/sanitizer_asm.h: Cherry-pick llvm-project revision
	a855a16a02e76a0f4192c038bb64f3773947a2f7.
	* interception/interception.h: Likewise.

--- libsanitizer/sanitizer_common/sanitizer_asm.h.jj	2023-11-15 17:19:11.507783822 +0100
+++ libsanitizer/sanitizer_common/sanitizer_asm.h	2023-11-20 18:16:48.740201609 +0100
@@ -62,7 +62,11 @@
 
 #if !defined(__APPLE__)
 # define ASM_HIDDEN(symbol) .hidden symbol
-# define ASM_TYPE_FUNCTION(symbol) .type symbol, %function
+# if defined(__arm__) || defined(__aarch64__)
+#  define ASM_TYPE_FUNCTION(symbol) .type symbol, %function
+# else
+#  define ASM_TYPE_FUNCTION(symbol) .type symbol, @function
+# endif
 # define ASM_SIZE(symbol) .size symbol, .-symbol
 # define ASM_SYMBOL(symbol) symbol
 # define ASM_SYMBOL_INTERCEPTOR(symbol) symbol
--- libsanitizer/interception/interception.h.jj	2023-11-15 17:19:11.505783850 +0100
+++ libsanitizer/interception/interception.h	2023-11-20 18:16:48.736201664 +0100
@@ -185,6 +185,11 @@ const interpose_substitution substitutio
 #  else
 #   define __ASM_WEAK_WRAPPER(func) ".weak " #func "\n"
 #  endif  // SANITIZER_FREEBSD || SANITIZER_NETBSD
+#  if defined(__arm__) || defined(__aarch64__)
+#   define ASM_TYPE_FUNCTION_STR "%function"
+#  else
+#   define ASM_TYPE_FUNCTION_STR "@function"
+#  endif
 // Keep trampoline implementation in sync with sanitizer_common/sanitizer_asm.h
 #  define DECLARE_WRAPPER(ret_type, func, ...)                                 \
      extern "C" ret_type func(__VA_ARGS__);                                    \
@@ -196,7 +201,8 @@ const interpose_substitution substitutio
        __ASM_WEAK_WRAPPER(func)                                                \
        ".set " #func ", " SANITIZER_STRINGIFY(TRAMPOLINE(func)) "\n"           \
        ".globl " SANITIZER_STRINGIFY(TRAMPOLINE(func)) "\n"                    \
-       ".type  " SANITIZER_STRINGIFY(TRAMPOLINE(func)) ", %function\n"         \
+       ".type  " SANITIZER_STRINGIFY(TRAMPOLINE(func)) ", "                    \
+         ASM_TYPE_FUNCTION_STR "\n"                                            \
        SANITIZER_STRINGIFY(TRAMPOLINE(func)) ":\n"                             \
        SANITIZER_STRINGIFY(CFI_STARTPROC) "\n"                                 \
        SANITIZER_STRINGIFY(ASM_TAIL_CALL) " __interceptor_"                    \

	Jakub


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

* Re: [committed] sanitizer: Fix build on SPARC/Solaris with Solaris as [PR112562]
  2023-11-21 20:05 [committed] sanitizer: Fix build on SPARC/Solaris with Solaris as [PR112562] Jakub Jelinek
@ 2023-11-22  9:16 ` Rainer Orth
  0 siblings, 0 replies; 2+ messages in thread
From: Rainer Orth @ 2023-11-22  9:16 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi Jakub,

> Solaris as apparently doesn't accept %function and requires @function
> instead.

actually, it's the other way round: Solaris/x86 as cannot handle
%function, but requires @function.

Solaris/SPARC as is similar (requires #function instead), but is
unaffected: sanitizer_asm.h disables ASM_INTERCEPTOR_TRAMPOLINE on sparc
and sets ASM_INTERCEPTOR_TRAMPOLINE_SUPPORT to 0, so interceptor.h
doesn't use the problematic version of DECLARE_WRAPPER.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

end of thread, other threads:[~2023-11-22  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21 20:05 [committed] sanitizer: Fix build on SPARC/Solaris with Solaris as [PR112562] Jakub Jelinek
2023-11-22  9:16 ` Rainer Orth

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).