[backfire] mklibs: merge r31259
[openwrt-10.03/.git] / tools / mklibs / patches / 005-readelf_fixes.patch
1 --- a/src/mklibs-readelf/main.cpp
2 +++ b/src/mklibs-readelf/main.cpp
3 @@ -57,6 +57,10 @@ static void process_elf_header (Elf::fil
4  static void process_dynamics (Elf::file *file, int64_t tag)
5  {
6    const Elf::section_type<Elf::section_type_DYNAMIC> *section = file->get_section_DYNAMIC ();
7 +
8 +  if (!section)
9 +    return;
10 +
11    for (std::vector<Elf::dynamic *>::const_iterator it = section->get_dynamics ().begin (); it != section->get_dynamics ().end (); ++it)
12    {
13      Elf::dynamic *dynamic = *it;
14 @@ -67,6 +71,9 @@ static void process_dynamics (Elf::file
15  
16  static void process_symbols_provided (const Elf::section_type<Elf::section_type_DYNSYM> *section)
17  {
18 +  if (!section)
19 +    return;
20 +
21    for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it)
22    {
23      const Elf::symbol *symbol = *it;
24 @@ -95,6 +102,9 @@ static void process_symbols_provided (co
25  
26  static void process_symbols_undefined (const Elf::section_type<Elf::section_type_DYNSYM> *section)
27  {
28 +  if (!section)
29 +    return;
30 +
31    for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it)
32    {
33      const Elf::symbol *symbol = *it;