JDK-8396508 introduced dynamic relocations in a read only data section, aka a 
`TEXTREL` section. `TEXTREL` sections are undesirable from a security 
standpoint and will cause the jdk to fail to run in an hardened Linux 
environment like SELinux. It also causes linking to fail when built with 
clang/lld. 

This PR adds `-z,text` to `BASIC_LDFLAGS` for gcc to forbid dynamic relocations 
in read-only sections so that similar issues in the future are caught during 
the development cycle and switches the `.rodata` section to a RELRO section in 
[atomic_linux_aarch64.S](https://github.com/openjdk/jdk/compare/master...bsdkurt:jdk:JDK-8398503?expand=1#diff-aac001dcef5d037ac72a231b0d5913247997099a7d08b466f0cf9826a3443482)

---------
- [X] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - Switch to a RELRO section to eliminate dynamic relocations in
 - Add -z,text to BASIC_LDFLAGS for gcc to forbid dynamic relocations

Changes: https://git.openjdk.org/jdk/pull/34160/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=34160&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8398503
  Stats: 4 lines in 2 files changed: 1 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/34160.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/34160/head:pull/34160

PR: https://git.openjdk.org/jdk/pull/34160

Reply via email to