diff mbox

[nios2] Fix PR78357, adjust sync builtin initialization

Message ID 7465a424-b224-602a-9878-814480476663@mentor.com
State New
Headers show

Commit Message

Chung-Lin Tang Nov. 16, 2016, 9:53 a.m. UTC
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.

Comments

Sebastian Huber Nov. 16, 2016, 11:05 a.m. UTC | #1
Thanks, Chung-Lin. This fixes the problem for RTEMS. The TLS support 
works also.

On 16/11/16 10:53, Chung-Lin Tang wrote:
> 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.
Jeff Law Nov. 23, 2016, 10:28 p.m. UTC | #2
On 11/16/2016 02:53 AM, Chung-Lin Tang wrote:
> 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.
>
I fear you may have botched this;

g++ -fno-PIE -c   -g  -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE 
-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall 
-Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute 
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros 
-Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. 
-I/home/law/gcc-testing/gcc/gcc -I/home/law/gcc-testing/gcc/gcc/. 
-I/home/law/gcc-testing/gcc/gcc/../include 
-I/home/law/gcc-testing/gcc/gcc/../libcpp/include 
-I/opt/cfarm/mpc/include 
-I/home/law/gcc-testing/gcc/gcc/../libdecnumber 
-I/home/law/gcc-testing/gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
-I/home/law/gcc-testing/gcc/gcc/../libbacktrace   -o nios2.o -MT nios2.o 
-MMD -MP -MF ./.deps/nios2.TPo 
/home/law/gcc-testing/gcc/gcc/config/nios2/nios2.c
/home/law/gcc-testing/gcc/gcc/config/nios2/nios2.c:3608:1: error: ‘void 
nios2_init_libfuncs()’ defined but not used [-Werror=unused-function]
  nios2_init_libfuncs (void)

nios2-elf configuration

jeff
Sebastian Huber Nov. 24, 2016, 6:57 a.m. UTC | #3
Hello Jeff,

On 23/11/16 23:28, Jeff Law wrote:
> On 11/16/2016 02:53 AM, Chung-Lin Tang wrote:
>> 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.
>>
> I fear you may have botched this;
>
> g++ -fno-PIE -c   -g  -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE 
> -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall 
> -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute 
> -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros 
> -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. 
> -I/home/law/gcc-testing/gcc/gcc -I/home/law/gcc-testing/gcc/gcc/. 
> -I/home/law/gcc-testing/gcc/gcc/../include 
> -I/home/law/gcc-testing/gcc/gcc/../libcpp/include 
> -I/opt/cfarm/mpc/include 
> -I/home/law/gcc-testing/gcc/gcc/../libdecnumber 
> -I/home/law/gcc-testing/gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
> -I/home/law/gcc-testing/gcc/gcc/../libbacktrace   -o nios2.o -MT 
> nios2.o -MMD -MP -MF ./.deps/nios2.TPo 
> /home/law/gcc-testing/gcc/gcc/config/nios2/nios2.c
> /home/law/gcc-testing/gcc/gcc/config/nios2/nios2.c:3608:1: error: 
> ‘void nios2_init_libfuncs()’ defined but not used 
> [-Werror=unused-function]
>  nios2_init_libfuncs (void)

in my build this was only a warning. How do you enable the -Werror for 
the GCC build? Is this the normal way to build GCC?
Jeff Law Nov. 24, 2016, 3:31 p.m. UTC | #4
On 11/23/2016 11:57 PM, Sebastian Huber wrote:
> Hello Jeff,
>
> On 23/11/16 23:28, Jeff Law wrote:
>> On 11/16/2016 02:53 AM, Chung-Lin Tang wrote:
>>> 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.
>>>
>> I fear you may have botched this;
>>
>> g++ -fno-PIE -c   -g  -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE
>> -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
>> -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
>> -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
>> -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I.
>> -I/home/law/gcc-testing/gcc/gcc -I/home/law/gcc-testing/gcc/gcc/.
>> -I/home/law/gcc-testing/gcc/gcc/../include
>> -I/home/law/gcc-testing/gcc/gcc/../libcpp/include
>> -I/opt/cfarm/mpc/include
>> -I/home/law/gcc-testing/gcc/gcc/../libdecnumber
>> -I/home/law/gcc-testing/gcc/gcc/../libdecnumber/dpd -I../libdecnumber
>> -I/home/law/gcc-testing/gcc/gcc/../libbacktrace   -o nios2.o -MT
>> nios2.o -MMD -MP -MF ./.deps/nios2.TPo
>> /home/law/gcc-testing/gcc/gcc/config/nios2/nios2.c
>> /home/law/gcc-testing/gcc/gcc/config/nios2/nios2.c:3608:1: error:
>> ‘void nios2_init_libfuncs()’ defined but not used
>> [-Werror=unused-function]
>>  nios2_init_libfuncs (void)
>
> in my build this was only a warning. How do you enable the -Werror for
> the GCC build? Is this the normal way to build GCC?
--enable-werror-always

It's standard for builds using config-list.mk, which some of us use for 
wide target testing.

jeff
diff mbox

Patch

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