This patch fix the SEGSEGV noticed on some scenarios when there is relocation against read-only segment in the program. We need to generate DT_TEXTREL entry in .dynamic section to notify dynamic linker that there are relocations against read-only segment, that dynamic linker can invoke mprotect to change the segment attribute into writable, and after relocation finished, change it back to read-only. OK for trunk? bfd/ * elfnn-aarch64.c (aarch64_readonly_dynrelocs): New function. (elfNN_aarch64_size_dynamic_sections): Traverse hash table to check relocations against read-only sections. ld/testsuite/ * ld-aarch64/dt_textrel.s: New testcase. * ld-aarch64/dt_textrel.d: New expectation file. * ld-aarch64/aarch64-elf.exp: Run new testcase. -- Regards, Jiong