[SYCL][CMake] Fix and apply hardening flags to `sycl-rel-6_2` (#19444)
This PR contains several cherry-picks and some unique changes which have
not been applied to the `sycl` branch yet.
The intent of this PR is to enable as much (quickly) possible hardening
flags to be in better compliance with our SDL requirements.
The main thing this PR is after are things like immediate bindings,
fortify source, stack protection and `relro`.
The thing that this PR is **not** after are extra warning flags - some
of them we can't apply globally because LLVM itself isn't warning free,
some of them we can't apply even locally to SYCL RT because we haven't
fixed corresponding warnings yet.
Patches which were cherry-picked from the `sycl` branch:
- [SYCL] Fix AddSecurityFlags having no side effects
(https://github.com/intel/llvm/pull/17690)
- Patch-By: Alexey Sachkov <alexey.sachkov@intel.com>
- [SYCL] Refresh hardening flags applied to the project
(https://github.com/intel/llvm/pull/18398)
- Patch-By: Nikita Kornev <nikita.kornev@intel.com>
- [SYCL][CMAKE] Refactor -fPIE handling
(https://github.com/intel/llvm/pull/19235)
- Patch-By: Alexey Sachkov <alexey.sachkov@intel.com>
- [SYCL][CMAKE] Drop nodlopen from hardening flags
(https://github.com/intel/llvm/pull/19357)
- Patch-By: Alexey Sachkov <alexey.sachkov@intel.com>
- [SYCL][CMAKE] Fix _FORTIFY_SOURCE=3
(https://github.com/intel/llvm/pull/19268)
- Patch-By: Alexey Sachkov <alexey.sachkov@intel.com>
- [SYCL][CMake] Properly enable -pie hardening flag
(https://github.com/intel/llvm/pull/19447)
- Patch-By: Alexey Sachkov <alexey.sachkov@intel.com>
Additional changes which have **not** been applied to the `sycl` branch:
- Adjusted `configure.py` to the new way of `-fPIE` handling
- Dropped `/sdl` flag because LLVM isn't warning-free
- it will be applied locally to SYCL RT in a separate PR against the `sycl` branch for future releases
- Dropped `/analyze` flag because SYCL RT isn't warning-free
- it will be applied locally to SYCL RT in a separate PR against the `sycl` branch for future releases