diff mbox series

rust-target-config: Update the data layout for x86-64 target

Message ID 20241017123244.2418344-1-Deepesh.Varatharajan@windriver.com
State New
Headers show
Series rust-target-config: Update the data layout for x86-64 target | expand

Commit Message

Varatharajan, Deepesh Oct. 17, 2024, 12:32 p.m. UTC
From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>

The data layout for x86-64 target was different in rust from llvm.
It resulted in the following data layout error:
--------------------------------------------------------------------------------------
error: data-layout for target `x86_64-linux`, `e-m:e-i64:64-f80:128-n8:16:32:64-S128`,
differs from LLVM target's `x86_64-unknown-linux-gnu` default layout,
`e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128`
--------------------------------------------------------------------------------------

The issue was reported in meta-rust layer as:
https://github.com/meta-rust/meta-rust/pull/442

Hence, the data layout for x86-64 is modified as per the llvm sources which fixes the issue.

After running the testsuite with the modified data layout; it was observed that the
"tests/codegen/i128-x86-align.rs" passed. The modified data layout fixed the scalar pair which
resolved the testcase failure. Hence, the testcase has been removed from the exclude list.

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
---
 meta/classes-recipe/rust-target-config.bbclass | 2 +-
 meta/lib/oeqa/selftest/cases/rust.py           | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

Khem Raj Oct. 17, 2024, 4:02 p.m. UTC | #1
This patch is ok, any rust version using clang 18 or newer will need this.

On Thu, Oct 17, 2024 at 5:33 AM Varatharajan, Deepesh via
lists.openembedded.org
<deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote:
>
> From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
>
> The data layout for x86-64 target was different in rust from llvm.
> It resulted in the following data layout error:
> --------------------------------------------------------------------------------------
> error: data-layout for target `x86_64-linux`, `e-m:e-i64:64-f80:128-n8:16:32:64-S128`,
> differs from LLVM target's `x86_64-unknown-linux-gnu` default layout,
> `e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128`
> --------------------------------------------------------------------------------------
>
> The issue was reported in meta-rust layer as:
> https://github.com/meta-rust/meta-rust/pull/442
>
> Hence, the data layout for x86-64 is modified as per the llvm sources which fixes the issue.
>
> After running the testsuite with the modified data layout; it was observed that the
> "tests/codegen/i128-x86-align.rs" passed. The modified data layout fixed the scalar pair which
> resolved the testcase failure. Hence, the testcase has been removed from the exclude list.
>
> Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
> ---
>  meta/classes-recipe/rust-target-config.bbclass | 2 +-
>  meta/lib/oeqa/selftest/cases/rust.py           | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
> index 334f2e7d5f..f7aa6c74d8 100644
> --- a/meta/classes-recipe/rust-target-config.bbclass
> +++ b/meta/classes-recipe/rust-target-config.bbclass
> @@ -153,7 +153,7 @@ TARGET_C_INT_WIDTH[aarch64] = "32"
>  MAX_ATOMIC_WIDTH[aarch64] = "128"
>
>  ## x86_64-unknown-linux-{gnu, musl}
> -DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +DATA_LAYOUT[x86_64] = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
>  TARGET_ENDIAN[x86_64] = "little"
>  TARGET_POINTER_WIDTH[x86_64] = "64"
>  TARGET_C_INT_WIDTH[x86_64] = "32"
> diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py
> index cbe6366f75..88d7bb9518 100644
> --- a/meta/lib/oeqa/selftest/cases/rust.py
> +++ b/meta/lib/oeqa/selftest/cases/rust.py
> @@ -83,7 +83,6 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase):
>                              'src/tools/tidy/src/',
>                              'tests/assembly/asm/aarch64-outline-atomics.rs',
>                              'tests/codegen/abi-main-signature-32bit-c-int.rs',
> -                            'tests/codegen/i128-x86-align.rs',
>                              'tests/codegen/issues/issue-122805.rs',
>                              'tests/codegen/thread-local.rs',
>                              'tests/mir-opt/',
> --
> 2.43.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#206017): https://lists.openembedded.org/g/openembedded-core/message/206017
> Mute This Topic: https://lists.openembedded.org/mt/109062536/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Varatharajan, Deepesh Oct. 17, 2024, 4:29 p.m. UTC | #2
This issue was first identified with Rust 1.78, when it updated to Clang 18. Since we are currently on Rust 1.79 in the master branch, we need to implement this change in master.

Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Khem Raj <raj.khem@gmail.com>
Sent: Thursday, October 17, 2024 9:32:23 PM
To: Varatharajan, Deepesh <Deepesh.Varatharajan@windriver.com>
Cc: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org>; Gowda, Naveen <Naveen.Gowda@windriver.com>; Moodalappa, Shivaprasad <Shivaprasad.Moodalappa@windriver.com>; Kokkonda, Sundeep <Sundeep.Kokkonda@windriver.com>
Subject: Re: [OE-core] [PATCH] rust-target-config: Update the data layout for x86-64 target

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

