This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][ARM] Not readonly check for RWPI globals
ClosedPublic

Authored by keith.walker.arm on May 25 2022, 2:35 AM.

Details

Summary

When compiling for the RWPI relocation model [1], the debug information is wrong for readonly global variables.

Writable global variables are accessed by the static base register (R9 on ARM) in the RWPI relocation model. This is being correctly generated

Readonly global variables are not accessed by the static base register in the RWPI relocation model. This case is incorrectly generating the same debugging information as for writable global variables.

References:
[1] ARM Read-Write Position Independence: https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#read-write-position-independence-rwpi

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 2:35 AM
keith.walker.arm requested review of this revision.May 25 2022, 2:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 2:35 AM

The failing pre-commit tests:

  • ThreadSanitizer-x86_64::restore_stack.cpp
  • libFuzzer::fuzzer-leak.test

are unrelated to this change (they do not involve any RWPI code)

amilendra added inline comments.Jun 10 2022, 1:16 AM
llvm/test/DebugInfo/ARM/ropi.ll
22

I think these version specific content are not needed, and could break after the next version is branched?

23

Environment specific content; could potentially fail on Windows?

35

Do we need to check for these?
I think this test case can be considerably reduced to use only the bare minimum needed?

amilendra added inline comments.Jun 10 2022, 2:38 AM
llvm/test/DebugInfo/ARM/ropi.ll
22

Ah wait. These are fixed information so no specific to the commit or environment.

llvm/test/DebugInfo/ARM/ropi.ll
22

Yes. This is just information about the version of the build compiler used to generate the initial .ll file and is fixed.

23

This file information is just used to generate the compilation information in the generatede debugging information.
As we are not going to be actually using the debug information to actually debug on the host platform this should not be an issue.

35

I'll remove some of the entries that are not required which should make the ropi.ll test file more similar to the existing rwpi.ll test file.
The additional entries are because I used a newer version of the compiler to generate the initial ropi.ll file.

Removed unnecessary lines from test case.

Once again there are unrelated 8 failures showing on the pre-commit tests due to test timeouts.

This revision is now accepted and ready to land.Jun 14 2022, 5:01 AM
This revision was landed with ongoing or failed builds.Jun 15 2022, 3:52 AM
This revision was automatically updated to reflect the committed changes.