Skip to content

Add R_ARM_CALL runnable test#1225

Draft
Steven6798 wants to merge 1 commit into
qualcomm:mainfrom
Steven6798:issue-1224
Draft

Add R_ARM_CALL runnable test#1225
Steven6798 wants to merge 1 commit into
qualcomm:mainfrom
Steven6798:issue-1224

Conversation

@Steven6798
Copy link
Copy Markdown
Contributor

Fix #1224

@Steven6798
Copy link
Copy Markdown
Contributor Author

I'll appreciate some feedback on this, as this will serve as my template for adding more relocation tests. I'm sure these changes can be improved even more.

@Steven6798 Steven6798 requested review from parth-07 and quic-areg May 27, 2026 17:45
@Steven6798 Steven6798 marked this pull request as draft May 27, 2026 17:54
Comment thread test/ARM/RunTests/CallReloc/CallReloc.test Outdated
Comment thread test/ARM/RunTests/CallReloc/Inputs/1.s Outdated
Comment thread docs/DeveloperDocs/ARM/relocations.md Outdated
Copy link
Copy Markdown
Contributor

@quic-areg quic-areg left a comment

Choose a reason for hiding this comment

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

In general, I think we should prefer C inputs for runnable tests, get rid of the docs if they are going to just parrot the ABI, and separate the types of checks we make in static vs runtime tests.

Comment thread test/Common/RunTests/MyTest/MyTest.test Outdated
Comment thread test/Common/RunTests/MyTest/MyTest.test Outdated
Comment thread test/Common/RunTests/MyTest/MyTest.test Outdated
Comment thread test/Common/RunTests/MyTest/MyTest.test Outdated
Comment thread test/Common/RunTests/MyTest/Inputs/1.s Outdated
Comment thread docs/DeveloperDocs/ARM/relocations.md Outdated
@quic-seaswara
Copy link
Copy Markdown
Contributor

Rename the test to R_ARM_CALL.test

@Steven6798
Copy link
Copy Markdown
Contributor Author

Rename the test to R_ARM_CALL.test

Sounds good. Thanks!

@Steven6798
Copy link
Copy Markdown
Contributor Author

I addressed the issues. Let me know if I missed something or if I can improve it even more.

Copy link
Copy Markdown
Contributor

@quic-areg quic-areg left a comment

Choose a reason for hiding this comment

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

LGTM mostly.

For future PRs, if there is no existing static test for the relocation it might be a good idea to add one in addition to the runtime test. R_ARM_CALL is already well tested, so that does not apply here, but it might for future relocations.

The doc looks better than before imo, but I still think it adds little value. Checking the list of supported relocations for a reviewer or developer was already a pretty trivial task (they are all defined in *RelocationFunctions.h) , and I worry that the doc risks going stale.

# Test the ARM R_ARM_CALL relocation.
#END_COMMENT
#START_TEST
#RUN: %run_cc -o %t1.o -c %p/Inputs/1.c
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we establish that this generates a R_ARM_CALL relocation ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can add the llvm-readelf again to check for the relocation like I was doing before. Is that enough?

Comment thread test/ARM/RunTests/R_ARM_CALL/R_ARM_CALL.test Outdated
Comment thread test/ARM/RunTests/R_ARM_CALL/R_ARM_CALL.test Outdated
Comment thread docs/DeveloperDocs/ARM/relocations.md Outdated
@Steven6798
Copy link
Copy Markdown
Contributor Author

I'm making progress. I'll leave the documentation for another issue to focus on 1 thing at a time. I improved the testing coverage of this relocation. I also started using Bare-Metal runs as much as possible to isolate the tests.

@Steven6798 Steven6798 changed the title Add R_ARM_CALL runnable test and documentation Add R_ARM_CALL runnable test May 29, 2026
@Steven6798
Copy link
Copy Markdown
Contributor Author

I also updated the lit.cfg to include qemu-system-target to use Bare-Metal runs

@Steven6798 Steven6798 force-pushed the issue-1224 branch 2 times, most recently from acfc516 to 3f94fee Compare May 29, 2026 18:10
Fix qualcomm#1224

Signed-off-by: Steven Ramirez Rosa <ramirezr@qti.qualcomm.com>
Comment thread .github/workflows/ci.yml
shell: bash
run: |
sudo apt update
sudo apt install -y libsdl2-2.0-0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to use the qemu system emulator. the machine that runs the CI workflow is missing a library. Shakti suggested adding it to the workflow but clearly that did not work. If you have any suggestions about how to address this let me know.

Comment thread test/lit.cfg
run_cxx = ''
sysroot = ''
emulator = ''
emulator_system = ''
Copy link
Copy Markdown
Contributor

@parth-07 parth-07 Jun 1, 2026

Choose a reason for hiding this comment

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

Can you please explain why do we need system emulator? For which cases linux emulator is not enough?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shankar suggested using the system emulator to isolate the testing as much as possible. For example, when static linking a lot gets included in the binary, with this approach, only a minimal amount of code is included. What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@quic-seaswara Hi Shankar, I am concerned that writing baremetal code and using system emulator requires more boilerplate and makes testing more difficult without providing any apparent benefit.

to isolate the testing as much as possible

We are only removing the libc dependency -- all other dependency are still there, and we are unlikely to encounter bugs/corner-cases in libc when doing extended testing of different relocations computations because we won't be using any advanced feature of libc.

For example, when static linking a lot gets included in the binary, with this approach, only a minimal amount of code is included.

I agree with this, but I am not sure if less size is worth the benefit here. We can always delete the test artifacts after the testing.

Comment thread test/ARM/RunTests/R_ARM_CALL/Inputs/hidden_callee.c
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.

Add R_ARM_CALL runnable test

4 participants