[AArch64] Generate DT_TEXTREL when there is relocation against read-only section

Jiong Wang jiong.wang@arm.com
Fri Jun 19 09:06:00 GMT 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_dt_rel.patch
Type: text/x-diff
Size: 2567 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150619/1ff6a53f/attachment.bin>


More information about the Binutils mailing list