All of lore.kernel.org
 help / color / mirror / Atom feed
From: maximilian attems <max@stro.at>
To: sparclinux@vger.kernel.org
Subject: klibc sparc trouble with gcc > 4.0
Date: Mon, 05 Nov 2007 13:55:45 +0000	[thread overview]
Message-ID: <20071105135545.GA11201@stro.at> (raw)

tried below fix, that is a partial revert of klibc
6fbd8fafdcc793135988733996d72b0298afe934
see git://git.kernel.org/pub/scm/libs/klibc/klibc.git
with belows fix klibc compiles fine on sparc with newer gcc,
but segfaults:


titan:~# strace -vfF /usr/lib/klibc/bin/fstype
execve("/usr/lib/klibc/bin/fstype", ["/usr/lib/klibc/bin/fstype"],
["SHELL=/bin/bash", "TERM=xterm", "SSH_CLIENT=[myip] 39403"...,
"SSH_TTY=/dev/pts/0", "USER=root",
"LS_COLORS=no\0:fi\0:di\x01;34:l"...,
"PATH=/usr/local/sbin:/usr/local/"..., "MAIL=/var/mail/root",
"PWD=/root", "LANG=en_US.UTF-8", "PS1=\\h:\\w\\$ ", "HOME=/root",
"SHLVL=2", "LS_OPTIONS=--color=auto", "LOGNAME=root",
"SSH_CONNECTION=[myip] 3"..., "_=/usr/bin/strace", "OLDPWD=/"]) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 3636 detached

thanks for looking at it.

-- 
maks



use our own clzdi on sparc instead the one of libgcc

Signed-off-by: maximilian attems <max@stro.at>

diff --git a/usr/klibc/arch/sparc64/Kbuild b/usr/klibc/arch/sparc64/Kbuild
index 2854f69..f2450a2 100644
--- a/usr/klibc/arch/sparc64/Kbuild
+++ b/usr/klibc/arch/sparc64/Kbuild
@@ -2,7 +2,7 @@
 # klibc files for sparc64
 #
 
-klib-y := pipe.o setjmp.o syscall.o sysfork.o
+klib-y := pipe.o setjmp.o syscall.o sysfork.o ../../libgcc/__clzdi2.o
 
 always  := crt0.o
 targets := crt0.o
diff --git a/usr/klibc/libgcc/__clzdi2.c b/usr/klibc/libgcc/__clzdi2.c
new file mode 100644
index 0000000..13e636c
--- /dev/null
+++ b/usr/klibc/libgcc/__clzdi2.c
@@ -0,0 +1,23 @@
+/*
+ * __clzdi2 - Returns the leading number of 0 bits in the argument
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+
+uint64_t __clzdi2(uint64_t v)
+{
+	uint32_t vhi = (uint32_t) (v >> 32);
+	uint32_t vx;
+	int dp;
+
+	if (vhi) {
+		vx = vhi;
+		dp = 0;
+	} else {
+		vx = (uint32_t) v;
+		dp = 32;
+	}
+
+	return dp + __builtin_clz(vx);
+}

             reply	other threads:[~2007-11-05 13:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 13:55 maximilian attems [this message]
2007-11-06  2:49 ` klibc sparc trouble with gcc > 4.0 Oleg Verych
2007-11-06  8:30 ` [klibc] " H. Peter Anvin
2007-11-09 17:59 ` Bernd Zeimetz

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=20071105135545.GA11201@stro.at \
    --to=max@stro.at \
    --cc=sparclinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.