Skip to content

cbe bug fixes and improvements#13715

Merged
andrewrk merged 16 commits intoziglang:masterfrom
Vexu:cbe
Dec 1, 2022
Merged

cbe bug fixes and improvements#13715
andrewrk merged 16 commits intoziglang:masterfrom
Vexu:cbe

Conversation

@Vexu
Copy link
Member

@Vexu Vexu commented Nov 30, 2022

No description provided.

@Vexu
Copy link
Member Author

Vexu commented Nov 30, 2022

-Donly-c now produces ~150k fewer temporary locals (well lines but they should be roughly equivalent) but still segfaults when run (seemingly due to stack overflow).

@andrewrk
Copy link
Member

Nice work!

I can reproduce the segfault too, with GCC 11.3.0:

$ stage4/bin/zig build -p stage4-c -Donly-c -Dno-lib -Drelease
$ stage4/bin/zig build-obj ../lib/compiler_rt.zig -ofmt=c -OReleaseFast
$ cc -o zig1 stage4-c/bin/zig.c -I../lib compiler_rt.c
$ gdb ./zig1 -ex 'run build-exe ../test/standalone/hello_world/hello.zig -ofmt=c -lc'
Program received signal SIGSEGV, Segmentation fault.
0x000000000075bd35 in zig_system_NativeTargetInfo_glibcVerFromSoFile ()
=> 0x000000000075bd35 <+20>:	mov    DWORD PTR [rbp-0x154a4],edi

However, when I pass -Wl,-z,stack-size=0x10000000, the segfault is eliminated:

$ cc -o zig1 stage4-c/bin/zig.c -I../lib compiler_rt.c -Wl,-z,stack-size=0x10000000
$ ./zig1 build-exe ../test/standalone/hello_world/hello.zig -ofmt=c -lc
$ cc -o hello hello.c -I../lib
$ ./hello
Hello, World!

@andrewrk andrewrk merged commit 4071b22 into ziglang:master Dec 1, 2022
@Vexu Vexu deleted the cbe branch December 1, 2022 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants