This is an archive of the discontinued LLVM Phabricator instance.

[elfabi] Fix a bug when elfabi is supplied with a tbe file contains no non-local symbol.
ClosedPublic

Authored by haowei on Feb 17 2021, 8:30 PM.

Details

Summary

Before this patch, elfabi wrote 0 to sh_info of the .dynsym section when it is supplied with a tbe file contains no non-local symbol, making the ELF stub file invalid. This patch fixed this issue.

Diff Detail

Event Timeline

haowei created this revision.Feb 17 2021, 8:30 PM
haowei requested review of this revision.Feb 17 2021, 8:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2021, 8:30 PM

an empty symbol table

It is not empty. It contains exactly one entry, a local symbol with index 0.

llvm/lib/InterfaceStub/ELFObjHandler.cpp
306–309

// The number of local symbols, which is exactly 1 (the undefined symbol at index 0)

haowei updated this revision to Diff 324514.Feb 17 2021, 9:14 PM
haowei edited the summary of this revision. (Show Details)
haowei retitled this revision from [elfabi] Fix a bug when elfabi is supplied with an empty symbol table to [elfabi] Fix a bug when elfabi is supplied with an tbe file contains no non-local symbol..
haowei retitled this revision from [elfabi] Fix a bug when elfabi is supplied with an tbe file contains no non-local symbol. to [elfabi] Fix a bug when elfabi is supplied with a tbe file contains no non-local symbol..
haowei updated this revision to Diff 324518.Feb 17 2021, 9:19 PM
haowei edited the summary of this revision. (Show Details)
haowei marked an inline comment as done.EditedFeb 17 2021, 9:22 PM

an empty symbol table

It is not empty. It contains exactly one entry, a local symbol with index 0.

What I mean is that the Symbol section in the yaml tbe file is empty. But I think it is confusing to use the term empty symbol table here. I changed the description to make it more precise.

phosek accepted this revision.Feb 18 2021, 2:13 PM

LGTM

This revision is now accepted and ready to land.Feb 18 2021, 2:13 PM