[cfarm-users] gcc230: Unable to use GDB on 64-bit mips executable

Denis Ovsienko denis at ovsienko.info
Tue Jun 17 13:28:42 CEST 2025


On Tue, 17 Jun 2025 10:16:43 +0200
Pierre Muller via cfarm-users <cfarm-users at lists.tetaneutral.net> wrote:

> Would it be possible to install a 64-bit version of the debugger if
> this is available as a package, or otherwise to install 64-bit
> versions of gmp and mpfr (and possibly several other needed packages)?

Hello Pierre.

I do not know whether it would be possible to mix 32-bit and 64-bit
userspace on MIPS.  Even though the kernel is 64-bit, Debian had all
userspace packages built for 32-bit, which is exactly the same as how
NetBSD originally supported 64-bit MIPS.  I do not know whether this is
a coincidence, but as far as I gathered from NetBSD developers'
comments some years ago, their evbmips-mips64eb port reused the ABI
developed by SGI for IRIX when SGI MIPS computers started becoming
64-bit, but software remained 32-bit.  That "temporary" ABI worked well
enough to serve as a model for other implementations, and a fully
64-bit IRIX ABI didn't manage to settle before SGI stopped making MIPS
computers.  That's my understanding of it, anyway.

However, it seems OpenBSD didn't use the IRIX ABI as a model for their
Octeon port, so on cfarm231 you can use 64-bit userspace and 64-bit
kernel on the same CPU without any fancy C compiler flags, in case it
does the job:


cfarm231$ file simple-c-hello simple-c-hello: ELF 64-bit MSB shared
object, MIPS, MIPS-III version 1

cfarm231$ gdb ./simple-c-hello
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "mips64-unknown-openbsd7.6"...
(gdb) start
Breakpoint 1 at 0x112c8: file simple-c-hello.c, line 6.
Starting program: /home/denis/simple-c-hello 
Breakpoint 1 at 0x118a0812c8: file simple-c-hello.c, line 6.
main () at simple-c-hello.c:6
6	   fprintf(stdout,"hello\n");
Current language:  auto; currently minimal
(gdb) 


Also NetBSD in 2021 started work on evbmips-mips64eb port, which is
fully 64-bit too.  I do not know how it relates with other 64-bit
userspace MIPS ABIs, but I known that after a few years the NetBSD
implementation has stabilised and looks useful.  I maintain another host
that runs this port on the same hardware:


netbsd-mips64$ file simple-c-hello
simple-c-hello: ELF 64-bit MSB executable, MIPS, MIPS-III version 1
(SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for
NetBSD 10.1, with debug_info, not stripped

netbsd-mips64$ gdb ./simple-c-hello
GNU gdb (GDB) 11.0.50.20200914-git
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html> This is free software: you are free
to change and redistribute it. There is NO WARRANTY, to the extent
permitted by law. Type "show copying" and "show warranty" for details.
This GDB was configured as "mipsn64eb--netbsd".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./simple-c-hello...
(gdb) start
Temporary breakpoint 1 at 0x120000a90: file simple-c-hello.c, line 6.
Starting program: /home/denis/simple-c-hello 

Temporary breakpoint 1, main () at simple-c-hello.c:6
6	   fprintf(stdout,"hello\n");
(gdb)


The NetBSD host is not in the farm, let me know if you need an account
there.

-- 
    Denis Ovsienko


More information about the cfarm-users mailing list