gpt4 book ai didi

gcc - 琼斯福斯段错误

转载 作者:行者123 更新时间:2023-12-04 14:24:33 25 4
gpt4 key购买 nike

我在的系统:

/tmp/jonesforth $ cat /etc/issue
Ubuntu 16.04.1 LTS \n \l

这是一个 32 位系统。

从附件库克隆:
git clone git://git.annexia.org/git/jonesforth.git

构建正常:
cd jonesforth

/tmp/jonesforth $ make
gcc -m32 -nostdlib -static -Wl,-Ttext,0 -o jonesforth jonesforth.S

但是测试没有通过:
/tmp/jonesforth $ make test
test_stack_trace.f ... --- .test_stack_trace.test 2016-09-17 17:44:59.488492834 -0500
+++ test_stack_trace.f.out 2016-09-17 17:33:11.171189490 -0500
@@ -0,0 +1,6 @@
+TEST4+0 TEST3+0 TEST2+0 TEST+0
+3
+TEST4+0 TEST3+32 TEST2+0 TEST+0
+TEST4+0 TEST3+0 TEST2+4 TEST+0
+3
+TEST4+0 TEST3+32 TEST2+4 TEST+0
Makefile:34: recipe for target 'test_stack_trace.test' failed
make: *** [test_stack_trace.test] Error 1

启动 jonesforth 会导致段错误:
/tmp/jonesforth $ cat jonesforth.f - | ./jonesforth 
Segmentation fault

最佳答案

删除 -Wl,-Ttext,0来自 jonesforth 的 Makefile 条目:

jonesforth: jonesforth.S
gcc -m32 -nostdlib -static $(BUILD_ID_NONE) -o $@ $<

似乎有帮助。构建成功:
/tmp/jonesforth $ touch jonesforth.S 
/tmp/jonesforth $ make
gcc -m32 -nostdlib -static -o jonesforth jonesforth.S

测试通过:
/tmp/jonesforth $ make test
test_stack_trace.f ... ok
test_stack.f ... ok
test_comparison.f ... ok
test_assembler.f ... ok
test_exception.f ... ok
test_read_file.f ... ok
test_number.f ... ok

它启动:
/tmp/jonesforth $ cat jonesforth.f - | ./jonesforth 
JONESFORTH VERSION 47
14499 CELLS REMAINING
OK

关于gcc - 琼斯福斯段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39552450/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com