[PATCH] symtab-reader: Setup aliases before checking ppc64 opd function entries

Mark Wielaard mark@klomp.org
Sun May 1 22:16:47 GMT 2022


The update_function_entry_address_symbol_map function checks whether
the given symbol is an alias of another symbol or a special ppc64
ELFv1 function entry symbol. This requires the symbol aliases to
already been setup. But the alias entries were only setup after
calling update_function_entry_address_symbol_map. Make sure that
the symbol aliases have been setup and only then call the special
ppc64 update_function_entry_address_symbol_map function. But make
sure the arm32 function symbol entry address cleanup is done before
checking for aliases.

This fixes runtestslowselfcompare.sh on ppc64 (ELFv1) with
ENABLE_SLOW_TEST=yes

	* src/abg-symtab-reader.cc (symtab::load_): Call
	update_function_entry_address_symbol_map after setting
	up aliases.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 src/abg-symtab-reader.cc | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/abg-symtab-reader.cc b/src/abg-symtab-reader.cc
index b42ce87..0f7ace9 100644
--- a/src/abg-symtab-reader.cc
+++ b/src/abg-symtab-reader.cc
@@ -352,16 +352,13 @@ symtab::load_(Elf*	       elf_handle,
 								    sym);
 
 	  // See also symtab::add_alternative_address_lookups.
-	  if (symbol_sptr->is_function())
+	  // Note, do this before setting up aliases
+	  if (symbol_sptr->is_function() && is_arm32)
 	    {
-	      if (is_arm32)
-		// Clear bit zero of ARM32 addresses as per "ELF for the Arm
-		// Architecture" section 5.5.3.
-		// https://static.docs.arm.com/ihi0044/g/aaelf32.pdf
-		symbol_value &= ~1;
-	      else if (is_ppc64)
-		update_function_entry_address_symbol_map(elf_handle, sym,
-							 symbol_sptr);
+	      // Clear bit zero of ARM32 addresses as per "ELF for the Arm
+	      // Architecture" section 5.5.3.
+	      // https://static.docs.arm.com/ihi0044/g/aaelf32.pdf
+	      symbol_value &= ~1;
 	    }
 
 	  const auto result =
@@ -371,6 +368,14 @@ symtab::load_(Elf*	       elf_handle,
 	    // means this symbol is an alias of the main symbol with
 	    // that address.  So let's register this new alias as such.
 	    result.first->second->get_main_symbol()->add_alias(symbol_sptr);
+
+	  // See also symtab::add_alternative_address_lookups.
+	  // Note, do this after setting up aliases.
+	  if (symbol_sptr->is_function() && is_ppc64)
+	    {
+	      update_function_entry_address_symbol_map(elf_handle, sym,
+						       symbol_sptr);
+	    }
 	}
     }
 
-- 
1.8.3.1



More information about the Libabigail mailing list