[applied] Bug 29692 - Support binaries with empty symbol table
Commit Message
Hello,
Some binaries can have a symbol table in which no symbol is actually
defined and exported. That binary would thus have an empty ABI
corpus.
Interestingly, Libabigail's DWARF reader is emits an error when
it encounters such binaries.
This patch adds the support for those binaries.
* src/abg-dwarf-reader.cc (reader::read_debug_info_into_corpus):
Get out early also upon having an empty symbol table.
* src/abg-elf-reader.cc (reader::read_corpus): Error out only if
there is no symbol table for the binary. If an empty symbol table
is found however, that is not an error.
* tests/data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0:
New binary test input.
* tests/data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0.abi:
New expected abixml file.
* tests/data/Makefile.am: Add the new input test files to source
distribution.
* tests/test-read-dwarf.cc (in_out_specs): Add the new test inputs
above to this test harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
src/abg-dwarf-reader.cc | 6 ++++--
src/abg-elf-reader.cc | 7 +++++--
tests/data/Makefile.am | 2 ++
.../PR29692-kdelibs3-libkjava.so.1.0.0 | Bin 0 -> 15048 bytes
.../PR29692-kdelibs3-libkjava.so.1.0.0.abi | 2 ++
tests/test-read-dwarf.cc | 9 +++++++++
6 files changed, 22 insertions(+), 4 deletions(-)
create mode 100755 tests/data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0
create mode 100644 tests/data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0.abi
new file mode 100644
index 00000000..e2b3e145
@@ -2130,8 +2130,10 @@ public:
// Set symbols information to the corpus.
corpus()->set_symtab(symtab());
- // Get out now if no debug info is found.
- if (!dwarf_debug_info())
+ // Get out now if no debug info is found or if the symbol table is
+ // empty.
+ if (!dwarf_debug_info()
+ || !corpus()->get_symtab()->has_symbols())
return corpus();
uint8_t address_size = 0;
@@ -958,10 +958,13 @@ reader::read_corpus(status& status)
corpus()->set_architecture_name(elf_architecture());
// See if we could find symbol tables.
- if (!symtab() || !symtab()->has_symbols())
+ if (!symtab())
{
status |= STATUS_NO_SYMBOLS_FOUND;
- // We found no ELF symbol, so we can't handle the binary.
+ // We found no ELF symbol, so we can't handle the binary. Note
+ // that we could have found a symbol table with no defined &
+ // exported ELF symbols in it. That case is handled as an empty
+ // corpus, which is different from this case.
return corpus_sptr();
}
@@ -666,6 +666,8 @@ test-read-dwarf/PR29443-missing-xx.o.abi \
test-read-dwarf/test-fallback.abi \
test-read-dwarf/test-fallback.c \
test-read-dwarf/test-fallback.o \
+test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0 \
+test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0.abi \
\
test-read-ctf/test0 \
test-read-ctf/test0.abi \
new file mode 100755
GIT binary patch
literal 15048
zcmeHOdr%Zd8t+BPA*_ODLU^f&kC-R}hzKX5XcU$hHBo$4bRF1XcV*cny94r4jO*p_
z2#=UtjNlssKB9#=Onh7}#1IpF1Vz+nRTN^#38DxhNAzT`d!|2J=dhAW-5*KSbQSZ>
z_xOGN^{;2AhpO)E881gUC=>`<A2b;~(h!QIj-2rjL2O~j8DBk-hY;KMk?Vi%Mmvfo
zkjPEcNgslX>R<=yNs9mpc48L#^A+<TiG*4}+T)(WkS>1_*A?-&baD`NH!1-~RDyG3
zsDJX~vYgfl(n)j+HIf>VX+Eipq;VjnxN?e<$_k1D3FDmC$ZLL0f3IR38Q(8$FkN$L
ze?P}3@JeYCcnQRvk-3kaJs;s=R+75=&;k@lA?OhAKy~UC@K4itf-gL@sjRu_y@mzW
z{R<|C|6@U&!Y!QSTZ8{rdv%|Tnmz|*`tj+>oZm!0b8?d3SU)41M3h7gXVAx4g0Ur)
zGh6f~BQ^#zAxu!9e^5{;lMo*qihZm(UZ>}|cs|8UP-$Tk)Dy;IyUFsRkTX7+n;2l4
zn80aFW;WSuT7g5UHW4RSh3g=Vj0gS%!!Nu<;W*!3V#hwgPUfe#c+z)ocBEEolT1dn
zg=fvYT8-2(v9r_~&dh1`7M?T5&U(>cGIFtOoPiU4y?fO0X{<UyZ)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F063kPioh87CzEisV>>zk+{v>4xz
zP{70b334|Ll-3XZll%lfjmE)x3=-l9eh~hX)}MrJq^6#;OtAh@3Ew3+L}*g}b=Yc;
z_ocWVNpT<~>5)Z(kE8)0A^u7DED8P<3IKTofK*EJt(D+meFh2NZIDJf{v3*j`9r=m
zl1gbj@K2-A27E)l9pO6%z6aram^2=AkXtd<)eaBmf)G7-2XQz=XrP1Ki>+k-pno_o
z<n%LmF&jdk;2ZMn03N=p;M^aa?}O(H`h|I@#8~_O;rp|aY)8Z`Qn)_403PI**hTK4
z{~kb~h=DlBK>D(8C$R$GuEg%NoLq6Ec$KL2T&43_k3G_yBv?i9<B4L|r1)0s>kXep
c@yecoiAkifM3;mJfjPlqe77iiu2TGe0pDE}uK)l5
literal 0
HcmV?d00001
@@ -0,0 +1,2 @@
+<abi-corpus version='2.1' soname='libkjava.so.1'>
+</abi-corpus>
@@ -550,6 +550,15 @@ static InOutSpec in_out_specs[] =
"output/test-read-dwarf/PR29443-missing-xx.o.abi",
NULL,
},
+ {
+ "data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0",
+ "",
+ "",
+ SEQUENCE_TYPE_ID_STYLE,
+ "data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0.abi",
+ "output/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.0.0.abi",
+ NULL,
+ },
// DWARF fallback feature.
{
"data/test-read-dwarf/test-fallback.o",