[v3,19/19] Add RISC-V to build-many-glibcs.py

Message ID 20171227060534.3998-20-palmer@dabbelt.com
State New, archived
Headers

Commit Message

Palmer Dabbelt Dec. 27, 2017, 6:05 a.m. UTC
  For full disclosure, I've only run build-many-glibcs.py with the
additional diff below.

    diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
    index 1c7b85050b57..22cc7b427041 100755
    --- a/scripts/build-many-glibcs.py
    +++ b/scripts/build-many-glibcs.py
    @@ -706,7 +706,7 @@ class Context(object):
                                 'gcc': 'vcs-7',
                                 'glibc': 'vcs-mainline',
                                 'gmp': '6.1.2',
    -                            'linux': '4.14',
    +                            'linux': '4.15-rc4',
                                 'mpc': '1.0.3',
                                 'mpfr': '3.1.6'}
             use_versions = {}
    @@ -841,7 +841,7 @@ class Context(object):
             url_map = {'binutils':
    'https://ftp.gnu.org/gnu/binutils/binutils-%(version)s.tar.bz2',
                        'gcc':
    'https://ftp.gnu.org/gnu/gcc/gcc-%(version)s/gcc-%(version)s.tar.bz2',
                        'gmp':
    'https://ftp.gnu.org/gnu/gmp/gmp-%(version)s.tar.xz',
    -                   'linux':
                        'https://www.kernel.org/pub/linux/kernel/v4.x/linux-%(version)s.tar.xz',
    +                   'linux':
    'https://git.kernel.org/torvalds/t/linux-%(version)s.tar.gz',
                        'mpc':
    'https://ftp.gnu.org/gnu/mpc/mpc-%(version)s.tar.gz',
                        'mpfr':
    'https://ftp.gnu.org/gnu/mpfr/mpfr-%(version)s.tar.xz'}
             if component not in url_map:
---
 scripts/build-many-glibcs.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
  

Comments

Joseph Myers Jan. 1, 2018, 1:55 a.m. UTC | #1
On Tue, 26 Dec 2017, Palmer Dabbelt wrote:

> +        self.add_config(arch='riscv64',
> +                        os_name='linux-gnu',
> +                        glibcs=[{'variant': 'rv64imafdc-lp64d',
> +                                 'ccopts': '-march=rv64imafdc -mabi=lp64d',
> +                                 'cfg': ['--libdir=/usr/lib64/lp64d',
> +                                         'libc_cv_slibdir=/lib64/lp64d',
> +                                         'libc_cv_rtlddir=/lib']},

You shouldn't need any of those --libdir libc_cv_slibdir libc_cv_rtlddir 
settings in build-many-glibcs.py - they indicate something is missing in 
the port itself.  Specifically, you should have a LIBC_SLIBDIR_RTLDDIR 
call in an appropriate sysdeps configure.ac file or files.

Also, the use of lib<something>/<something> subdirectories will break the 
handling of --strip, which expects to be able to strip lib*/*.so and catch 
all the shared libraries that way.  Probably that code should change to 
something like '%s $(find %s/lib* -name "*.so")' in place of the present 
'%s %s/lib*/*.so', supposing that does work.

(Most RISC-V build-many-glibcs.py testing of course only needs to test 
building compilers and glibc for the configurations you're adding.  But 
for the --strip fix you should test at least one other configuration as 
well to make sure --strip continues to work in existing configurations 
with e.g. lib and lib64 directories.  There should be no need for any of 
your build-many-glibcs.py testing to use the full set of configurations 
for all architectures.)
  

Patch

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 5df42e634a17..73f4d47dba54 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -322,6 +322,25 @@  class Context(object):
                         os_name='linux-gnuspe',
                         variant='e500v1',
                         gcc_cfg=['--disable-multilib', '--enable-secureplt'])
+        self.add_config(arch='riscv64',
+                        os_name='linux-gnu',
+                        glibcs=[{'variant': 'rv64imafdc-lp64d',
+                                 'ccopts': '-march=rv64imafdc -mabi=lp64d',
+                                 'cfg': ['--libdir=/usr/lib64/lp64d',
+                                         'libc_cv_slibdir=/lib64/lp64d',
+                                         'libc_cv_rtlddir=/lib']},
+                                {'variant': 'rv64imac-lp64',
+                                 'ccopts': '-march=rv64imac -mabi=lp64',
+                                 'cfg': ['--libdir=/usr/lib64/lp64',
+                                         'libc_cv_slibdir=/lib64/lp64',
+                                         'libc_cv_rtlddir=/lib']},
+                                {'variant': 'rv32imafdc-ilp32d',
+                                 'ccopts': '-march=rv32imafdc -mabi=ilp32d',
+                                 'cfg': ['--libdir=/usr/lib32/ilp32d',
+                                         'libc_cv_slibdir=/lib32/ilp32d',
+                                         'libc_cv_rtlddir=/lib']},
+                                {'variant': 'rv32imac-ilp32',
+                                 'ccopts': '-march=rv32imac -mabi=ilp32'}])
         self.add_config(arch='s390x',
                         os_name='linux-gnu',
                         glibcs=[{},
@@ -1207,6 +1226,8 @@  class Config(object):
                     'nios2': 'nios2',
                     'powerpc': 'powerpc',
                     's390': 's390',
+                    'riscv32': 'riscv',
+                    'riscv64': 'riscv',
                     'sh': 'sh',
                     'sparc': 'sparc',
                     'tile': 'tile',