Skip to content
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

ldelf: aarch32: Accept ELFOSABI_ARM as OS ABI #6605

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

b49020
Copy link
Contributor

@b49020 b49020 commented Jan 15, 2024

Rust TAs built for no-std mode targeting 32-bit Arm architecture use ELFOSABI_ARM as the OS ABI within ELF header. So allow ldelf to load those Rust TAs built for 32-bit Arm.

@b49020
Copy link
Contributor Author

b49020 commented Jan 15, 2024

Looks like the CI build failure isn't related to this PR.

ldelf/ta_elf.c Outdated Show resolved Hide resolved
ldelf/ta_elf.c Outdated
}

if (ehdr->e_ident[EI_OSABI] == ELFOSABI_ARM) {
if ((ehdr->e_flags & EF_ARM_ABIMASK) != EF_ARM_ABI_UNKNOWN)
Copy link
Contributor

Choose a reason for hiding this comment

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

This sucks somewhat. I guess Rust is going to use floating point if it feels like it, but we'll never know.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should perhaps accept both EF_ARM_ABI_UNKNOWN and EF_ARM_ABI_V5 here? We do support EABIv5 so let's be prepared in case Rust sets the flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Binutils-gdb reference here [1] indicates that there is 1:1 relation among ELFOSABI_ARM and EF_ARM_ABI_UNKNOWN in flags field. However, for floating point case I agree corresponding bit EF_ARM_ABI_FLOAT_HARD should be checked here as well for Rust case. I will make that common instead as earlier.

[1] https://github.com/bminor/binutils-gdb/blob/master/bfd/elf32-arm.c#L17661

Copy link
Contributor Author

@b49020 b49020 Jan 15, 2024

Choose a reason for hiding this comment

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

BTW, Linux arm32 ELF parser does the similar floating point checking here: https://github.com/torvalds/linux/blob/master/arch/arm/kernel/elf.c#L26

@jforissier
Copy link
Contributor

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a)

@jenswi-linaro
Copy link
Contributor

Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

@b49020
Copy link
Contributor Author

b49020 commented Jan 15, 2024

Thanks, tags applied.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

ldelf/ta_elf.c Outdated Show resolved Hide resolved
Rust TAs built for no-std mode targeting 32-bit Arm architecture use
ELFOSABI_ARM as the OS ABI within ELF header. So allow ldelf to load
those Rust TAs built for 32-bit Arm.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a)
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
@b49020
Copy link
Contributor Author

b49020 commented Jan 17, 2024

Addressed comment and tag applied, thanks.

@jforissier jforissier merged commit 5f7f88c into OP-TEE:master Jan 19, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants