[committed] C-SKY: Define SYSROOT_SUFFIX_SPEC.

Message ID 20230113124319.75544-1-cooper.qu@linux.alibaba.com
State Committed
Headers
Series [committed] C-SKY: Define SYSROOT_SUFFIX_SPEC. |

Commit Message

瞿仙淼 Jan. 13, 2023, 12:43 p.m. UTC
  The earlier patch
  https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575418.html
refine the way to generate sysroot suffix, but it can't find the
right path for all CPUs. The SYSROOT_SUFFIX_SPEC should be defined
to fix it.

gcc/
	* config/csky/csky-linux-elf.h (SYSROOT_SUFFIX_SPEC): New.
---
 gcc/config/csky/csky-linux-elf.h | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Joseph Myers Jan. 20, 2023, 5:27 p.m. UTC | #1
On Fri, 13 Jan 2023, Xianmiao Qu via Gcc-patches wrote:

> The earlier patch
>   https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575418.html
> refine the way to generate sysroot suffix, but it can't find the
> right path for all CPUs. The SYSROOT_SUFFIX_SPEC should be defined
> to fix it.

I think this caused the build failures with build-many-glibcs.py shown by 
my bot.  SYSROOT_SUFFIX_SPEC should not be defined for a 
--disable-multilib build; in such a build you can expect a single sysroot 
without a suffix involved.  Thus, you should put the SYSROOT_SUFFIX_SPEC 
definition in a separate header only used if test "x${enable_multilib}" = 
xyes (as in the config.gcc code removed in the older patch you refer to 
above), or something similar.

https://sourceware.org/pipermail/libc-testresults/2023q1/010706.html

The error is:

/scratch/jmyers/glibc-bot/install/compilers/csky-linux-gnuabiv2/csky-glibc-linux-gnuabiv2/bin/ld: cannot find -lc: No such file or directory

(linking shared libgcc).
  
瞿仙淼 Jan. 25, 2023, 9:41 a.m. UTC | #2
On Fri, Jan 20, 2023 at 05:27:26PM +0000, Joseph Myers wrote:

> I think this caused the build failures with build-many-glibcs.py shown by 
> my bot.  SYSROOT_SUFFIX_SPEC should not be defined for a 
> --disable-multilib build; in such a build you can expect a single sysroot 
> without a suffix involved.  Thus, you should put the SYSROOT_SUFFIX_SPEC 
> definition in a separate header only used if test "x${enable_multilib}" = 
> xyes (as in the config.gcc code removed in the older patch you refer to 
> above), or something similar.
> 

Hi Joseph,

Sorry, this is indeed caused by this patch. I tested the multilib scenario, but I didn't test the non-multilib, so I didn't find this problem in time.
Now I have fixed this problem, the patch can be seen in
  https://gcc.gnu.org/pipermail/gcc-patches/2023-January/610534.html
Hope it also works for you, If you still have problems, please contact me.



Thanks,
Cooper
  

Patch

diff --git a/gcc/config/csky/csky-linux-elf.h b/gcc/config/csky/csky-linux-elf.h
index 677c201b218..3f67af64c15 100644
--- a/gcc/config/csky/csky-linux-elf.h
+++ b/gcc/config/csky/csky-linux-elf.h
@@ -65,6 +65,14 @@ 
 
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-cskyv2%{mfloat-abi=hard:-hf}%{mbig-endian:-be}.so.1"
 
+#define SYSROOT_SUFFIX_SPEC					\
+  "%{mbig-endian:/big}"						\
+  "%{mcpu=ck807*:/ck807}"					\
+  "%{mcpu=ck860*:/ck860}"					\
+  "%{mcpu=ck800*:/ck800}"					\
+  "%{mfloat-abi=softfp:/soft-fp}"				\
+  "%{mfloat-abi=hard:/hard-fp}"
+
 #define LINUX_TARGET_LINK_SPEC	"%{h*} %{version:-v}		\
    %{b}								\
    %{static:-Bstatic}						\