fix(llvm): Phase 131-5 完了 - TAG-LINK 修正(ExternCall symbol mapping)
Phase 131-5: ExternCall Symbol Mapping 修正 問題: - Case B (loop_min_while.hako) が TAG-LINK で失敗 - エラー: undefined reference to `nyash_console_log` 根本原因: - Python harness が dot → underscore 変換を実行 (`nyash.console.log` → `nyash_console_log`) - NyKernel は `nyash.console.log` をエクスポート (ELF format では dot が有効) 修正: - src/llvm_py/instructions/externcall.py から変換ロジックを削除(-4 lines) - Symbol 名は NyKernel exports と完全一致 変更ファイル: - src/llvm_py/instructions/externcall.py: - 不要な dot→underscore 変換削除 - ELF symbol 仕様のコメント追加 テスト結果: - Case B LINK: ❌→✅ (修正成功) - Case B RUN: ❌ (新 TAG-RUN: infinite loop) - Case A/B2: ✅ (退行なし) 箱化モジュール化: - ✅ SSOT 達成: NyKernel exports を信頼 - ✅ クリーンな修正: 不要コード削除のみ - 推奨: NyKernel symbol naming convention ドキュメント化 Next: Phase 131-6 (TAG-RUN 修正 - infinite loop) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -48,15 +48,10 @@ def lower_externcall(
|
||||
pass
|
||||
# Normalize extern target names through shared policy
|
||||
llvm_name = normalize_extern_name(func_name)
|
||||
# For C linkage, map dot-qualified console names to underscore symbols.
|
||||
# This keeps the logical name (nyash.console.log) stable at the MIR level
|
||||
# while emitting a C-friendly symbol (nyash_console_log) for linkage.
|
||||
# Use the normalized name directly as C symbol name.
|
||||
# NyKernel exports symbols with dots (e.g., "nyash.console.log"), which is
|
||||
# valid in ELF symbol tables. Do NOT convert dots to underscores.
|
||||
c_symbol_name = llvm_name
|
||||
try:
|
||||
if llvm_name.startswith("nyash.console."):
|
||||
c_symbol_name = llvm_name.replace(".", "_")
|
||||
except Exception:
|
||||
c_symbol_name = llvm_name
|
||||
|
||||
i8 = ir.IntType(8)
|
||||
i64 = ir.IntType(64)
|
||||
|
||||
Reference in New Issue
Block a user