Skip to content

Claude/upgrade ape c library mm z gd#139

Merged
staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd
May 22, 2026
Merged

Claude/upgrade ape c library mm z gd#139
staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

No description provided.

claude added 2 commits May 22, 2026 03:41
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
@staalmannen staalmannen merged commit 860bf64 into main May 22, 2026
1 check passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sys/src/cmd/ld/dwarf.c
Comment on lines 999 to 1001
writeinfo();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

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