Skip to content

RV32IMA build is broken #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kito-cheng opened this issue Oct 14, 2016 · 8 comments
Closed

RV32IMA build is broken #185

kito-cheng opened this issue Oct 14, 2016 · 8 comments

Comments

@kito-cheng
Copy link
Collaborator

RV32IMA build is broken after 55f8308

$ /home/kito/riscv-workspace/riscv-gnu-toolchain/configure --prefix=/home/kito/riscv-workspace/rv32i --with-xlen=32 --disable-float
$ make linux
...
/home/kito/riscv-workspace/rv32i/lib/gcc/riscv32-unknown-linux-gnu/6.1.0/../../../../riscv32-unknown-linux-gnu/bin/ld: /home/kito/riscv-workspace/rv32i-x/build-glibc-linux32/csu/init.o: can't link hard-float modules with soft-float modules
/home/kito/riscv-workspace/rv32i/lib/gcc/riscv32-unknown-linux-gnu/6.1.0/../../../../riscv32-unknown-linux-gnu/bin/ld: failed to merge target specific data of file /home/kito/riscv-workspace/rv32i-x/build-glibc-linux32/csu/init.o
collect2: error: ld returned 1 exit status
Makefile:94: recipe for target '/home/kito/riscv-workspace/rv32i-x/build-glibc-linux32/csu/crt1.o' failed
make[3]: *** [/home/kito/riscv-workspace/rv32i-x/build-glibc-linux32/csu/crt1.o] Error 1
make[3]: Leaving directory '/home/kito/riscv-workspace/riscv-gnu-toolchain/riscv-glibc/csu'
Makefile:214: recipe for target 'csu/subdir_lib' failed
make[2]: *** [csu/subdir_lib] Error 2
make[2]: Leaving directory '/home/kito/riscv-workspace/riscv-gnu-toolchain/riscv-glibc'
Makefile:9: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/kito/riscv-workspace/rv32i-x/build-glibc-linux32'
Makefile:158: recipe for target 'stamps/build-glibc-linux32' failed
make: *** [stamps/build-glibc-linux32] Error 2
@kito-cheng
Copy link
Collaborator Author

Btw, RV32G, RV64IMA RV64G is ok

@palmer-dabbelt
Copy link
Contributor

I think I at least have a workaround: pass "--with-arch=RV32IMA" instead of "--with-xlen=32 --disable-float"

$ ../configure --prefix=$RISCV --enable-linux --with-arch=RV32IMA
$ make
...
$ ./install/bin/riscv32-unknown-linux-gnu-objdump -d ./install/sysroot/lib32/libc-2.24.so | grep flw

There's two commits inside the submodule bumps that look like they could be relevant to me:
riscvarchive/riscv-binutils-gdb@b094680
riscvarchive/riscv-gcc@657f560

The fact that changing "--with-arch" changes the behavior makes me think it's the GCC commit, as that's the one that explicitly parses an ISA string. I'm trying this

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6f03b6a..c327d07 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4000,12 +4000,10 @@ case "${target}" in
                        # Default to soft-float unless D extension is present
                        # (which is also the case if with_arch is not set).
                        case ${with_arch} in
-                               "")
-                                       ;;
                                *g* | *G* | *d* | *D*)
                                        with_float=hard
                                        ;;
-                               *)
+                               "" | *)
                                        with_float=soft
                                        ;;
                        esac

under the assumption that the comment is correct, but it's just a guess (I don't know what with_float="" means).

palmer-dabbelt added a commit to riscvarchive/riscv-gcc that referenced this issue Oct 14, 2016
@palmer-dabbelt
Copy link
Contributor

OK, it looks like it's working for me: riscvarchive/riscv-gcc@1ab8b1e

@kito-cheng
Copy link
Collaborator Author

It's break more build, the riscvarchive/riscv-gcc@1ab8b1e seem treat empty ISA string as IMA not G.

However my RV32IMA still build fail after follow change, and make RV64IMA build fail:

diff --git a/gcc/config.gcc b/gcc/config.gcc
index c327d07..766e401 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4000,10 +4000,10 @@ case "${target}" in
                        # Default to soft-float unless D extension is present
                        # (which is also the case if with_arch is not set).
                        case ${with_arch} in
-                               *g* | *G* | *d* | *D*)
+                               "" | *g* | *G* | *d* | *D*)
                                        with_float=hard
                                        ;;
-                               "" | *)
+                               *)
                                        with_float=soft
                                        ;;
                        esac

kito-cheng pushed a commit to kito-cheng/riscv-gcc that referenced this issue Oct 17, 2016
@kito-cheng
Copy link
Collaborator Author

kito-cheng commented Oct 17, 2016

The root cause seem the gcc no longer pass -msoft-float/-mhard-float kito-cheng/riscv-gcc@93fb18c, it's make .s/.S get wrong ABI flag, however it's introduce new test fail after fix [1].

                                    |     rv32ima   |       rv32g   |     rv64ima   |       rv64g   | 
gcc       # of expected failures    |   127 (    0) |   127 (    0) |   129 (    0) |   129 (    0) | 
          # of expected passes      | 82386 (    5) | 82393 (    8) | 83802 (    5) | 83791 (  -26) | 
          # of unexpected failures  |    62 (    0) |    69 (   -8) |    77 (    0) |   120 (   28) | 
          # of unexpected successes |     0 (    0) |     0 (    0) |     0 (    0) |     0 (    0) | 
          # of unresolved testcases |    10 (    0) |    10 (    0) |    10 (    0) |    20 (   10) | 
          # of unsupported tests    |  1643 (   -2) |  1636 (    0) |  1514 (   -2) |  1499 (    0) | 
g++       # of expected failures    |   303 (    0) |   303 (    0) |   303 (    0) |   303 (    0) | 
          # of expected passes      | 90602 (    0) | 90602 (    5) | 92482 (    0) | 92482 (    0) | 
          # of unexpected failures  |    30 (    0) |    30 (   -5) |    22 (    0) |    22 (    0) | 
          # of unexpected successes |     2 (    0) |     2 (    0) |     2 (    0) |     2 (    0) | 
          # of unresolved testcases |     0 (    0) |     0 (    0) |     0 (    0) |     0 (    0) | 
          # of unsupported tests    |  3876 (    0) |  3876 (    0) |  3853 (    0) |  3853 (    0) | 

[1] https://github.com/kito-cheng/riscv-gcc/commits/empty-isa-string

  • include fix in prev comment

@kito-cheng
Copy link
Collaborator Author

Can you update document in configure.ac and consider to remove --with-xlen= and --disable-float option from configure option if --with-arch is recommended.

Document for Test Suite is need to update too since configure with --disable-float will generate floating point instruction now, but it's not support by gdb-sim yet.

@kito-cheng
Copy link
Collaborator Author

riscvarchive/riscv-gcc#9 is make it build-able with --with-arch=RV32IMA, but the new fail is not resolve yet, those fail will fix with long double.

palmer-dabbelt added a commit to riscvarchive/riscv-gcc that referenced this issue Oct 21, 2016
@palmer-dabbelt
Copy link
Contributor

OK, so I think this is all set. Thanks for the all the work!

aswaterman pushed a commit to riscvarchive/riscv-gcc that referenced this issue Dec 13, 2016
palmer-dabbelt added a commit to riscvarchive/riscv-gcc that referenced this issue Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants