Re: How to get addresses of all code regions in binary?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 29, 2020 at 12:47 AM Kazi Alom <alomk@xxxxxxx> wrote:

> Hi,
>
> I am trying to get labels for what is code and what is data in the .text
> section of an ELF file. The dwarfinfo gives low and high addresses for all
> functions but those bounds include data pointers as well (looking at ARM
> binaries). Is there a way to just get the addresses for code? Or in other
> words, how can I begin to instrument the compiler to somehow output bounds
> on only code?
>

ARM binaries have mapping symbols that mark the boundaries between code and
data.  This is documented in the ARM ABI and is arm specific.  Looks like
they are $a. for ARM code, $t. for thumb code, and $d. for data.  I suggest
checking the ARM ABI docs.  You should be able to use these symbols to
distinguish between code and data.  I think the objdump disassembler uses
them for instance.  This is a problem on ARM because you can have a
constant pool in the middle of a function.  Most other major targets don't
do that, and hence don't have this problem.

Jim



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux