[PATCH] [ARC] Fix stack usage info for naked functions.

2018-04-06 Thread Alexey Brodkin
When code containing "naked" function gets compiled with '-fstack-usage'
compiler prints the following warning:
-->8-
board/synopsys/hsdk/hsdk.c: In function 'hsdk_core_init_f':
board/synopsys/hsdk/hsdk.c:345:1: warning: stack usage computation not 
supported for this target
 }
 ^
-->8-

Even though stack calculation makes no sense for "naked" function
we still need to correctly report stack size back to make compiler
happy.

This problem was caught in U-Boot here:
https://lists.denx.de/pipermail/u-boot/2018-March/324325.html

The same fix was done earlier for ARM, see:
"config/arm/arm.c (arm_expand_prologue): Set the stack usage to 0 "
https://github.com/gcc-mirror/gcc/commit/023a7c5dd37

gcc/
2018-04-06  Alexey Brodkin 

* config/arc/arc.c (arc_expand_prologue): Set stack usage info
also for naked functions.
---
 gcc/config/arc/arc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 32fcb81880a2..3cb4ba5b4dd7 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -3149,7 +3149,11 @@ arc_expand_prologue (void)
 
   /* Naked functions don't have prologue.  */
   if (ARC_NAKED_P (fn_type))
-return;
+{
+  if (flag_stack_usage_info)
+   current_function_static_stack_size = 0;
+  return;
+}
 
   /* Compute total frame size.  */
   size = arc_compute_frame_size ();
-- 
2.14.3



[PATCH] [ARC] Fix generation of specs

2018-09-13 Thread Alexey Brodkin
With no trailing space in LINK_EH_SPEC linker spec gets generated as:
>8-
%{!r:--build-id} --eh-frame-hdr%{h*} ...
>8-

or even worse if hash style is added:
>8-
%{!r:--build-id} --eh-frame-hdr--hash-style=sysv %{h*} ...
>8-

Now if that spec is really used by LD then it fails inevitably
saying that it doesn't know option "--eh-frame-hdr--hash-style=sysv".

Cc: Andrew Burgess 
Cc: Claudiu Zissulescu 
---
 gcc/config/arc/linux.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h
index 96d548eae341..62ebe4de0fc7 100644
--- a/gcc/config/arc/linux.h
+++ b/gcc/config/arc/linux.h
@@ -98,7 +98,7 @@ along with GCC; see the file COPYING3.  If not see
Signalize that because we have fde-glibc, we don't need all C shared libs
linked against -lgcc_s.  */
 #undef LINK_EH_SPEC
-#define LINK_EH_SPEC "--eh-frame-hdr"
+#define LINK_EH_SPEC "--eh-frame-hdr "
 #endif
 
 #undef SUBTARGET_CPP_SPEC
-- 
2.17.1



Re: [PATCH] [ARC] Fix generation of specs

2018-09-13 Thread Alexey Brodkin
Hi Claus,

On Thu, 2018-09-13 at 09:59 +0200, Claudiu Zissulescu wrote:
> The patch is missing the entry change log. Otherwise is ok. I'll push it with 
> the mentioned changes.

Thanks for taking care.

Also may we have it back-ported to 8.x branch so it will be a part of 8.3 
release later?

-Alexey


[PATCH] ARC: Add multilib support for linux targets

2018-05-16 Thread Alexey Brodkin
We used to build baremetal (AKA Elf32) multilibbed toolchains for years
now but never made that for Linux targets since there were problems with
uClibc n multilib setup. Now with help of Crosstool-NG it is finally
possible to create uClibc-based multilibbed toolchains and so we add
relevant CPUs for multilib in case of configuration for "arc*-*-linux*".

This will be essentially useful for glibc-based multilibbbed toolchains
in the future.

gcc/
2018-05-16  Alexey Brodkin 

* config.gcc: Add arc/t-multilib-linux to tmake_file for
arc*-*-linux*.
* config/arc/t-multilib-linux: Specify MULTILIB_OPTIONS and
MULTILIB_DIRNAMES
---
 gcc/config.gcc  |  2 +-
 gcc/config/arc/t-multilib-linux | 25 +
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 gcc/config/arc/t-multilib-linux

diff --git a/gcc/config.gcc b/gcc/config.gcc
index a5defb0f0058..8e038a72f613 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1059,7 +1059,7 @@ arc*-*-elf*)
;;
 arc*-*-linux*)
tm_file="arc/arc-arch.h dbxelf.h elfos.h gnu-user.h linux.h 
linux-android.h glibc-stdint.h arc/linux.h ${tm_file}"
-   tmake_file="${tmake_file} arc/t-arc"
+   tmake_file="${tmake_file} arc/t-multilib-linux arc/t-arc"
extra_gcc_objs="driver-arc.o"
if test "x$with_cpu" != x; then
tm_defines="${tm_defines} TARGET_CPU_BUILD=PROCESSOR_$with_cpu"
diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux
new file mode 100644
index ..f357cfc3f926
--- /dev/null
+++ b/gcc/config/arc/t-multilib-linux
@@ -0,0 +1,25 @@
+# Copyright (C) 2018 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3, or (at your option) any later
+# version.
+#
+# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+MULTILIB_OPTIONS = 
mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
+
+MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
+
+# Aliases:
+MULTILIB_MATCHES += mcpu?arc700=mA7
+MULTILIB_MATCHES += mcpu?arc700=mARC700
-- 
2.17.0



RE: [PATCH] [ARC] Allow more ABIs in GLIBC_DYNAMIC_LINKER

2020-03-31 Thread Alexey Brodkin via Gcc-patches
Hi Claus,

> -Original Message-
> From: linux-snps-arc  On Behalf 
> Of Claudiu Zissulescu
> Ianculescu
> Sent: Tuesday, March 31, 2020 1:07 PM
> To: Vineet Gupta 
> Cc: linux-snps-...@lists.infradead.org; gcc-patches@gcc.gnu.org; Claudiu 
> Zissulescu
> 
> Subject: Re: [PATCH] [ARC] Allow more ABIs in GLIBC_DYNAMIC_LINKER
> 
> Pushed.

Is this one eligible for being back-ported to older GCCs?
At least GCC 9.x would be really good.

-Alexey