This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Reserve X18 by default for Android
ClosedPublic

Authored by hiraditya on Mar 13 2023, 4:03 PM.

Details

Summary

Reserve X18 even when -fsanitize=shadow-call-stack is not enabled.

Based on: https://reviews.llvm.org/D143355

Diff Detail

Event Timeline

hiraditya created this revision.Mar 13 2023, 4:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 4:03 PM
hiraditya requested review of this revision.Mar 13 2023, 4:03 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 13 2023, 4:03 PM
hiraditya added a reviewer: samitolvanen.
phosek accepted this revision.Mar 13 2023, 4:12 PM

LGTM

This revision is now accepted and ready to land.Mar 13 2023, 4:12 PM
samitolvanen accepted this revision.Mar 13 2023, 4:48 PM

LGTM. Folding D145979 into this one might also make sense.

clang/test/Driver/riscv-fixed-x-register.c
343 ↗(On Diff #504880)

This seems redundant. Isn't the LLVM codegen test sufficient here?

asb added inline comments.Mar 14 2023, 11:11 AM
clang/test/Driver/riscv-fixed-x-register.c
343 ↗(On Diff #504880)

I think testing that the +reserve-x18 target feature is added by the frontend probably has some value.

I think it would better match the rest of this file to just do --check-prefix=CHECK-FIXED-X18 (I _think_ that works, but it is the end of the day so I may be missing something obvious...).

Please do try to remember to generate patches with full context (-U999999 or similar).

asb accepted this revision.Mar 14 2023, 12:14 PM

LGTM.

MaskRay accepted this revision.Mar 14 2023, 2:27 PM
MaskRay added inline comments.
clang/test/Driver/riscv-fixed-x-register.c
343 ↗(On Diff #504880)

I prefer shared CHECK prefixes --check-prefix=CHECK-FIXED-X18 as well. We do that for many other tests.

343 ↗(On Diff #504880)

/// Check that x18 is reserved on Android by default.

hiraditya added inline comments.Mar 14 2023, 11:22 PM
clang/test/Driver/riscv-fixed-x-register.c
343 ↗(On Diff #504880)

@samitolvanen correct, this test isn't possible because llvm implicitly reserves the register so clang -cc1 never gets the "-target-feature" "+reserve-x18" parameter. I'll remove this test.

This revision was landed with ongoing or failed builds.Mar 14 2023, 11:43 PM
This revision was automatically updated to reflect the committed changes.