public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, nios2] Fix PR78357, adjust sync builtin initialization
@ 2016-11-16  9:54 Chung-Lin Tang
  2016-11-16 11:06 ` Sebastian Huber
  2016-11-23 22:28 ` Jeff Law
  0 siblings, 2 replies; 6+ messages in thread
From: Chung-Lin Tang @ 2016-11-16  9:54 UTC (permalink / raw)
  To: gcc-patches, Sebastian Huber; +Cc: Sandra Loosemore

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

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.

[-- Attachment #2: z.diff --]
[-- Type: text/plain, Size: 1284 bytes --]

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);
 }
 
 \f
@@ -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

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

* Re: [patch, nios2] Fix PR78357, adjust sync builtin initialization
  2016-11-16  9:54 [patch, nios2] Fix PR78357, adjust sync builtin initialization Chung-Lin Tang
@ 2016-11-16 11:06 ` Sebastian Huber
  2016-11-23 22:28 ` Jeff Law
  1 sibling, 0 replies; 6+ messages in thread
From: Sebastian Huber @ 2016-11-16 11:06 UTC (permalink / raw)
  To: Chung-Lin Tang, gcc-patches; +Cc: Sandra Loosemore

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.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

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

* Re: [patch, nios2] Fix PR78357, adjust sync builtin initialization
  2016-11-16  9:54 [patch, nios2] Fix PR78357, adjust sync builtin initialization Chung-Lin Tang
  2016-11-16 11:06 ` Sebastian Huber
@ 2016-11-23 22:28 ` Jeff Law
  2016-11-24  6:57   ` Sebastian Huber
  2016-11-24  9:32   ` Chung-Lin Tang
  1 sibling, 2 replies; 6+ messages in thread
From: Jeff Law @ 2016-11-23 22:28 UTC (permalink / raw)
  To: Chung-Lin Tang, gcc-patches, Sebastian Huber; +Cc: Sandra Loosemore

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

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

* Re: [patch, nios2] Fix PR78357, adjust sync builtin initialization
  2016-11-23 22:28 ` Jeff Law
@ 2016-11-24  6:57   ` Sebastian Huber
  2016-11-24 15:31     ` Jeff Law
  2016-11-24  9:32   ` Chung-Lin Tang
  1 sibling, 1 reply; 6+ messages in thread
From: Sebastian Huber @ 2016-11-24  6:57 UTC (permalink / raw)
  To: Jeff Law, Chung-Lin Tang, gcc-patches; +Cc: Sandra Loosemore

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?

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

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

* Re: [patch, nios2] Fix PR78357, adjust sync builtin initialization
  2016-11-23 22:28 ` Jeff Law
  2016-11-24  6:57   ` Sebastian Huber
@ 2016-11-24  9:32   ` Chung-Lin Tang
  1 sibling, 0 replies; 6+ messages in thread
From: Chung-Lin Tang @ 2016-11-24  9:32 UTC (permalink / raw)
  To: Jeff Law, gcc-patches, Sebastian Huber; +Cc: Sandra Loosemore

[-- Attachment #1: Type: text/plain, Size: 2024 bytes --]

On 2016/11/24 6:28 AM, 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)
> 
> nios2-elf configuration
> 
> jeff

Thanks for catching, committed the attached patch.

Chung-Lin

	* config/nios2/nios2.c (nios2_init_libfuncs): Add ATTRIBUTE_UNUSED.


[-- Attachment #2: x.diff --]
[-- Type: text/plain, Size: 411 bytes --]

Index: config/nios2/nios2.c
===================================================================
--- config/nios2/nios2.c	(revision 242818)
+++ config/nios2/nios2.c	(working copy)
@@ -3604,7 +3604,7 @@ nios2_expand_builtin (tree exp, rtx target, rtx su
 }
 
 /* Implement TARGET_INIT_LIBFUNCS.  */
-static void
+static void ATTRIBUTE_UNUSED
 nios2_init_libfuncs (void)
 {
   init_sync_libfuncs (UNITS_PER_WORD);

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

* Re: [patch, nios2] Fix PR78357, adjust sync builtin initialization
  2016-11-24  6:57   ` Sebastian Huber
@ 2016-11-24 15:31     ` Jeff Law
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Law @ 2016-11-24 15:31 UTC (permalink / raw)
  To: Sebastian Huber, Chung-Lin Tang, gcc-patches; +Cc: Sandra Loosemore

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

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

end of thread, other threads:[~2016-11-24 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16  9:54 [patch, nios2] Fix PR78357, adjust sync builtin initialization Chung-Lin Tang
2016-11-16 11:06 ` Sebastian Huber
2016-11-23 22:28 ` Jeff Law
2016-11-24  6:57   ` Sebastian Huber
2016-11-24 15:31     ` Jeff Law
2016-11-24  9:32   ` Chung-Lin Tang

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