[PATCH] D61477: [ELF] -z combreloc: sort dynamic relocations by (!is_relative,symbol_index,r_offset)

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 07:12:54 PDT 2019


MaskRay added a comment.

For the PR41692 reproduce tarball, `ld.lld @response.txt --pack-dyn-relocs=none` (without the patch) shows the relative relocations aren't sorted by `r_offset`.

  # I deleted some other flags to compare the result with gold and ld.bfd
  Relocation section '.rela.dyn' at offset 0x14008 contains 65020 entries:
      Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
  0000000000405000  0000000000000008 R_X86_64_RELATIVE                         1954a5
  0000000000405010  0000000000000008 R_X86_64_RELATIVE                         19eb00
  000000000049d0f0  0000000000000008 R_X86_64_RELATIVE                         1ee500
  000000000049d100  0000000000000008 R_X86_64_RELATIVE                         1ee54f
  000000000049d110  0000000000000008 R_X86_64_RELATIVE                         1ee525
  0000000000403000  0000000000000008 R_X86_64_RELATIVE                         1ee580
  0000000000403008  0000000000000008 R_X86_64_RELATIVE                         1ee5a0
  0000000000403010  0000000000000008 R_X86_64_RELATIVE                         0

Relocations sorted by r_offset would make a poor person's life easier when debugging with `readelf -r` :) (I use `readelf -r` much while debugging numerous internal issues)


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61477/new/

https://reviews.llvm.org/D61477





More information about the llvm-commits mailing list