This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - R_386_GOT32 relocation calculation fix.
ClosedPublic

Authored by grimar on Dec 23 2015, 7:24 AM.

Details

Summary

R_386_GOT32 has multiple descriptions:

  1. "System V Application Binary Interface Intel386 Architecture Processor Supplement Version 1.1" (https://github.com/hjl-tools/x86-psABI/wiki/intel386-psABI-1.1.pdf), p36 contains next calculation for R_386_GOT32: G + A - GOT.
  2. SYSTEM V APPLICATION BINARY INTERFACE 4 (https://refspecs.linuxfoundation.org/elf/abi386-4.pdf, p78) tolds us its G + A - P.
  3. Oracle docs (https://docs.oracle.com/cd/E19455-01/816-0559/chapter6-26/index.html) says its should be G + A.
  4. gold/bfd calculates it as (gotentryaddr - gotsize + A), so it is some negative offset.

Patch implements gold/bfs behavior to be consistent with.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 43537.Dec 23 2015, 7:24 AM
grimar retitled this revision from to [ELF] - R_386_GOT32 relocation calculation fix..
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
emaste added a subscriber: emaste.Dec 23 2015, 7:36 AM
rafael accepted this revision.Jan 18 2016, 7:32 AM
rafael edited edge metadata.

LGTM

ELF/Target.cpp
392 ↗(On Diff #43537)

In other words, it is "G + A - GOT", but GOT means the end of the GOT section.

This revision is now accepted and ready to land.Jan 18 2016, 7:32 AM

LGTM

Thanks for review !

This revision was automatically updated to reflect the committed changes.