Skip to content

DWARF: preserve crypto/x509 OID.Equal semantics #2122

Description

@cpunion

Summary

Enabling LLGo's current DWARF path changes executable behavior in crypto/x509: TestOID reports that two equal OIDs compare unequal. Omitting DWARF makes the same test pass.

This is a correctness bug, not merely incomplete debug metadata, and is one reason broad builds cannot safely enable the current DWARF path by default yet.

Reproduction

Confirmed locally on native Linux/arm64 with Go 1.26.5 and the current compiler from #2120:

llgo test -ldflags=-w=false -run '^TestOID$' github.com/goplus/llgo/test/std/crypto/x509

Result:

--- FAIL: TestOID (0.00s)
    x509_test.go:175: OID.Equal returned false for equal OIDs
FAIL

Control:

llgo test -ldflags=-w -run '^TestOID$' github.com/goplus/llgo/test/std/crypto/x509

Result: PASS.

The same failure appears in the Go 1.24 Linux shard of https://github.com/xgo-dev/llgo/actions/runs/29549966202, so it is not specific to the local Go 1.26 toolchain.

Analysis

-w=false currently selects more than section emission. internal/build enables ssa.GlobalDebug, disables the LLVM pass pipeline, and disables C ABI optimization before asking the linker to keep DWARF. The differential test therefore isolates the bug to the DWARF-enabled build path, but does not yet prove that the metadata nodes themselves corrupt execution.

Likely investigation split:

  1. independently toggle ssa.GlobalDebug, passOpt, and cabiOptimize for this test;
  2. compare IR for encoding/asn1.OID.Equal and its slice/loop operations;
  3. determine whether the failure is debug-mode SSA lowering, unoptimized C ABI lowering, or a pass dependency that currently masks invalid IR;
  4. add a smaller OID/slice equality reproducer before changing the DWARF implementation.

The ignored net/url.(*URL).setPath linkname warning appears in both failing and passing controls and is therefore not the discriminator.

Expected behavior

Debug information must not change Go program semantics. OID.Equal must return true for equal values with both -w=false and -w.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggo-compatCompatibility with Go commands, flags, and toolchain behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions