Skip to content

SPARC -target-feature +vis breaks flang build on Linux/sparc64 #138494

Open
@rorth

Description

@rorth

A 2-stage build with flang included is currently broken on Linux/sparc64 with tons of errors like

error: current translation unit is compiled with the target feature '+vis' but the AST file 'tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.pch' was not

I could trace this to the fact that the object file creating is run with clang-21 -cc1 -triple sparc64-unknown-linux-gnu -emit-obj -target-feature +vis while the pch generation uses clang-21 -cc1 -triple sparc64-unknown-linux-gnu -emit-pch without the -target-feature +vis, thus the inconsistency.

Even without flang, there are three testsuite regressions showing the same error:

  Clang :: ClangScanDeps/modules-symlink.c
  Clang :: ClangScanDeps/prebuilt-modules-in-stable-dirs.c
  Clang :: SemaCXX/warn-unused-local-typedef-serialize.cpp

While I managed to get further along with the attached preliminary patch, which adds the missing option for -emit-pch and -emit-llvm (which fixes the flang build), this introduces tons of new regressions instead:

  Clang :: ClangScanDeps/module-format.c
  Clang :: ClangScanDeps/modules-pch-common-submodule.c
  Clang :: ClangScanDeps/modules-pch-common-via-submodule.c
  Clang :: ClangScanDeps/modules-pch-dangling.c
  Clang :: ClangScanDeps/modules-pch-imports.c
  Clang :: ClangScanDeps/modules-pch.c
  Clang :: ClangScanDeps/optimize-vfs-pch.m
  Clang :: Index/pch-with-errors.c
  Clang :: PCH/different-diagnostic-level.c
  Clang :: PCH/gch-probe.c
  Clang :: PCH/pch-dir.c
  Clang :: Tooling/pch.cpp

Now the .pch files are correctly built with -target-feature +vis, but the TUs are claimed to be not and I have no idea what's going on.

Fortunately, Solaris/sparcv9 isn't affected because for unknown reasons commit 3853116, which introduced -target-feature +vis, doesn't pass that option on Solaris.

It seems other targets are less affected because unlike the sparcv9 case they only enable -target-feature with special flags and not in general.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions