[patch, nios2] Fix PR78357, adjust sync builtin initialization

Chung-Lin Tang chunglin_tang@mentor.com
Wed Nov 16 09:54:00 GMT 2016


This patch adjusts the initialization of __sync built-in functions:
instead of conditionalizing on TARGET_LINUX_ABI, directly place the
target-hook #define in config/nios2/linux.h.  This appears to be in line
with other similar ports, e.g. m68k.

Sebastian, this should solve your issue of not wanting __sync_* libcalls
generated on RTEMS (which also uses TARGET_LINUX_ABI due to TLS support),
can you verify it works for you?

Chung-Lin

	PR target/78357
	* config/nios2/nios2.c (nios2_init_libfuncs): Remove TARGET_LINUX_ABI
	condition.
	(TARGET_INIT_LIBFUNCS): Delete definition and...
	* config/nios2/linux.h (TARGET_INIT_LIBFUNCS): ...move to here, add
	comments.
-------------- next part --------------
Index: config/nios2/nios2.c
===================================================================
--- config/nios2/nios2.c	(revision 242468)
+++ config/nios2/nios2.c	(working copy)
@@ -3607,9 +3607,7 @@ nios2_expand_builtin (tree exp, rtx target, rtx su
 static void
 nios2_init_libfuncs (void)
 {
-  /* For Linux, we have access to kernel support for atomic operations.  */
-  if (TARGET_LINUX_ABI)
-    init_sync_libfuncs (UNITS_PER_WORD);
+  init_sync_libfuncs (UNITS_PER_WORD);
 }
 
 

@@ -4986,9 +4984,6 @@ nios2_adjust_reg_alloc_order (void)
 #undef TARGET_BUILTIN_DECL
 #define TARGET_BUILTIN_DECL nios2_builtin_decl
 
-#undef TARGET_INIT_LIBFUNCS
-#define TARGET_INIT_LIBFUNCS nios2_init_libfuncs
-
 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
 #define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_true
 
Index: config/nios2/linux.h
===================================================================
--- config/nios2/linux.h	(revision 242468)
+++ config/nios2/linux.h	(working copy)
@@ -44,3 +44,7 @@
    Nios II Processor Reference Handbook.  */
 #define TARGET_LINUX_ABI 1
 
+/* For Linux, we have access to kernel support for atomic operations,
+   add initialization for __sync_* builtins.  */
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS nios2_init_libfuncs


More information about the Gcc-patches mailing list