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

Re: [MiNT] MiNTlib assembly labels naming?



Hi,

On sunnuntai 07 huhtikuu 2013, Andreas Schwab wrote:
> Eero Tamminen <oak@helsinkinet.fi> writes:
> > When looking at symbols which occur several times in MiNTlib,
> > "exit" is found from 3 different places:
>
> There is nothing wrong with local symbols appearing in multiple object,
> they are local after all.

>From linking perspective, sure.  My mail was more from the debugging
perspective.

If my program would also have local symbol named "exit", would it depend
in which order I had linked the object files and libraries on what symbol
Gdb matches?

(The main problem is that Gdb doesn't tell that there are several
possible matches, it just "randomly" chooses one.)


While e.g. Glibc on Linux seems to be pretty liberal with generic
names too [1], shared libaries alleviate this issue as Gdb searches
for symbols first from already loaded binaries.

If nobody else is "concerned" about this, I'll forget it. :-)


	- Eero

[1]
$ for i in FUNC OBJECT; do
	echo "$i:";
	readelf -s /usr/lib/debug/lib/libc-2.11.3.so |\
	  awk '/ '$i' / {print $8}' | sort | uniq -c | sort -nr | head -8;
	echo "..."
done
FUNC:
     16 _L_lock_23
     15 _L_unlock_87
     15 free_mem
     12 _L_lock_37
     12 _L_lock_36
     12 _L_lock_24
     11 _L_lock_20
      8 _L_unlock_40
...
OBJECT:
     59 lock
     37 buffer
     28 __elf_set___libc_subfreer
     10 startp
     10 nip
     10 last_nip
      7 state
      6 __evoke_link_warning_inet
...