[SafeStack] Use proper API to get stack guard

Authored by pzheng on May 17 2021, 12:16 PM.


[SafeStack] Use proper API to get stack guard

Using the proper API automatically sets __stack_chk_guard to dso_local if
Reloc::Static. This wasn't strictly necessary until recently when dso_local was
no longer implied by TargetMachine::shouldAssumeDSOLocal for
__stack_chk_guard. By using the proper API, we can avoid generating unnecessary
GOT relocations.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D102646