diff mbox series

DWARF reader: Comment ARM32 ELF address interpretation

Message ID 20210310122254.2860952-1-gprocida@google.com
State New
Headers show
Series DWARF reader: Comment ARM32 ELF address interpretation | expand

Commit Message

Giuliano Procida March 10, 2021, 12:22 p.m. UTC
Bug 27552 - libabigail needs to interpret ARM32 symbol addresses specially

The previous commit omitted any code commentary. This adds a link to
the relevant reference. The code is shortened slightly as well.

	* src/abg-dwarf-reader.cc
	(read_context::load_symbol_maps_from_symtab_section): Add
	descriptive comment to ARM32 address handling; shorten
	the assignment using &=.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-dwarf-reader.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Dodji Seketeli March 11, 2021, 9:11 a.m. UTC | #1
Giuliano Procida <gprocida@google.com> a écrit:

> Bug 27552 - libabigail needs to interpret ARM32 symbol addresses specially
>
> The previous commit omitted any code commentary. This adds a link to
> the relevant reference. The code is shortened slightly as well.
>
> 	* src/abg-dwarf-reader.cc
> 	(read_context::load_symbol_maps_from_symtab_section): Add
> 	descriptive comment to ARM32 address handling; shorten
> 	the assignment using &=.
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>

Applied to master, thanks.

Cheers,
Mark Wielaard March 11, 2021, 5:16 p.m. UTC | #2
Hi,

On Wed, 2021-03-10 at 12:22 +0000, Giuliano Procida wrote:
> Bug 27552 - libabigail needs to interpret ARM32 symbol addresses
> specially

BTW. I tried to get this correct for elfutils when using the libdwfl
dwfl_module_addrsym and dwfl_module_addrinfo functions:
https://sourceware.org/bugzilla/show_bug.cgi?id=27564
Has a proposed patch that needs a bit more testing (and maybe a tweak).

libabigail doesn't use these functions, but one benefit of them is that
they also handle the case of ppc function descriptors (that is old
style ppc32 and ppc64be).

Cheers,

Mark
Giuliano Procida March 12, 2021, 9:39 a.m. UTC | #3
Hi.

On Thu, 11 Mar 2021 at 17:16, Mark Wielaard <mark@klomp.org> wrote:

> Hi,
>
> On Wed, 2021-03-10 at 12:22 +0000, Giuliano Procida wrote:
> > Bug 27552 - libabigail needs to interpret ARM32 symbol addresses
> > specially
>
> BTW. I tried to get this correct for elfutils when using the libdwfl
> dwfl_module_addrsym and dwfl_module_addrinfo functions:
> https://sourceware.org/bugzilla/show_bug.cgi?id=27564
> Has a proposed patch that needs a bit more testing (and maybe a tweak).
>
>
Having a library layer that does all the fixups seems a lot better than
having the logic in libabigail.


> libabigail doesn't use these functions, but one benefit of them is that
> they also handle the case of ppc function descriptors (that is old
> style ppc32 and ppc64be).
>
>
Hopefully, they are relatively straightforward to drop in. However,
Matthias has symbol table reader changes still queued up; once these are
done, we can take a look.

libabibgail would become dependent on libdwfl version >= X for correctness,
so we'd need to assert that at compile time.

Thanks,
Giuliano.


> Cheers,
>
> Mark
>
diff mbox series

Patch

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 9a8e7b34..b6b10116 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -6238,7 +6238,10 @@  public:
 							       sym);
 
 		  if (is_arm32)
-		    symbol_value = symbol_value & ~1;
+		    // 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;
 		  addr_elf_symbol_sptr_map_type::const_iterator it =
 		    fun_addr_sym_map_->find(symbol_value);
 		  if (it == fun_addr_sym_map_->end())