public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: joseph@codesourcery.com
Cc: libc-alpha@sourceware.org, Andrew Waterman <andrew@sifive.com>,
	Darius Rad <darius@bluespec.com>,
	dj@redhat.com
Subject: Re: [PATCH v2 01/15] RISC-V: Build Infastructure
Date: Sat, 23 Dec 2017 02:22:00 -0000	[thread overview]
Message-ID: <mhng-9dd0816f-ac7e-48ef-9dc5-f0c7a98c7092@palmer-si-x1c4> (raw)
In-Reply-To: <alpine.DEB.2.20.1712201610040.30469@digraph.polyomino.org.uk>

Sorry it took a while to get back to you, I've been working through the test 
suite failures.

On Wed, 20 Dec 2017 08:21:55 PST (-0800), joseph@codesourcery.com wrote:
> On Tue, 19 Dec 2017, Palmer Dabbelt wrote:
>
>> diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
>> new file mode 100644
>> index 000000000000..64060531a1d5
>> --- /dev/null
>> +++ b/sysdeps/riscv/Makefile
>> @@ -0,0 +1,49 @@
>> +ifneq ($(all-rtld-routines),)
>> +CFLAGS-rtld.c += -mno-plt
>
> My previous comments from
> <https://sourceware.org/ml/libc-alpha/2017-06/msg00645.html> still apply:
> this is too fragile (people won't think when making an
> architecture-independent change about whether it needs a RISC-V-specific
> change here) and completely lacking the required detailed explanatory
> comment of what the issue is and the logic for determining what files need
> this option (but really the logic should be implemented to avoid an
> architecture-specific list of architecture-independent files being needed
> at all).

Ah, sorry, I missed that from last time.  I thought we were doing this because 
we couldn't call via the PLT in ld.so because they hadn't been resolved yet, 
but as far as I can tell there's something else handling this.  I just ran into 
it when looking at the check-localplt stuff (I'm currently going through the 
test suites).

Andrew would know for sure what's going on here -- this has been in our port 
since ~2011 (when he added PLT support) and has never had an explanation.  I 
feel like it's defunct: when I remove it we end up with only the PLT entries 
listed in check-localplt, I'd expect a lot more if everything was really 
emitting PLT calls.  I can't figure out what's actually preventing ld.so from 
using PLT calls on the _dl_fixup codepath.

I assume I'm missing something here?

>
>> diff --git a/sysdeps/riscv/Versions b/sysdeps/riscv/Versions
>> new file mode 100644
>> index 000000000000..aafa348a2395
>> --- /dev/null
>> +++ b/sysdeps/riscv/Versions
>> @@ -0,0 +1,4 @@
>> +libc {
>> +  GLIBC_2.27 {
>> +  }
>> +}
>
> You shouldn't need this file at all when there aren't any versions to
> include in it.

IIRC some test was depending on this.  I've filled all the machines with builds 
right now, but I'll give it another look later tonight.  I've got two small 
patches that touch shared build system stuff already.

>> diff --git a/sysdeps/riscv/preconfigure b/sysdeps/riscv/preconfigure
>
> Does your soft-float lack support for exceptions and rounding modes?  If
> so, I'd expect a setting of with_fp_cond, and a corresponding nofpu
> directory or directories with Implies files pointing to ieee754/soft-fp
> (arranged so that always comes before the other ieee754/ directories in
> the sysdeps directory ordering).  That's needed to get the soft-fp
> versions of fmaf/fma/fmal used instead of the default ones relying on
> exceptions and rounding modes, so its absence should show up as test
> failures for soft-float configurations.  In future it will also similarly
> be needed to get soft-fp versions of TS 18661-1 narrowing functions used.

If I understand what's going on correctly here, we support exceptions in the 
soft float ABI when built with hardware floating point instructions, but 
otherwise we don't (we're always round nearest).  I believe that means we need 
to set "with_fp_cond=1" when building with hardware floating point (regardless 
of ABI), and "with_fp_cond=0" otherwise.

Does this look sane?

diff --git a/sysdeps/riscv/preconfigure b/sysdeps/riscv/preconfigure
index e118a5ed28f6..6f2bc20ecd5b 100644
--- a/sysdeps/riscv/preconfigure
+++ b/sysdeps/riscv/preconfigure
@@ -16,12 +16,15 @@ riscv*)
     case "$flen" in
     64)
        float_machine=rvd
+       with_fp_cond=1
        ;;
     32)
        float_machine=rvf
+       with_fp_cond=1
        ;;
     "")
        float_machine=
+       with_fp_cond=0
        ;;
     *)
        echo "Unable to determine FLEN" >&2


> Remark: it makes sense for ieee754/dbl-64/wordsize-64 to be used (before
> ieee754/dbl-64 in the sysdeps directory ordering) in configurations with
> 64-bit registers (but that's just an optimization so you may wish to defer
> it).
>
>> +abi-ilp32-options     := -D__SIZEOF_INT__=4
>
> abi-* options variables are no longer used with the current bits/syscall.h
> generation mechanism, so you should remove all settings of such variables
> from the patch.

OK, we'll remove them for the v3.

>
>> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/Makefile b/sysdeps/unix/sysv/linux/riscv/rv64/Makefile
>> new file mode 100644
>> index 000000000000..cb60d740476d
>> --- /dev/null
>> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/Makefile
>> @@ -0,0 +1,4 @@
>> +ifeq ($(subdir),socket)
>> +CFLAGS-recv.c += -fexceptions
>> +CFLAGS-send.c += -fexceptions
>> +endif
>
> I wonder if this should be made generic for all Linux ports (and removed
> from the mips64 Makefile as well as here).

I think we got it from MIPS, but it doesn't seem like it should be ISA 
dependent.  I'm afraid this is another thing that's been there since before I 
was around, but I feel like since it's not in anyone else's port it's safe to 
drop it from ours.

