Skip to contentSkip to conversation

More sparc64-libc questions

DISCUSSION Sean Callanan 2 participants 4 messages Sep 30, 2001 – Oct 1, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines

Yes, it's known to work. Debian contains a gcc-3.0-sparc64 package along with a libc6-sparc64. The tricky part is that gcc is hardcoded to use /lib64/ld-linux.so.2. You should make a symlink from /lib64 to /usr/local/sparc64-linux/lib for your setup to work, and then add /lib64 to /etc/ld.so.conf and rerun ldconfig.

I did what you suggested, adding /lib64 to /etc/ld.so.conf, and rerunning ldconfig. But now the program segfaults.

% sparc64-linux-gcc -m64 -o hello hello.c
% ./hello
Segmentation fault

It doesn't dump core, either. (not that my 32-bit gdb would do much good)

By the way, how difficult would it be to use a file in /etc to determine the 64-bit library location (such as, maybe /etc/ld64.so.conf)?

Sincerely,

Sean Callanan

#1 lore raw
Quoted 10 lines · Sean Callanan
Quoted 6 lines

Yes, it's known to work. Debian contains a gcc-3.0-sparc64 package along with a libc6-sparc64. The tricky part is that gcc is hardcoded to use /lib64/ld-linux.so.2. You should make a symlink from /lib64 to /usr/local/sparc64-linux/lib for your setup to work, and then add /lib64 to /etc/ld.so.conf and rerun ldconfig.

I did what you suggested, adding /lib64 to /etc/ld.so.conf, and rerunning ldconfig. But now the program segfaults.

Quoted 8 lines

% sparc64-linux-gcc -m64 -o hello hello.c
% ./hello
Segmentation fault

It doesn't dump core, either. (not that my 32-bit gdb would do much good)

By the way, how difficult would it be to use a file in /etc to determine the 64-bit library location (such as, maybe /etc/ld64.so.conf)?

ldconfig is smart enought to handle 32-bit and 64-bit API's from the same ld.so.cache. That's not the problem. I beleive you can use a different ld.so.conf (maybe .64 extension? can't remember).

%cat hello.c
#include <stdio.h>

int main() { puts("Hello World!"); return 0; }
%gcc-3.0 -m64 hello.c
%./a.out
Hello World!
%file a.out
a.out: ELF 64-bit MSB executable, SPARC V9, version 1, dynamically linked (uses shared libs), not stripped %ldd a.out

        libc.so.6 => /lib/64/libc.so.6 (0xfffff80000120000)
        /lib/64/ld-linux.so.2 => /lib/64/ld-linux.so.2 (0xfffff80000000000)

%gcc-3.0 -v
...
gcc version 3.0.2 20010908 (Debian prerelease)

Note, I am also using a subreg-byte patch so that fpu works correctly. And yes, I setup Debian to use /lib/64 instead of /lib64, but that's just my preference, and required patching gcc and glibc (glibc 2.2.4).

If you are using the latest glibc, then the segv occurs in ld-linux.so.2 (try executing it directory, you'll see), and I haven't had time to diagnose it yet.

Ben

Signature · 4 lines
 .----------====-=-===-=====-----------===------------=-=-----.
/                   Ben Collins    --    Debian GNU/Linux                  \
`  [email protected]  --  [email protected]  --  [email protected]  '
 `---=====------====-------------=-=-----=-==-===-------=--=---'
#2 lore raw
In reply to Sean Callanan

Thanks Ben!

Indeed it _is_ ld-linux.so.2 which segfaults (I'm using a recent CVS.)

I'm seriously considering creating a pure 64-bit Sparc distribution of Linux. Everyting that can be would be native 64-bit (init, shells, X, etc...). Having the compiler working is a good thing, and I'll test glibc 2.2.4 and see whether that fixes my segfault problem.

I understand that this will provide only marginal performance benefits, and that Debian has a solid distro out with 64-bit support, but I'm doing this as much for the adventure as for the performance benefits. How is a distribution usually begun? I'd take the next release of GCC (3.0.2) and the latest release of libc.

This would probably be a personal project; I don't want to spend the kind of time required to keep packages up-to-date, etc. Would there any interest at all out there in a Sparc-bootable ISO with some tarballs that unpack to a bare- bones distro that could be used as a base to compile everything else? I'd probably use http://www.linuxfromscratch.org as a guide.

Sincerely,

Sean Callanan

#3 lore raw
In reply to Sean Callanan
Quoted 9 lines · On Sun, Sep 30, 2001 at 09:36:07PM -0400, [email protected] wrote:

Thanks Ben!

Indeed it _is_ ld-linux.so.2 which segfaults (I'm using a recent CVS.)

I'm seriously considering creating a pure 64-bit Sparc distribution of Linux. Everyting that can be would be native 64-bit (init, shells, X, etc...). Having the compiler working is a good thing, and I'll test glibc 2.2.4 and see whether that fixes my segfault problem.

Quoted 5 lines

I understand that this will provide only marginal performance benefits, and that Debian has a solid distro out with 64-bit support, but I'm doing this as much for the adventure as for the performance benefits. How is a distribution usually begun? I'd take the next release of GCC (3.0.2) and the latest release of libc.

Actually, it would create a performance hit for most things. From what I understand the addressing causes performance issues, and is only really needed for applications that need to address > 4gigs of memory (or other large accesses), like databases, etc.

I've gone through a lot with this for Debian. Final decision I made was to not have a native 64-bit distribution, and this was based on input from Dave and Jakub. That's why I've only provided a 64-bit compiler and base libraries; so people can compile what they need as 64-bit.

Read through some of the comments in gcc/config/sparc/ about the memory addressing models used. Even the kernel is slow when compiled with full 64-bit addressing, which is why it is compiled with the medlow model.

Ben

Signature · 4 lines
 .----------====-=-===-=====-----------===------------=-=-----.
/                   Ben Collins    --    Debian GNU/Linux                  \
`  [email protected]  --  [email protected]  --  [email protected]  '
 `---=====------====-------------=-=-----=-==-===-------=--=---'