Open GoogleCodeExporter opened 9 years ago
The fix is to stop using the frame pointer in the .s code that cares.
I thought I'd done that, but perhaps the change wasn't submitted.
I'll check.
Original comment by Charles....@gmail.com
on 22 Sep 2011 at 8:04
The no-omit-frame-pointer should not be required. The assembly code hasn't
required it for months. The only direct usage was in getcallerpc, which can be
done without it.
Other assembly code saves and sets it, but that will work either way.
Thus, there must be something else wrong, if your getcallerpc is up-to-date,
and we need to track it down.
Original comment by Charles....@gmail.com
on 22 Sep 2011 at 11:43
Thanks for looking into this. I will recompile without that flag again and will
let you know what gdb says about the segfault and all the details.
By the way, I also had to #define __USE_GNU in emu/Linux/os.c to get the right
symbols from sched.h, but I doubt this is related.
Both problems could be that something is wrong with archlinux, but if that's
the case I'd like to report the bug there anyway.
Original comment by yiyu....@gmail.com
on 22 Sep 2011 at 11:55
in my sched.h __USE_GNU is needed only for affinity values that os.c doesn't
use.
which ones are missing on archlinux?
Original comment by Charles....@gmail.com
on 22 Sep 2011 at 2:04
This is the error when not using __USE_GNU:
cc -c -m32 -DROOT="/home/yiyus/i" -DEMU -I. -I../port
-I/home/yiyus/i/Linux/386/include -I/home/yiyus/i/include
-I/home/yiyus/i/libinterp -g -O -Wuninitialized -Wunused -Wreturn-type
-Wimplicit -I/home/yiyus/i/Linux/386/include -I/home/yiyus/i/include
-I/usr/X11R6/include -DLINUX_386 os.c
os.c: In function ‘kproc’:
os.c:172:2: warning: implicit declaration of function ‘clone’
[-Wimplicit-function-declaration]
os.c:172:36: error: ‘CLONE_VM’ undeclared (first use in this function)
os.c:172:36: note: each undeclared identifier is reported only once for each
function it appears in
os.c:172:45: error: ‘CLONE_FS’ undeclared (first use in this function)
os.c:172:54: error: ‘CLONE_FILES’ undeclared (first use in this function)
After defining __USE_GNU compilation finishes without errors, but it segfaults:
Core was generated by `Linux/386/bin/emu'.
Program terminated with signal 11, Segmentation fault.
#0 0x08131354 in getcallerpc ()
Adding -fno-omit-frame-pointer to CFLAGS everything works fine.
; hg identify
108a78096969+ tip
; uname -a
Linux zugzwee 3.0-ARCH #1 SMP PREEMPT Tue Aug 30 07:32:23 UTC 2011 i686
Intel(R) Atom(TM) CPU N270 @ 1.60GHz GenuineIntel GNU/Linux
Original comment by yiyu....@gmail.com
on 22 Sep 2011 at 6:29
> ; hg identify
> 108a78096969+ tip
Ops. This is embarrassing. I just updated to the last version and the
getcallerpc problem is gone. I'm sorry, I really thought I had the last version.
But I still need to define __USE_GNU.
Original comment by yiyu....@gmail.com
on 22 Sep 2011 at 6:43
that's ok. i don't think it's sched.h (unless they've moved clone) but possibly
some other include file now requires __USE_GNU before it will declare clone.
it's a bit stupid, because clone isn't really gnu but Linux, so one might think
it would be __USE_LINUX.
anyway, if it works now, that's fine. the correct fix for the clone problem is
to switch to pthreads. it sounds as though i should start to make that the
default sooner rather than later.
pthreads has spread its tentacles into the library so thoroughly it's not worth
the effort trying to avoid it.
Original comment by Charles....@gmail.com
on 22 Sep 2011 at 7:42
Today I've got an error while building Inferno on Arch Linux i686
cc -c -m32 -DROOT="/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os" -DEMU
-I. -I../port
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/Linux/386/include
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/include
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/libinterp -g -O
-Wuninitialized -Wunused -Wreturn-type -Wimplicit
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/Linux/386/include
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/include
-I/usr/X11R6/include -DLINUX_386 os.c
os.c: In function ‘kproc’:
os.c:172:2: warning: implicit declaration of function ‘clone’
[-Wimplicit-function-declaration]
os.c:172:36: error: ‘CLONE_VM’ undeclared (first use in this function)
os.c:172:36: note: each undeclared identifier is reported only once for each
function it appears in
os.c:172:45: error: ‘CLONE_FS’ undeclared (first use in this function)
os.c:172:54: error: ‘CLONE_FILES’ undeclared (first use in this function)
% hg identify
d1acc2a527af+ tip
% uname -a
Linux localhost 3.1.1-1-ARCH #1 SMP PREEMPT Fri Nov 11 22:05:37 UTC 2011 i686
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz GenuineIntel GNU/Linux
Quickly fixed by including required header
diff -r d1acc2a527af emu/Linux/os.c
--- a/emu/Linux/os.c Mon Oct 03 19:15:19 2011 +0100
+++ b/emu/Linux/os.c Thu Nov 17 16:59:48 2011 +0200
@@ -18,6 +18,7 @@
#include <semaphore.h>
#include <raise.h>
+#include <linux/sched.h>
/* glibc 2.3.3-NTPL messes up getpid() by trying to cache the result, so we'll do it ourselves */
#include <sys/syscall.h>
Checked that it works and opened issue tracker to report.
I'm pretty surprised to find it in "requires -fno-omit-frame-pointer" thread.
Because it works for me without "-fno-omit-frame-pointer".
I've tried to reproduce segfault. But defining -D__USE_GNU doesn't help in
building:
cc -c -m32 -DROOT="/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os" -DEMU
-I. -I../port
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/Linux/386/include
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/include
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/libinterp -g -O
-Wuninitialized -Wunused -Wreturn-type -Wimplicit
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/Linux/386/include
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/include
-I/usr/X11R6/include -DLINUX_386 -D__USE_GNU os.c
os.c: In function ‘kproc’:
os.c:172:2: warning: implicit declaration of function ‘clone’
[-Wimplicit-function-declaration]
os.c:172:36: error: ‘CLONE_VM’ undeclared (first use in this function)
os.c:172:36: note: each undeclared identifier is reported only once for each
function it appears in
os.c:172:45: error: ‘CLONE_FS’ undeclared (first use in this function)
os.c:172:54: error: ‘CLONE_FILES’ undeclared (first use in this function)
With -D_GNU_SOURCE build crashes even earlier:
cc -c -m32 -g -O -Wuninitialized -Wunused -Wreturn-type -Wimplicit
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/Linux/386/include
-I/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/include
-I/usr/X11R6/include -DLINUX_386 -D_GNU_SOURCE blas.c
In file included from blas.c:2:0:
/home/sergeykish/abs/inferno-os/pkg/opt/inferno-os/include/mathi.h:59:12:
error: expected identifier or ‘(’ before ‘sizeof’
I'd like to update AUR so other wouldn't trap same issue. With my fix for now.
Please call me if you have better idea.
Original comment by Sergey.K...@gmail.com
on 17 Nov 2011 at 3:57
The current source doesn't need -fno-omit-frame-pointer.
As to clone, the best thing to do *seems* to be to switch permanently to the
pthreads version. There are just too many problems with clone and interactions
with the gnu C library (eg, the implementation of errno assumes pthreads unless
it's simply shared, which also doesn't work).
Original comment by Charles....@gmail.com
on 17 Nov 2011 at 10:59
Not quite true. It does NOT require -fno-omit-frame-pointer and <linux/sched.h>
on Fedora 17. But it does require BOTH on Fedora 15. So, it really depend on
gcc and glibc version.
Original comment by vvs...@gmail.com
on 30 Dec 2012 at 3:06
Is that using the pthreads version or the old clone-based os.c?
Original comment by Charles....@gmail.com
on 30 Dec 2012 at 3:56
I was not even aware that there exists the pthreads version. I'm using the
mercurial default branch, which is what one will get after downloading tarball
from vitanuova.com and doing a pull.
Original comment by vvs...@gmail.com
on 30 Dec 2012 at 7:55
Seems that I forgot to do an update after pull! So much time was lost because
of a simple overlook (pulling hair). At least it explains why it worked on the
other version. Thanks for pointing it out and sorry for the noise.
Original comment by vvs...@gmail.com
on 30 Dec 2012 at 8:56
mk install output from Ubuntu 12.04, same error with and without
-fno-omit-frame-pointer:
(cd emu; mk install)
(cd Linux; mk install)
cc -c -m32 asm-386.S
cc -c -m32 -DROOT="/inferno" -DEMU -I. -I../port -I/inferno/Linux/386/include
-I/inferno/include -I/inferno/libinterp -g -O -I/inferno/Linux/386/include
-I/inferno/include -I/usr/X11R6/include -DLINUX_386 -fno-omit-frame-pointer os.c
os.c: En la función ‘kproc’:
os.c:147:39: error: ‘CLONE_VM’ no se declaró aquí (primer uso en esta
función)
os.c:147:39: nota: cada identificador sin declarar se reporta sólo una vez
para cada función en el que aparece
os.c:147:48: error: ‘CLONE_FS’ no se declaró aquí (primer uso en esta
función)
os.c:147:57: error: ‘CLONE_FILES’ no se declaró aquí (primer uso en esta
función)
mk: cc -c -m32 ... : exit status=exit(1)
mk: echo "(cd $SYSTARG; ... : exit status=exit(1)
mk: for j in ... : exit status=exit(1)
Original comment by chuli...@gmail.com
on 8 Feb 2013 at 12:38
anything that produces the diagnostics about CLONE_VM, CLONE_FS etc being
undefined must be using the old version of os.c (now called os-clone.c) that
predates the use of pthreads. the current version uses pthreads, and if you do
a pull -uv you should get the right mkfile and os.c
Original comment by Charles....@gmail.com
on 8 Feb 2013 at 2:31
Original issue reported on code.google.com by
yiyu....@gmail.com
on 21 Sep 2011 at 11:22