Skip to content

cmd/cgo: fails to parse object file generated by clang -flto #46295

Closed
@ianlancetaylor

Description

@ianlancetaylor

On tip, on linux-amd64, in the misc/swig/callback directory, running this command

CC=clang CGO_CFLAGS="-g -O2 -flto" CGO_LDFLAGS="-flto" go test -v

fails as follows:

# misc/swig/callback
cgo: cannot parse gcc output $WORK/b059//_cgo_.o as ELF, Mach-O, PE, XCOFF object
FAIL	misc/swig/callback [build failed]

At least when using clang, cgo has to disable -flto when it compiles the object, because cgo is unable to parse the byte code generated by clang.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions