This patch is needed to load call address from shared library without the PLT(load from the GOT).
Looks sensible in general, just various minor points.
This comment probably needs updating to reflect the fact that GlobalAddress/ExternalSymbol may now become a normal node and indirectly called if using NonLazyBind.
This should only be an additional 4 spaces of indentation.
Please remove this extra line.
The dyn_cast seems a bit weird but AArch64 and X86 (the only other backends supporting this) both do that so I guess it's fine. However, the MO_CALL fallback case is a change of behaviour; non-function non-DSO-locals would previously have still been called with an MO_PLT, so the F && should be part of the F->hasFnAttribute condition.
"the PLT" and "the GOT".
Please do this for -mtriple=riscv32 and -mtriple=riscv64 (no -linux-gnu is generally used in the CodeGen tests unless it's necessary), and use a single - for -relocation-model.
Please use update_llc_test_checks.py (and my own personal opinion is this would look nicer with a lowercase plt in the function name).
A couple of minor remaining points.
Actually I should have been more accurate; only GlobalAddress nodes will become indirect calls, ExternalSymbols will always be direct calls through TargetExternalSymbol nodes, since this only changes the GlobalAddress branch (as you need the function to get its attributes).
Still missing a -mtriple=riscv32 line.
-fno-plt essentially inlines the PLT entry into the call site. For x86-64, there are benefits if many call sites are defined in different DSOs.
If the callee is actually defined, -fno-plt is actually pessimization. I don't think -fno-plt is useful. Usually people just need some __attribute__((noplt)) on libc functions. Clang has not implemented it, though.