[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-20 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 added a comment. Just in case you assume that I have push permission, unfortunately I do not. Could you help me merge the patch in? Thanks. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136203/new/ https://reviews.llvm.org/D136203 ___

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-19 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 updated this revision to Diff 469049. ZhiyaoMa98 marked an inline comment as done. ZhiyaoMa98 added a comment. Remove the unused `GA` variable. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136203/new/ https://reviews.llvm.org/D136203 Files: clang/lib/Driver/ToolChains/Arc

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-19 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 updated this revision to Diff 468973. ZhiyaoMa98 marked an inline comment as done. ZhiyaoMa98 added a comment. Updated the comment to reflect that now we allow using `-mlong-calls` with `-mexecute-only`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136203/new/ https://revie

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-19 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 added a comment. > Then just assert we aren't execute-only in the non-movw path. When we are not execute-only, existing code handles it by using constant pools and we are all good. In the case where we are execute-only and long-calls at the same time, we assert that we have `movt` l

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-19 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 updated this revision to Diff 468957. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136203/new/ https://reviews.llvm.org/D136203 Files: clang/lib/Driver/ToolChains/Arch/ARM.cpp clang/test/Driver/arm-execute-only.c llvm/lib/Target/ARM/ARMISelLowering.cpp llvm/test/CodeG

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-19 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 marked an inline comment as done. ZhiyaoMa98 added a comment. I have updated the diff to avoid the extra indirection. I am thinking about adding a new option, say `-mgot-calls` to allow code generation with the extra indirection. Is it sensible and shall I create another diff to discu

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-19 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 updated this revision to Diff 468928. ZhiyaoMa98 edited the summary of this revision. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136203/new/ https://reviews.llvm.org/D136203 Files: clang/lib/Driver/ToolChains/Arch/ARM.cpp clang/test/Driver/arm-execute-only.c llvm/lib/

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-18 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 added a comment. Unfortunately, `-fPIE` seems not to be generating the PLT on LLVM for embedded ARM. C source file (test.c): extern void bar(void); void foo(void) { bar(); } LLVM with `clang -O2 -fPIE -fsemantic-interposition -mlong-calls --target=armv7em-none-eabi -c t

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-18 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 added a comment. > Can you describe a little more what you're trying to do here? Sure. My eventual goal is to enable fine-granular live-update on ARM based microcontrollers, which requires the system to do some relocation at runtime. Below I will describe the challenge with a simple

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-18 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 added a comment. @efriedma Thank you for your suggestion. I will remove the extra indirection. I was wondering if you could also provide some insights about the RWPI case. I believe the same optimization also applies to RWPI. However, I actually want to store the function address as

[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

2022-10-18 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 created this revision. ZhiyaoMa98 added reviewers: labrinea, rengolin. Herald added subscribers: hiraditya, kristof.beyls. Herald added a project: All. ZhiyaoMa98 requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added projects: clang, LLVM. Promo

[PATCH] D126346: [Clang] Make PIC check comprehensive with respect to relocation models.

2022-05-24 Thread Zhiyao Ma via Phabricator via cfe-commits
ZhiyaoMa98 created this revision. ZhiyaoMa98 added reviewers: rsmith, llvm-commits. Herald added a project: All. ZhiyaoMa98 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Add missing if branch for "ropi", "rwpi" and "ropi-rwpi" relocation