Page MenuHomePhabricator

[libObject,llvm-readelf/obj] - Don't use @@ when printing versions of undefined symbols.
ClosedPublic

Authored by grimar on Jan 22 2021, 3:28 AM.

Details

Summary

A default version (@@) is only available for defined symbols.
Here is a corresponding code from GNU readelf:

  if (sym_info == symbol_undefined)
    printf ("@%s (%d)", version_string, vna_other);
  else
    printf (sym_info == symbol_hidden ? "@%s" : "@@%s",
	    version_string);

Currently we use "@@" for undefined symbols too.
This patch fixes the issue and improves our test case.

Diff Detail

Event Timeline

grimar created this revision.Jan 22 2021, 3:28 AM
grimar requested review of this revision.Jan 22 2021, 3:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2021, 3:28 AM

As noted elsewhere, I'm not really familiar with symbol versioning, so it would be better if @MaskRay looked at this.

llvm/tools/llvm-readobj/ELFDumper.cpp
773–775

Why not return directly as it did before?

grimar updated this revision to Diff 318924.Jan 25 2021, 1:52 AM
grimar marked an inline comment as done.
  • Addressed review comment.

@MaskRay, are you OK with it? D94912 depends on this.

MaskRay accepted this revision.Jan 25 2021, 10:33 AM

Thanks!

This revision is now accepted and ready to land.Jan 25 2021, 10:33 AM