Closed sudhackar closed 1 year ago
Hello. Thanks for opening an issue on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.
Note: If this issue has been pre-approved, please link back to this issue on the forum thread and a maintainer or staff member will reopen it.
https://github.com/exercism/x86-64-assembly/blob/5720b20beeed5518d8637d66538cb096c3bed280/exercises/practice/resistor-color/.meta/example.asm#L15
For the
color_array
array you'll need todo_relocs
- since the members are actually references to other places in the binary.See musl ld source as the test runner is actually alpine
You'll get a crash when loading the test binary on alpine but maybe not on your machine. The crash looks like
where r12 is the address for
color_array
and rcx is the relocated address of the first member of this array
Ideally the musl libc should change protections for this section(.rodata) or check if its writable - but it doesn't and hence crashes while writing to a readable section of memory
TLDR : Any variable that is actually a reference to another for our submissions should be in
.data
instead of.rodata
due to a weird behaviour of the alpine linux's musl loader - maybe should be reported upstream?To debug the crash I built the test-runner docker with this diff
Crash with more context
It is to note that the glibc's ld implementation does actually change(mprotect) the permissions to writable and then relocates here