Skip to content

Build Target Task 1: Basic Target Parameter Support for llgo build/run/test commands #1194

Description

@cpunion

Overview

This issue tracks the implementation of Task 1 from the overall cross-platform compilation design (#1176): Adding -target parameter support for llgo build, llgo run, and llgo test commands.

Scope

Build and link parameter configuration support including:

  • llvm-target
  • goos/goarch
  • cflags/ldflags
  • linker
  • cpu
  • features
  • build-tags

Implementation Details

Target Configuration System

  • Introduce @/targets directory containing JSON configuration files
  • Support multi-level inheritance via inherits field
  • Automatic parameter merging and overriding

Supported Configuration Fields

  • inherits: Array for multi-level inheritance
  • llvm-target: LLVM backend target triple
  • goos/goarch: Go OS and architecture identifiers
  • build-tags: Go build tags for conditional compilation
  • cflags/ldflags: C compiler and linker parameters
  • features/cpu: CPU features, model
  • linker: Specifies the linker to use

Command Integration

Add -target flag support to:

  • llgo build -target <target_name>
  • llgo run -target <target_name>
  • llgo test -target <target_name>

Migration Strategy

  • Retain logic for native builds
  • Retain wasm/wasip1 logic (SDK download, sysroot/resource-dir automation)
  • Use JSON target configs for all other platforms

Related Issues

Implementation Status

Acceptance Criteria

  • -target parameter works for build/run/test commands
  • Target configuration inheritance system functional
  • JSON target configuration parsing implemented
  • Existing native and wasm builds unaffected
  • Documentation updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions