Open aarkegz opened 1 month ago
When compiling with nightly-2024-08-12
on my machine, it fails with test
profile but succeeds with dev
profile.
Some critical differences have been revealed by readelf
:
# in `test`
[32] .percpu NOBITS 0000000000000000 000d1000
0000000000000100 0000000000000000 WA 0 0 8
--------------
# in `dev`
[31] .percpu PROGBITS 000000000005e260 0005b260
0000000000000028 0000000000000000 WA 0 0 8
It was a mistake.
After switching target to x86_64-unknown-linux-musl
, the bug persists but it now won't crash before _start
. Debugging and disassembling reveals that it may be a bug that ld -no-pie
will uses a dynamic version of crt*.o
, and I believe the situation is similar in x86_64-unknown-linux-gnu
. Now it's time to consider how to build a PURE static executable, with our custom link script included.
A
SIGSEGV
occurred beforemain
:nightly-2024-09-13
, but not onnightly-2024-08-12
..percpu
sections doesn't work.