Thanks for reviewing our code, and sorry it's a bit of a mess.  I'll try and 
get something a bit more sane out for a v3, but I'm afraid it might take a few 
more days -- luckily with the weekend and Christmas I should have some time to 
actually work on this :).

  parent reply	other threads:[~2017-12-23  2:22 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20  7:23 RISC-V glibc port v2 Palmer Dabbelt
2017-12-20  7:23 ` [PATCH v2 03/15] RISC-V: Startup and Dynamic Loading Code Palmer Dabbelt
2017-12-20 16:38   ` Joseph Myers
2017-12-23  3:25     ` Palmer Dabbelt
2017-12-23  3:33       ` DJ Delorie
2017-12-23 12:52       ` Joseph Myers
2017-12-20  7:23 ` [PATCH v2 04/15] RISC-V: Thread-Local Storage Support Palmer Dabbelt
2017-12-20 16:45   ` Joseph Myers
2017-12-23 19:10     ` Palmer Dabbelt
2017-12-20  7:23 ` [PATCH v2 02/15] RISC-V: ABI Implementation Palmer Dabbelt
2017-12-20 16:31   ` Joseph Myers
2017-12-23  3:25     ` Palmer Dabbelt
2017-12-23  3:30       ` DJ Delorie
2017-12-20  7:23 ` [PATCH v2 05/15] RISC-V: Generic <string.h> Routines Palmer Dabbelt
2017-12-20 16:48   ` Joseph Myers
2017-12-23 22:01     ` Palmer Dabbelt
2018-01-01  0:52       ` Joseph Myers
2018-01-03 15:46         ` Adhemerval Zanella
2018-01-03 16:03           ` Joseph Myers
2018-01-03 16:08             ` Adhemerval Zanella
2017-12-20  7:23 ` [PATCH v2 01/15] RISC-V: Build Infastructure Palmer Dabbelt
2017-12-20 14:05   ` Dmitry V. Levin
2017-12-20 20:25     ` Palmer Dabbelt
2017-12-20 16:22   ` Joseph Myers
2017-12-20 16:49     ` Adhemerval Zanella
2017-12-23  2:22     ` Palmer Dabbelt [this message]
2017-12-23 12:44       ` Joseph Myers
2017-12-25 20:58         ` Palmer Dabbelt
2018-01-01  1:21           ` Joseph Myers
2017-12-20 16:43   ` Joseph Myers
2017-12-23  3:41     ` Palmer Dabbelt
2017-12-23 12:53       ` Joseph Myers
2017-12-20  7:24 ` [PATCH v2 08/15] RISC-V: RV32D, RV64F, and RV64D Support Palmer Dabbelt
2017-12-20  7:24 ` [PATCH v2 07/15] RISC-V: RV32F Support Palmer Dabbelt
2017-12-20 17:01   ` Joseph Myers
2017-12-20 17:04     ` Joseph Myers
2017-12-24  1:26       ` Palmer Dabbelt
2017-12-24  0:37     ` Palmer Dabbelt
2018-01-01  0:57       ` Joseph Myers
2017-12-20  7:24 ` [PATCH v2 09/15] RISC-V: Atomic and Locking Routines Palmer Dabbelt
2017-12-20 17:08   ` Joseph Myers
2017-12-24  1:26     ` Palmer Dabbelt
2017-12-20  7:24 ` [PATCH v2 12/15] RISC-V: Linux Startup and Dynamic Loading Code Palmer Dabbelt
2017-12-20  7:24 ` [PATCH v2 10/15] RISC-V: Linux Syscall Interface Palmer Dabbelt
2017-12-20 16:57   ` Adhemerval Zanella
2017-12-24  0:24     ` Palmer Dabbelt
2018-01-01  0:56       ` Joseph Myers
2018-01-03 13:43         ` Christoph Hellwig
2018-01-03 15:56           ` Adhemerval Zanella
2018-01-09  1:30             ` Palmer Dabbelt
2018-01-09 11:16               ` Adhemerval Zanella
2017-12-20 17:24   ` Joseph Myers
2017-12-25 19:47     ` Palmer Dabbelt
2017-12-20  7:24 ` [PATCH v2 11/15] RISC-V: Linux ABI Palmer Dabbelt
2017-12-20 17:33   ` Joseph Myers
2017-12-25 19:47     ` Palmer Dabbelt
2018-01-01  1:04       ` Joseph Myers
2018-01-02 20:59         ` Joseph Myers
2017-12-20  7:24 ` [PATCH v2 06/15] RISC-V: Generic <math.h> and soft-fp Routines Palmer Dabbelt
2017-12-20 16:50   ` Joseph Myers
2017-12-24  0:24     ` Palmer Dabbelt
2017-12-20  7:24 ` [PATCH v2 15/15] Add RISC-V to build-many-glibcs.py Palmer Dabbelt
2017-12-20  7:24 ` [PATCH v2 14/15] Add linux-4.15 VDSO hash for RISC-V Palmer Dabbelt
2017-12-20  7:24 ` [PATCH v2 13/15] Add RISC-V dynamic relocations to elf.h Palmer Dabbelt
2017-12-20 16:04 ` RISC-V glibc port v2 Joseph Myers
2017-12-20 20:25   ` Palmer Dabbelt
2017-12-20 20:42     ` Joseph Myers
2017-12-20 17:40 ` Joseph Myers
2017-12-25 20:20   ` Palmer Dabbelt
2018-01-01  1:20     ` Joseph Myers
2018-01-03 13:37       ` Christoph Hellwig
2018-01-03 13:42         ` Joseph Myers
2017-12-20 21:11 ` Joseph Myers
2017-12-20 21:45   ` Palmer Dabbelt
2017-12-25 12:57     ` Adhemerval Zanella
2018-01-01  0:58       ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mhng-9dd0816f-ac7e-48ef-9dc5-f0c7a98c7092@palmer-si-x1c4 \
    --to=palmer@dabbelt.com \
    --cc=andrew@sifive.com \
    --cc=darius@bluespec.com \
    --cc=dj@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).