Skip to content

Retpoline support in rustc (target features or dedicated flags) #116852

Open
@ojeda

Description

@ojeda

Currently:

-Ctarget-feature="+retpoline-external-thunk"
-Ctarget-feature="+retpoline-indirect-branches"
-Ctarget-feature="+retpoline-indirect-calls"

seems to work as expected, but the features are unknown, and so since 1.61 they emit a warning:

warning: unknown feature specified for `-Ctarget-feature`: `retpoline-external-thunk`
  |
  = note: it is still passed through to the codegen backend
  = help: consider filing a feature request

warning: unknown feature specified for `-Ctarget-feature`: `retpoline-indirect-branches`
  |
  = note: it is still passed through to the codegen backend
  = help: consider filing a feature request

warning: unknown feature specified for `-Ctarget-feature`: `retpoline-indirect-calls`
  |
  = note: it is still passed through to the codegen backend
  = help: consider filing a feature request

Could/should these be added as known features to avoid using the target specification file?

In an old issue at #54637 it seems that back then dedicated flags were not intended (like Clang's -mretpoline-external-thunk and GCC's -mindirect-branch=thunk-extern -mindirect-branch-register), which perhaps make a bit more sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-feature-requestCategory: A feature request, i.e: not implemented / a PR.PG-exploit-mitigationsProject group: Exploit mitigationsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions