Re: [PATCH] Add helper function for basename

2023-12-12 Thread Khem Raj
On Tue, Dec 12, 2023 at 5:18 AM Mark Wielaard  wrote:
>
> Hi Khem,
>
> On Sun, 2023-12-10 at 12:20 -0800, Khem Raj wrote:
> > musl does not provide GNU version of basename and lately have removed
> > the definiton from string.h [1] which exposes this problem. It can be
> > made to work by providing a local implementation of basename which
> > implements the GNU basename behavior, this makes it work across C
> > libraries which have POSIX implementation only.
>
> Thanks, this should work, but wouldn't it be easier to add a configure
> test for having basename defined in string.h and then only define
> basename in libeu.h (and build basename.c) if it isn't. So that all the
> code can just keep using basename (we just have to make sure libeu.h is
> included)?

we could do that but it will not work as expected with older musl releases
where the prototype in string.h will exist.

>
> Cheers,
>
> Mark


Re: [PATCH] Add helper function for basename

2023-12-12 Thread Mark Wielaard
Hi Khem,

On Sun, 2023-12-10 at 12:20 -0800, Khem Raj wrote:
> musl does not provide GNU version of basename and lately have removed
> the definiton from string.h [1] which exposes this problem. It can be
> made to work by providing a local implementation of basename which
> implements the GNU basename behavior, this makes it work across C
> libraries which have POSIX implementation only.

Thanks, this should work, but wouldn't it be easier to add a configure
test for having basename defined in string.h and then only define
basename in libeu.h (and build basename.c) if it isn't. So that all the
code can just keep using basename (we just have to make sure libeu.h is
included)?

Cheers,

Mark


[Bug backends/31142] riscv pass_by_flattened_arg not implemented

2023-12-12 Thread palmer at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31142

Palmer Dabbelt  changed:

   What|Removed |Added

 CC||palmer at gcc dot gnu.org

--- Comment #2 from Palmer Dabbelt  ---
(In reply to Robbin Ehn from comment #1)
> I'm no expert in RV ABI, but from 18.2 RVG Calling Convention:
> 
> "Values are returned from functions in integer registers a0 and a1 and
> floating-point registers fa0 and fa1. Floating-point values are returned in
> floating-point registers only if they are primitives or members of a struct
> consisting of only one or two floating-point values. Other return values
> that fit into two pointer-words are returned in a0 and a1. Larger return
> values are passed entirely
> in memory; the caller allocates this memory region and passes a pointer to
> it as an implicit first parameter to the callee."
> 
> AFAICT they should be packed into a0+a1 seen as 8/16 byte field.
> 
> rv32 a0 would be quot and a1 would be rem
> rv64 a0 low 32-bit would be quot and a0 high 32-bit would be rem
> 
> This seems to be inline with what clang do, removes sign extension, shift
> and or the values in.
> 
> Did this help ?

FWIW, that looks right to me.  I haven't really poked around elfutils before,
though, so I'm not really sure how to implement it...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug backends/31142] riscv pass_by_flattened_arg not implemented

2023-12-12 Thread rehn at rivosinc dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31142

Robbin Ehn  changed:

   What|Removed |Added

 CC||rehn at rivosinc dot com

--- Comment #1 from Robbin Ehn  ---
I'm no expert in RV ABI, but from 18.2 RVG Calling Convention:

"Values are returned from functions in integer registers a0 and a1 and
floating-point registers fa0 and fa1. Floating-point values are returned in
floating-point registers only if they are primitives or members of a struct
consisting of only one or two floating-point values. Other return values that
fit into two pointer-words are returned in a0 and a1. Larger return values are
passed entirely
in memory; the caller allocates this memory region and passes a pointer to it
as an implicit first parameter to the callee."

AFAICT they should be packed into a0+a1 seen as 8/16 byte field.

rv32 a0 would be quot and a1 would be rem
rv64 a0 low 32-bit would be quot and a0 high 32-bit would be rem

This seems to be inline with what clang do, removes sign extension, shift and
or the values in.

Did this help ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[PATCH] tests: Don't redirect output to /dev/null in run-native-test.sh

2023-12-12 Thread Mark Wielaard
By redirecting all output to /dev/null in run-native-test.sh the
run-native-test.sh.log file will be empty on failures. This makes
it hard to figure out what went wrong.

* tests/run-native-test.sh: Remove /dev/null redirects.

Signed-off-by: Mark Wielaard 
---
 tests/run-native-test.sh | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/run-native-test.sh b/tests/run-native-test.sh
index 042a51c6..01a52e82 100755
--- a/tests/run-native-test.sh
+++ b/tests/run-native-test.sh
@@ -57,10 +57,10 @@ trap native_exit 0
 
 for cc in "$HOSTCC" "$HOST_CC" cc gcc "$CC"; do
   test "x$cc" != x || continue
-  $cc -o native -g native.c > /dev/null 2>&1 &&
+  $cc -o native -g native.c &&
   # Some shell versions don't do this right without the braces.
-  { ./native > /dev/null 2>&1 & native=$! ; } &&
-  sleep 1 && kill -0 $native 2> /dev/null &&
+  { ./native & native=$! ; } &&
+  sleep 1 && kill -0 $native &&
   break ||
   native=0
 done
@@ -68,14 +68,17 @@ done
 native_test()
 {
   # Try the build against itself, i.e. $config_host.
-  testrun "$@" -e $1 > /dev/null
+  echo "Try the build against itself: $@ -e $1"
+  testrun "$@" -e $1
 
   # Try the build against a presumed native process, running this sh.
   # For tests requiring debug information, this may not test anything.
-  testrun "$@" -p $$ > /dev/null
+  echo "Try the build against a presumed native process: $@ -p $$"
+  testrun "$@" -p $$
 
   # Try the build against the trivial native program we just built with -g.
-  test $native -eq 0 || testrun "$@" -p $native > /dev/null
+  echo "Try the build against the trivial native program: $@ -p $native"
+  test $native -eq 0 || testrun "$@" -p $native
 }
 
 native_test ${abs_builddir}/allregs
-- 
2.39.3