Skip to content

fix(compiler): avoid native object filename collisions - #91

Open
yavon007 wants to merge 1 commit into
swoole:masterfrom
yavon007:codex/fix-native-object-name-collisions
Open

fix(compiler): avoid native object filename collisions#91
yavon007 wants to merge 1 commit into
swoole:masterfrom
yavon007:codex/fix-native-object-name-collisions

Conversation

@yavon007

Copy link
Copy Markdown

Native sources with the same basename, such as foo.c and foo.cpp, compiled to the same foo.o. The second compilation overwrote the first object, and linking the repeated object path failed with duplicate symbol definitions even in a sequential build.

Preserve source extensions in native object filenames (foo.c.o, foo.cpp.o, foo.cc.o). Keep object names for generated TypePHP .cc files inside the build directory and PHPX misc cache files unchanged. Add a regression for distinct native object paths and update the cache-test fixture to use the compiler's object-path mapping.

Validation on Linux ARM64 with PHP 8.5.10:

  • New object-name regression fails before the fix and passes afterward.
  • PreprocessorTest and the misc-cache tests in CompilerBaseApiTest: 37 tests / 98 assertions passed. PHP 8.5 reports existing ReflectionProperty::setAccessible() / ReflectionMethod::setAccessible() deprecations in the test helpers.
  • A real CLI project containing foo.c and foo.cpp builds, links, and runs successfully; nm confirms both native symbols are retained in separate objects.
  • git diff --check passed.

Sign up for freeto 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.

1 participant

@yavon007