Page MenuHomeFreeBSD

libdwarf: Add symbol value when processing .rela relocations
ClosedPublic

Authored by emaste on Feb 11 2015, 7:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 9:45 AM
Unknown Object (File)
Mar 5 2024, 1:07 PM
Unknown Object (File)
Feb 16 2024, 7:21 AM
Unknown Object (File)
Jan 21 2024, 6:08 AM
Unknown Object (File)
Jan 8 2024, 6:23 AM
Unknown Object (File)
Dec 24 2023, 4:16 PM
Unknown Object (File)
Dec 23 2023, 5:48 AM
Unknown Object (File)
Dec 23 2023, 5:21 AM

Details

Summary

In practice .rela debug relocations often use the the .debug_* sections as the symbol, which has the value 0:

Relocation section '.rela.debug_info' at offset 0xd18 contains 205 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000006  001a0000000a R_X86_64_32       0000000000000000 .debug_abbrev + 0
00000000000c  001e0000000a R_X86_64_32       0000000000000000 .debug_str + 0
000000000012  001e0000000a R_X86_64_32       0000000000000000 .debug_str + 45

so in those cases there is no difference if the symbol value is used in the relocation or not.

It is not always the case though:

000000000039  002700000001 R_X86_64_64       0000000000000010 xen_pci_driver + 0

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste retitled this revision from to libdwarf: Add symbol value when processing .rela relocations.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added a subscriber: Unknown Object (MLST).

See also D1819

kib edited edge metadata.

It looks fine, but definitely is extremely subtle. The dwarf_get_reloc_size() returns zero for non-abs relocations, so dwarf_write_{m.l}sb() does nothing for other relocation types.

This at least deserves explanation in a comment.

This revision is now accepted and ready to land.Feb 11 2015, 7:18 PM
rpaulo edited edge metadata.

I agree with kib that this deserves a comment. And perhaps add another comment in D1819 explaining why it isn't needed for .rel relocations.

emaste edited edge metadata.

explicitly skip _dwarf_write_* if size==0 and add comment explaining that means unknown or non-absolute relocation

This revision now requires review to proceed.Feb 11 2015, 7:37 PM
kib edited edge metadata.
This revision is now accepted and ready to land.Feb 11 2015, 7:49 PM
emaste updated this revision to Diff 3740.

Closed by commit rS278593 (authored by @emaste).