Skip to content

[AVR] Changed data_layout #145241

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

[AVR] Changed data_layout #145241

wants to merge 4 commits into from

Conversation

tomtor
Copy link
Contributor

@tomtor tomtor commented Aug 11, 2025

This change is required when

llvm/llvm-project@97f0ff0

gets included in the Rust llvm tree, because it changes the AVR data-layout

@rustbot
Copy link
Collaborator

rustbot commented Aug 11, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 11, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@tomtor
Copy link
Contributor Author

tomtor commented Aug 11, 2025

@Patryk27 FYI

@rust-log-analyzer

This comment has been minimized.

@nikic
Copy link
Contributor

nikic commented Aug 11, 2025

You need to adjust the datalayout in

if llvm_version < (20, 0, 0) {
if sess.target.arch == "aarch64" || sess.target.arch.starts_with("arm64") {
// LLVM 20 defines three additional address spaces for alternate
// pointer kinds used in Windows.
// See https://github.com/llvm/llvm-project/pull/111879
target_data_layout =
target_data_layout.replace("-p270:32:32-p271:32:32-p272:64:64", "");
}
if sess.target.arch.starts_with("sparc") {
// LLVM 20 updates the sparc layout to correctly align 128 bit integers to 128 bit.
// See https://github.com/llvm/llvm-project/pull/106951
target_data_layout = target_data_layout.replace("-i128:128", "");
}
if sess.target.arch.starts_with("mips64") {
// LLVM 20 updates the mips64 layout to correctly align 128 bit integers to 128 bit.
// See https://github.com/llvm/llvm-project/pull/112084
target_data_layout = target_data_layout.replace("-i128:128", "");
}
if sess.target.arch.starts_with("powerpc64") {
// LLVM 20 updates the powerpc64 layout to correctly align 128 bit integers to 128 bit.
// See https://github.com/llvm/llvm-project/pull/118004
target_data_layout = target_data_layout.replace("-i128:128", "");
}
if sess.target.arch.starts_with("wasm32") || sess.target.arch.starts_with("wasm64") {
// LLVM 20 updates the wasm(32|64) layout to correctly align 128 bit integers to 128 bit.
// See https://github.com/llvm/llvm-project/pull/119204
target_data_layout = target_data_layout.replace("-i128:128", "");
}
}
if llvm_version < (21, 0, 0) {
if sess.target.arch == "nvptx64" {
// LLVM 21 updated the default layout on nvptx: https://github.com/llvm/llvm-project/pull/124961
target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64");
}
if sess.target.arch == "amdgpu" {
// LLVM 21 adds the address width for address space 8.
// See https://github.com/llvm/llvm-project/pull/139419
target_data_layout = target_data_layout.replace("p8:128:128:128:48", "p8:128:128")
}
}
for old LLVM versions.

@tomtor
Copy link
Contributor Author

tomtor commented Aug 11, 2025

@nikic Would the version with the matching LLVM be 21.2.0, because it missed 21.1 from aug 1th ?

@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Aug 11, 2025
@nikic
Copy link
Contributor

nikic commented Aug 11, 2025

@nikic Would the version with the matching LLVM be 21.2.0, because it missed 21.1 from aug 1th ?

The version should be 22.0.0.

@nikic
Copy link
Contributor

nikic commented Aug 11, 2025

Blocked on llvm/llvm-project#153010.

@fee1-dead
Copy link
Member

r? nikic

@rustbot rustbot assigned nikic and unassigned fee1-dead Aug 11, 2025
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you please squash the commits?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants