Odd function address in function instrumentation routines on ARM

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

 



Hello,

I am working on performance analysis tools. For instrumenting applications we use the compiler instrumentation flags
-finstrument-functions. The inserted function calls to __cyg_profile_func_enter and __cyg_profile_func_exit normally provide a function
pointer. With libbfd we lookup debug information for this function using this address. This worked fine for many years on different machines,

Recently, I tried to port our code to an ARM architecture (dual Cortex A9 processor)
running Ubuntu. Here, I discovered that the function addresses that are passed to
__cyg_profile_func_enter and __cyg_profile_func_exit do not match the address of the function that we get from libbfd. Although the difference might be caused
by libbfd or in the way we interface libbfd, I am wondering that __cyg_profile_func_enter
and __cyg_profile_func_exit provide odd function addresses, even if I specify -falign-functions=4.

I appended a small test case that shows the addresses that we get from function instrumentation and from libbfd. The output on the ARM
system looks like this:

Function: foo, Address: 34960
Function: main, Address: 35008
In __cyg_profile_func_enter. Function address: 35009
In __cyg_profile_func_enter. Function address: 34961
in foo
In __cyg_profile_func_exit. Function address: 34961
In __cyg_profile_func_exit. Function address: 35009

I tested it on two different machines:
1. dual-core ARM Cortex-A9 Tegar2 SoC with gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5, and
2. Snowball – Cortex A9 board, Nova A9500 dual Cortex A9 with gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1.
I performed several builds and test runs and it seems that the address difference is always 1.

Is the function adress passed to __cyg_profile_func_enter and __cyg_profile_func_exit intenionally odd on ARM,
even when specifing -falign-function=4?

Best Regards,
Daniel Lorenz

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------

Kennen Sie schon unsere app? http://www.fz-juelich.de/app



[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