* Sigsev when trying to execute 32bit software
@ 2023-05-20 18:26 alexandre schenberg
2023-05-21 8:36 ` Xi Ruoyao
0 siblings, 1 reply; 2+ messages in thread
From: alexandre schenberg @ 2023-05-20 18:26 UTC (permalink / raw)
To: gcc-help
I am having problem when executing majority of 32bit software on my Linux.
This problem happens when running any dynamically linked c++ software and also dynamic linked c programs that uses any libs outside standard c libs. Only statically linked programs on both languages and the simplest c programs are able to execute.
For instance, this is what happens when executing a simple 32bit, dynamically linked c++ hello word on gdb:
"Program received signal SIGSEGV, Segmentation fault.
0x000044ae in ?? ()"
I compiled the program with:
"g++ -m32 -o test-32bit test-32bit.cpp -Wl,--dynamic-link=/usr/lib32/ld-2.17.so"
and executed it with:
"LD_LIBRARY_PATH=/media/34GB/Arquivos-de-Programas-Linux/Gcc-4.9.4/lib32/ gdb ./test-32bit"
The same output is obtained when running 32bit programs that I built from the source, such as Dosbox and Snes9x.
The likely reason for this is that I decided to add 32bit support on my system. From the scratch.
First I built a 32bit glibc and installed it outside system tree of standard directories. Then I created a /usr/lib32 and put symbolic links there to everything in glibc's libdir. I also compiled a new gcc with multilib support (don't remember if that preceded glibc's install or not) and then created a symbolic link to libstdc++.so.6 also on /usr/lib/32.
Then I created sym links in /usr/local/bin to gcc and g++. Finally, I executed ldconfig.
A few other info that might prove useful:
"info shared" output:
Program received signal SIGSEGV, Segmentation fault.
0x000044ae in ?? ()
(gdb) info shared
From To Syms Read Shared Object Library
0xf7fdb7e0 0xf7ff342c Yes /usr/lib32/ld-2.17.so
0xf7f24d70 0xf7f98aa8 No /media/34GB/Arquivos-de-Programas-Linux/Gcc-4.9.4/lib32/libstdc++.so.6
0xf7e9c550 0xf7ec7c88 No /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/libm.so.6
0xf7e7f000 0xf7e92ca8 No /media/34GB/Arquivos-de-Programas-Linux/Gcc-4.9.4/lib32/libgcc_s.so.1
0xf7cd2280 0xf7dffa0c No /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/libc.so.6
If I execute a 64bit version of this c++ hello world I receive:
0x00007ffff7ddca80 0x00007ffff7df57c0 Yes /lib64/ld-linux-x86-64.so.2
or a c hello world :
"0xf7fdb7e0 0xf7ff342c Yes /usr/lib32/ld-2.17.s"
info proc mappings output:
"process 11686
Mapped address spaces:
Start Addr End Addr Size Offset objfile
0x8048000 0x8049000 0x1000 0x0 /media/34GB/demos/test-32bit
0x8049000 0x804a000 0x1000 0x0 /media/34GB/demos/test-32bit
0xf7cb9000 0xf7cbb000 0x2000 0x0
0xf7cbb000 0xf7e76000 0x1bb000 0x0 /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/libc-2.17.so
0xf7e76000 0xf7e79000 0x3000 0x1ba000 /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/libc-2.17.so
0xf7e79000 0xf7e7b000 0x2000 0x1bd000 /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/libc-2.17.so
0xf7e7b000 0xf7e7d000 0x2000 0x0
0xf7e7d000 0xf7e97000 0x1a000 0x0 /media/34GB/Arquivos-de-Programas-Linux/Gcc-4.9.4/lib32/libgcc_s.so.1
0xf7e97000 0xf7e98000 0x1000 0x19000 /media/34GB/Arquivos-de-Programas-Linux/Gcc-4.9.4/lib32/libgcc_s.so.1
0xf7e98000 0xf7edd000 0x45000 0x0 /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/libm-2.17.so
0xf7edd000 0xf7edf000 0x2000 0x45000 /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/libm-2.17.so
0xf7edf000 0xf7fcc000 0xed000 0x0 /media/34GB/Arquivos-de-Programas-Linux/Gcc-4.9.4/lib32/libstdc++.so.6.0.20
0xf7fcc000 0xf7fd1000 0x5000 0xed000 /media/34GB/Arquivos-de-Programas-Linux/Gcc-4.9.4/lib32/libstdc++.so.6.0.20
0xf7fd1000 0xf7fda000 0x9000 0x0
0xf7fda000 0xf7fdb000 0x1000 0x0 [vdso]
0xf7fdb000 0xf7ffc000 0x21000 0x0 /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/ld-2.17.so
0xf7ffc000 0xf7ffe000 0x2000 0x20000 /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/ld-2.17.so
0xfffe9000 0xffffe000 0x15000 0x0 [stack]"
How I (probably compiled) glibc:
"CC="gcc -m32 -march=core2 -mtune=core2 -O2" ../configure --prefix=/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/ --build=x86_64-linux-gnu --host=i686-gnu-linux --enable-kernel-2.6.32 --enable-profile"
How I (probably) compiled the 64bit glibc that my system is currently using:
CC="gcc -march=native -mtune=native -O2" ../configure --prefix=/usr/ --enable-kernel=2.6.32
So, what I need right now, are suggestions of ways to debug this test example (or the other 32bit software) as to figure out the cause and then try to fix it.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Sigsev when trying to execute 32bit software
2023-05-20 18:26 Sigsev when trying to execute 32bit software alexandre schenberg
@ 2023-05-21 8:36 ` Xi Ruoyao
0 siblings, 0 replies; 2+ messages in thread
From: Xi Ruoyao @ 2023-05-21 8:36 UTC (permalink / raw)
To: alexandre schenberg; +Cc: gcc-help
On Sat, 2023-05-20 at 15:26 -0300, alexandre schenberg via Gcc-help
wrote:
> "CC="gcc -m32 -march=core2 -mtune=core2 -O2" ../configure --
> prefix=/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/ --
> build=x86_64-linux-gnu --host=i686-gnu-linux --enable-kernel-2.6.32 --
> enable-profile"
According to Glibc wiki [1] building Glibc with any prefix other than
/usr is not supported.
[1]: https://sourceware.org/glibc/wiki/Testing/Builds
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-21 8:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-20 18:26 Sigsev when trying to execute 32bit software alexandre schenberg
2023-05-21 8:36 ` Xi Ruoyao
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).