This patch is ok, any rust version using clang 18 or newer will need this.

On Thu, Oct 17, 2024 at 5:33 AM Varatharajan, Deepesh via
lists.openembedded.org
<deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote:
>
> From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
>
> The data layout for x86-64 target was different in rust from llvm.
> It resulted in the following data layout error:
> --------------------------------------------------------------------------------------
> error: data-layout for target `x86_64-linux`, `e-m:e-i64:64-f80:128-n8:16:32:64-S128`,
> differs from LLVM target's `x86_64-unknown-linux-gnu` default layout,
> `e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128`
> --------------------------------------------------------------------------------------
>
> The issue was reported in meta-rust layer as:
> https://github.com/meta-rust/meta-rust/pull/442
>
> Hence, the data layout for x86-64 is modified as per the llvm sources which fixes the issue.
>
> After running the testsuite with the modified data layout; it was observed that the
> "tests/codegen/i128-x86-align.rs" passed. The modified data layout fixed the scalar pair which
> resolved the testcase failure. Hence, the testcase has been removed from the exclude list.
>
> Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
> ---
>  meta/classes-recipe/rust-target-config.bbclass | 2 +-
>  meta/lib/oeqa/selftest/cases/rust.py           | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
> index 334f2e7d5f..f7aa6c74d8 100644
> --- a/meta/classes-recipe/rust-target-config.bbclass
> +++ b/meta/classes-recipe/rust-target-config.bbclass
> @@ -153,7 +153,7 @@ TARGET_C_INT_WIDTH[aarch64] = "32"
>  MAX_ATOMIC_WIDTH[aarch64] = "128"
>
>  ## x86_64-unknown-linux-{gnu, musl}
> -DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +DATA_LAYOUT[x86_64] = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
>  TARGET_ENDIAN[x86_64] = "little"
>  TARGET_POINTER_WIDTH[x86_64] = "64"
>  TARGET_C_INT_WIDTH[x86_64] = "32"
> diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py
> index cbe6366f75..88d7bb9518 100644
> --- a/meta/lib/oeqa/selftest/cases/rust.py
> +++ b/meta/lib/oeqa/selftest/cases/rust.py
> @@ -83,7 +83,6 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase):
>                              'src/tools/tidy/src/',
>                              'tests/assembly/asm/aarch64-outline-atomics.rs',
>                              'tests/codegen/abi-main-signature-32bit-c-int.rs',
> -                            'tests/codegen/i128-x86-align.rs',
>                              'tests/codegen/issues/issue-122805.rs',
>                              'tests/codegen/thread-local.rs',
>                              'tests/mir-opt/',
> --
> 2.43.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#206017): https://lists.openembedded.org/g/openembedded-core/message/206017
> Mute This Topic: https://lists.openembedded.org/mt/109062536/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
index 334f2e7d5f..f7aa6c74d8 100644
--- a/meta/classes-recipe/rust-target-config.bbclass
+++ b/meta/classes-recipe/rust-target-config.bbclass
@@ -153,7 +153,7 @@  TARGET_C_INT_WIDTH[aarch64] = "32"
 MAX_ATOMIC_WIDTH[aarch64] = "128"
 
 ## x86_64-unknown-linux-{gnu, musl}
-DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+DATA_LAYOUT[x86_64] = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 TARGET_ENDIAN[x86_64] = "little"
 TARGET_POINTER_WIDTH[x86_64] = "64"
 TARGET_C_INT_WIDTH[x86_64] = "32"
diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py
index cbe6366f75..88d7bb9518 100644
--- a/meta/lib/oeqa/selftest/cases/rust.py
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -83,7 +83,6 @@  class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase):
                             'src/tools/tidy/src/',
                             'tests/assembly/asm/aarch64-outline-atomics.rs',
                             'tests/codegen/abi-main-signature-32bit-c-int.rs',
-                            'tests/codegen/i128-x86-align.rs',
                             'tests/codegen/issues/issue-122805.rs',
                             'tests/codegen/thread-local.rs',
                             'tests/mir-opt/',