This is an archive of the discontinued LLVM Phabricator instance.

Avoid a gnu readelf warning
AbandonedPublic

Authored by espindola on Dec 10 2017, 12:17 PM.

Details

Summary

This avoids a readelf warning, matches bfd ld and should be harmless.

Diff Detail

Event Timeline

rafael created this revision.Dec 10 2017, 12:17 PM
emaste added inline comments.Dec 10 2017, 5:59 PM
ELF/SyntheticSections.cpp
1233

Why .got.plt and not .plt?

grimar added a subscriber: grimar.Dec 11 2017, 4:29 AM
grimar added inline comments.
ELF/SyntheticSections.cpp
1233

Do we really want to care about readelf warnings about something that is not in ELF spec (I assume it is not) ? While it is not a error... may be we can just ignore it ?

ruiu added inline comments.Dec 11 2017, 10:51 AM
ELF/SyntheticSections.cpp
1233

I think I feel the same as George. Is this an issue?

Can you always set or always not set Info?

emaste added inline comments.Dec 11 2017, 5:31 PM
ELF/SyntheticSections.cpp
1233

Ah, I believe I observed (older) ld.bfd storing .plt's section in .rela.plt Info, but testing now with ld.bfd 2.28 I get behaviour as expected from this patch:

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
...
  [ 9] .rela.plt         RELA             00000000004003b8  000003b8
       0000000000000060  0000000000000018  AI       5    21     8
...
  [21] .got.plt          PROGBITS         00000000006009f0  000009f0
       0000000000000038  0000000000000008  WA       0     0     8
ruiu edited edge metadata.Dec 11 2017, 8:31 PM

It looks a bit of cargo-cult, and I think I'm not very happy about this change. If it is not too annoying, I wouldn't do this at least right now.

FWIW our standard readelf in FreeBSD comes from the ELF Tool Chain project and doesn't have the warning. It's only when the GNU readelf package is installed that we'd encounter this.

Overall I'm indifferent to this change going in.

dim added a comment.Dec 19 2017, 10:33 AM

Let's indeed drop this, since upstream readelf has been fixed.

espindola commandeered this revision.Mar 6 2018, 5:17 PM
espindola added a reviewer: rafael.
espindola abandoned this revision.Mar 6 2018, 5:17 PM

Fixed in upstream gnu readelf.