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

[BOLT] Fix reorder data test for RISC-V #68996

Merged
merged 2 commits into from
Oct 16, 2023
Merged

Conversation

mtvec
Copy link
Contributor

@mtvec mtvec commented Oct 13, 2023

On RISC-V, small data objects are put in the .sdata section by default. This causes the reorder-data-writable-ptload.c test to fail since it hard-codes the section to optimize to .data.

This patch passes the -fPIC -pie flags to clang to ensure the objects are added to .data on RISC-V.

On RISC-V, small data objects are put in the `.sdata` section by
default. This causes the `reorder-data-writable-ptload.c` to fail since
it hard-codes the section to optimize to `.data`.

This patch passes the `-msmall-data-limit=0` option to clang on RISC-V
to ensure the objects are added to `.data`.
@yota9
Copy link
Member

yota9 commented Oct 13, 2023

As I see in clang adding "-fPIC -pie" to test might help too, I think it would be better solution, could you please try it?
The second option might be changing int hot1 = 42 to int hot1[8] = {42}; for example, what do you think?

@mtvec
Copy link
Contributor Author

mtvec commented Oct 16, 2023

As I see in clang adding "-fPIC -pie" to test might help too, I think it would be better solution, could you please try it?

That works as well and is a bit cleaner. Thanks!

Copy link
Member

@yota9 yota9 left a comment

Choose a reason for hiding this comment

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

LGTM! Please fix the patch description before merging

@mtvec mtvec merged commit 8592241 into llvm:main Oct 16, 2023
3 checks passed
@mtvec mtvec deleted the bolt-fix-test-riscv branch October 23, 2023 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants