Skip to content

Recognize the #[cfi_encoding] attribute and warn that it does nothing - #4846

Merged
CohenArthur merged 2 commits into
masterfrom
allow-cfi-encoding-feature
Sep 14, 2026
Merged

CohenArthur merged 2 commits into
masterfrom
allow-cfi-encoding-feature

Conversation

@CohenArthur

Copy link
Copy Markdown
Member

No description provided.

@CohenArthur CohenArthur added the rust-for-linux Issue related to the compilation of the Linux kernel and its crates label Sep 4, 2026
Create a new enum class to indicate whether a feature was gated or not
to the FeatureGate checker.

As well as moving `gate` into a public function since the aim is to make
it available to other passes.

gcc/rust/ChangeLog:

	* checks/errors/feature/rust-feature-gate.cc (FeatureGate::gate): Move into public
	methods, use GateResult enum.
	* checks/errors/feature/rust-feature-gate.h: Add new GateResult enum.
And warn that it currently does not do anything, and depends on a patchset upstream
that is currently being reviewed.

gcc/rust/ChangeLog:

	* checks/errors/feature/rust-feature-defs-rfl.h: Add cfi_encoding RfL feature.
	* checks/errors/feature/rust-feature-gate.cc (FeatureGate::visit): Add visitor
	for attributes in general, and warn on cfi_encoding being used.
	* checks/errors/feature/rust-feature-gate.h: Declare the attribute visitor.
	* util/rust-attribute-values.h: Add #[cfi_encoding].
	* util/rust-attributes.cc: Likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/cfi-encoding1.rs: New test.
	* rust/compile/cfi-encoding2.rs: New test.
@philberty

Copy link
Copy Markdown
Member

i dont think this is merged in yet: "https://gcc.gnu.org/pipermail/gcc-patches/2026-July/724091.html"

but i bet all this is will be to add another atribute onto the record type

@CohenArthur

Copy link
Copy Markdown
Member Author

@philberty yes exactly, I actually reached out to the patch author (@kees) to make sure I understood everything correctly, and you're right that we'll need to add another attribute to override this. For now Kees' patchset does not allow overriding the encoding but this is something we'll eventually work on together!

@CohenArthur
CohenArthur added this pull request to the merge queue Sep 14, 2026
Merged via the queue into master with commit a107b3c Sep 14, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust-for-linux Issue related to the compilation of the Linux kernel and its crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants