Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilepkg: cgo assembly uses the C compiler #3648

Merged
merged 6 commits into from
Aug 15, 2023
Merged

compilepkg: cgo assembly uses the C compiler #3648

merged 6 commits into from
Aug 15, 2023

Commits on Aug 14, 2023

  1. compilepkg: cgo assembly uses the C compiler

    This changes compilepkg to use the C compiler for .S and .s files to
    use the C compiler, like go build does. Previously it would use the
    Go assembler, which is used for pure Go packages. This should help
    fix issue: #3411
    
    I have added a cgo test for this issue that is intended to work with
    both arm64 and amd64 machines. I have only tested it on Linux amd64
    and Darwin arm64. Without this change it fails to build with the
    following output. This fails to parse the assembly file because it
    uses the Go assembler.
    
    ERROR: rules_go/tests/core/cgo/asm/BUILD.bazel:3:11: GoCompilePkg
    tests/core/cgo/asm/asm.a failed: (Exit 1): builder failed: error
    executing command (from target //tests/core/cgo/asm:asm)
    bazel-out/k8-opt-exec-2B5CBBC6/bin/external/go_sdk/builder_reset/builder
    compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src
    tests/core/cgo/asm/cgoasm.go -src tests/core/cgo/asm/asm_amd64.S ...
    
    tests/core/cgo/asm/asm_amd64.S:4: expected identifier, found "."
    asm: assembly of tests/core/cgo/asm/asm_amd64.S failed
    compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/asm: exit status 1
    evanj authored and fmeum committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    161418a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fedc432 View commit details
    Browse the repository at this point in the history
  3. run buildifier; make asm conditional

    evanj authored and fmeum committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    c86b8b9 View commit details
    Browse the repository at this point in the history
  4. assembly fixes for Mac OS X and Linux

    evanj authored and fmeum committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    4a8bd2a View commit details
    Browse the repository at this point in the history
  5. Change build constraint to (amd64 || arm64): Should work on Windows

    The tests were failing on Windows because rules_go incorrectly
    believed this was a "native" Go package. I think this should work on
    Windows.
    evanj authored and fmeum committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    14d5fdc View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2023

  1. Configuration menu
    Copy the full SHA
    15fcf97 View commit details
    Browse the repository at this point in the history