Skip to content

9src/cc: fix objs list to use objext, not hardcoded "o"#134

Merged
staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd
May 21, 2026
Merged

9src/cc: fix objs list to use objext, not hardcoded "o"#134
staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

The object written by the compiler used objext (.6 for amd64 pcc) but the objs list still held .o, so 6l was handed a nonexistent filename.

https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs

The object written by the compiler used objext (.6 for amd64 pcc) but
the objs list still held .o, so 6l was handed a nonexistent filename.

https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
@staalmannen staalmannen merged commit 442df4a into main May 21, 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 updates the C compiler wrapper to use the architecture-specific objext variable instead of a hardcoded ".o" extension when generating object file names from source files. A review comment points out a potential inconsistency between the use of objext and the existing ot->o check used to identify object files in the command-line arguments, suggesting that these should be unified to avoid logic errors.

Comment thread sys/src/ape/9src/cc.c
if(strcmp(suf, "c") == 0) {
append(&srcs, s);
append(&objs, changeext(s, "o"));
append(&objs, changeext(s, objext));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The use of objext here is inconsistent with the check on line 173, which uses ot->o to recognize existing object files. If objext and ot->o are intended to represent the same architecture-specific extension, it would be better to use a single variable consistently. If they can differ, this change might cause files with the objext extension passed on the command line to be ignored by the recognition logic in the else if block, while still allowing .o files which may no longer be appropriate for the target architecture.

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