Claude/upgrade ape c library mm z gd#139
Conversation
dwarf.c was calling elfshname() (from elf.c), but only 6l linked elf.$O — all other arch linkers got an undefined symbol error. Fix: move dwarfaddelfheaders() into elf.c where it belongs (it creates ELF section headers, not DWARF output). Export the 8 DWARF offset/size statics as non-static vlong dwarfXxx variables, declared in dwarf.h. elf.c now includes dwarf.h to access them. dwarf.c no longer includes elf.h and has no ELF dependencies. Add elf.$O to 1l and 2l mkfiles (remaining arches to follow). https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
All arch linkers now link elf.$O, which contains dwarfaddelfheaders() and the ELF infrastructure. This resolves the undefined symbol error that occurred because dwarf.c no longer carries ELF dependencies but all linkers include dwarf.$O. https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
There was a problem hiding this comment.
Code Review
This pull request refactors the DWARF and ELF logic by moving ELF-specific section header creation from dwarf.c to elf.c and exposing DWARF section offsets and sizes as global variables. While many linker mkfiles were updated to include elf.c, feedback highlights that several architectures, including 0l, 4l, and 6l, were omitted, which will likely lead to link errors.
| writeinfo(); | ||
| } | ||
|
|
There was a problem hiding this comment.
The removal of dwarfaddelfheaders from the shared dwarf.c and its relocation to elf.c (in sys/src/cmd/ld/elf.c) requires that all linkers using dwarf.c also link elf.c. While this PR updates several linkers (1l, 2l, 5l, 7l, 8l, 9l, kl, ql, vl), it appears to miss others that typically reside in the same toolchain, such as 0l (sparc), 4l (mips), and most importantly 6l (amd64). This will likely cause link errors for those architectures if they call dwarfaddelfheaders during the linking process.
No description provided.