This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] - Teach llvm-readobj to dump .gnu.version_r sections
ClosedPublic

Authored by grimar on Jun 6 2016, 8:53 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 59734.Jun 6 2016, 8:53 AM
grimar retitled this revision from to [llvm-readobj] - Teach llvm-readobj to dump .gnu.version_r sections.
grimar updated this object.
grimar added reviewers: rafael, davide.
grimar added subscribers: llvm-commits, grimar.
rafael accepted this revision.Jun 6 2016, 2:01 PM
rafael edited edge metadata.

LGTM with nits.

tools/llvm-readobj/ELFDumper.cpp
583 ↗(On Diff #59734)

I don't think this should print Name/Address/Offset/Link. They are available from -s.

603 ↗(On Diff #59734)

Not sure we need to print vn_cnt, since we print vn_cnt entries.

604 ↗(On Diff #59734)

FileName maybe?

613 ↗(On Diff #59734)

Don't we want to expand this into an enum?

This revision is now accepted and ready to land.Jun 6 2016, 2:01 PM
davide edited edge metadata.Jun 6 2016, 2:10 PM

This looks fine after Rafael's comments are addressed.
I don't like "Version needs". Can we just use the original section name "SHT_GNU_verneed", which is more understandable and also maps 1:1 with the "spec"[1]? Rafael?

[1] When I say the spec I mean Drepper's document on versioning https://www.akkadia.org/drepper/symbol-versioning

This revision was automatically updated to reflect the committed changes.
grimar added a comment.Jun 7 2016, 4:20 AM

Rafael, Davide, thanks for review !

tools/llvm-readobj/ELFDumper.cpp
583 ↗(On Diff #59734)

Removed.

603 ↗(On Diff #59734)

I would leave it. There can be lots of vn_aux and it can be reasonable to print the amount to know that value for possible testcases. Counting them all manually can be a problem.

604 ↗(On Diff #59734)

Done.

613 ↗(On Diff #59734)

Done. Btw according to gold sources I have, it is always 0 currently:

  for (p = this->need_versions_.begin(), i = 0;
       p != this->need_versions_.end();
       ++p, ++i)
    {
      elfcpp::Vernaux_write<size, big_endian> vna(pb);
      vna.set_vna_hash(Dynobj::elf_hash((*p)->version()));
      // FIXME: We need to sometimes set VER_FLG_WEAK here.
      vna.set_vna_flags(0);
      vna.set_vna_other((*p)->index());
      vna.set_vna_name(dynpool->get_offset((*p)->version()));
      vna.set_vna_next(i + 1 >= this->need_versions_.size()
		       ? 0
		       : vernaux_size);
      pb += vernaux_size;
    }

rafael wrote:

Don't we want to expand this into an enum?

Done. Btw according to gold sources I have, it is always 0 currently:

Yes, according to
https://lists.debian.org/lsb-spec/1999/12/msg00017.html only
VER_FLG_WEAK is defined and it is not clear why it is needed.

The entire area around symbol versioning seems over designed and under
documented :-(

Cheers,
Rafael

grimar added a comment.Jun 7 2016, 4:44 AM

Yes, according to
https://lists.debian.org/lsb-spec/1999/12/msg00017.html only
VER_FLG_WEAK is defined and it is not clear why it is needed.

The entire area around symbol versioning seems over designed and under
documented :-(

I have the same opinion here.
I suppose we just want to support minimal required subset in lld.

Cheers,
Rafael