I really could use some help on this issue.
After examining the build logs of both DragonFlyBSD and NetBSD, I
noticed an interesting difference between the binutils of each system.
DBSD assembler supports .weakref
NBSD assembler does not.
When reading symbols of env.o (comes from gcc/ada/env.c), there is a
weak symbol there
35: 0000000000000000 8 OBJECT WEAK HIDDEN 20
DW.ref.__gcc_personality_
unwind-c.c defines PERSONALITY_FUNCTION as __gcc_personality_v0
libgcc/config/i386/morestack.S mentions the same along with
DW.ref.__gcc_personality_v0
Could the inability of NetBSD assembler support .weakref be the
explanation for the unwind symbols to be marked as hidden on the gnat1
executable even though they are marked as global on their individual
object files?
Thanks, I'm a bit over my head on this topic.
John
On 1/13/2011 8:12 AM, John Marino wrote:
I've successfully built the GNAT front-end of gcc 4.6 on several BSD
platforms. The NetBSD versions (i386 and AMD64) have a problem that I
can't figure out, and I suspect it can be fixed with a change to the
build configuration.
Although NetBSD passes its regression tests cleanly, there are some
dwarf2 functions it doesn't seem to recognize. When I listed hidden
symbols embedded in a pre-stripped gnat1 executable, here is the result:
> readelf -s gnat1 | grep HIDDEN
19135: 0000000000fc68c0 389 FUNC LOCAL HIDDEN 11
_Unwind_Find_FDE
19136: 0000000000fc4dc0 21 FUNC LOCAL HIDDEN 11
_Unwind_GetIPInfo
19137: 0000000000fc4db0 8 FUNC LOCAL HIDDEN 11 _Unwind_GetIP
19138: 0000000000fc66a0 38 FUNC LOCAL HIDDEN 11
__register_frame
19139: 0000000000fc52b0 241 FUNC LOCAL HIDDEN 11
_Unwind_Resume_or_Rethrow
19140: 0000000000fc4e00 8 FUNC LOCAL HIDDEN 11
_Unwind_GetRegionStart
19141: 0000000000fc53d0 155 FUNC LOCAL HIDDEN 11
_Unwind_Backtrace
19142: 0000000001299720 256 OBJECT LOCAL HIDDEN 13 __popcount_tab
19143: 0000000000fc4d50 8 FUNC LOCAL HIDDEN 11 _Unwind_GetCFA
19144: 00000000014b8820 0 OBJECT LOCAL HIDDEN 17 __DTOR_END__
19145: 00000000014b9168 0 OBJECT LOCAL HIDDEN 22 __dso_handle
19146: 0000000000fc4e60 269 FUNC LOCAL HIDDEN 11
__frame_state_for
19147: 0000000000fc6760 26 FUNC LOCAL HIDDEN 11
__register_frame_table
19148: 0000000000fc6600 130 FUNC LOCAL HIDDEN 11
__register_frame_info_bas
19149: 0000000000fc6880 5 FUNC LOCAL HIDDEN 11
__deregister_frame_info
19150: 0000000000fc51e0 193 FUNC LOCAL HIDDEN 11 _Unwind_Resume
19151: 0000000000fc53b0 26 FUNC LOCAL HIDDEN 11
_Unwind_DeleteException
19152: 0000000000fc6780 256 FUNC LOCAL HIDDEN 11
__deregister_frame_info_b
19153: 0000000000fc4f80 358 FUNC LOCAL HIDDEN 11
_Unwind_RaiseException
19154: 0000000000fc4de0 8 FUNC LOCAL HIDDEN 11 _Unwind_SetIP
19155: 0000000000fc66d0 114 FUNC LOCAL HIDDEN 11
__register_frame_info_tab
19156: 0000000000fc6890 33 FUNC LOCAL HIDDEN 11
__deregister_frame
19157: 0000000000fc4e50 8 FUNC LOCAL HIDDEN 11
_Unwind_GetTextRelBase
19158: 0000000000fc4e10 36 FUNC LOCAL HIDDEN 11
_Unwind_FindEnclosingFunc
19159: 0000000000fc4df0 8 FUNC LOCAL HIDDEN 11
_Unwind_GetLanguageSpecif
19160: 0000000000fc50f0 230 FUNC LOCAL HIDDEN 11
_Unwind_ForcedUnwind
19161: 00000000014b8a28 0 OBJECT LOCAL HIDDEN 21
_GLOBAL_OFFSET_TABLE_
19162: 0000000000fc2bf0 44 FUNC LOCAL HIDDEN 11 __popcountdi2
19163: 0000000000fc4d60 80 FUNC LOCAL HIDDEN 11 _Unwind_SetGR
19164: 0000000000fc4d00 72 FUNC LOCAL HIDDEN 11 _Unwind_GetGR
19165: 0000000000fc4e40 8 FUNC LOCAL HIDDEN 11
_Unwind_GetDataRelBase
19166: 0000000000fc6750 9 FUNC LOCAL HIDDEN 11
__register_frame_info_tab
19167: 0000000000fc6690 9 FUNC LOCAL HIDDEN 11
__register_frame_info
The other BSDs consider these symbols global. For example, here is a
subset of the same symbols taken from a stripped DragonFly BSD gnat1:
419: 0000000000fb10e0 373 FUNC GLOBAL DEFAULT 10
_Unwind_Find_FDE
582: 0000000000fad8f0 21 FUNC GLOBAL DEFAULT 10
_Unwind_GetIPInfo
920: 0000000000fad8e0 8 FUNC GLOBAL DEFAULT 10 _Unwind_GetIP
2116: 0000000000fafb40 235 FUNC GLOBAL DEFAULT 10
_Unwind_Resume_or_Rethrow
2762: 0000000000fad930 8 FUNC GLOBAL DEFAULT 10
_Unwind_GetRegionStart
3171: 0000000000fafc50 155 FUNC GLOBAL DEFAULT 10
_Unwind_Backtrace
4035: 0000000000fad880 8 FUNC GLOBAL DEFAULT 10 _Unwind_GetCFA
9786: 0000000000fafa60 212 FUNC GLOBAL DEFAULT 10 _Unwind_Resume
9841: 0000000000fafc30 21 FUNC GLOBAL DEFAULT 10
_Unwind_DeleteException
12631: 0000000000faf800 359 FUNC GLOBAL DEFAULT 10
_Unwind_RaiseException
13229: 0000000000fad910 8 FUNC GLOBAL DEFAULT 10 _Unwind_SetIP
15888: 0000000000fad980 8 FUNC GLOBAL DEFAULT 10
_Unwind_GetTextRelBase
16508: 0000000000fad940 36 FUNC GLOBAL DEFAULT 10
_Unwind_FindEnclosingFunc
16814: 0000000000fad920 8 FUNC GLOBAL DEFAULT 10
_Unwind_GetLanguageSpecif
17568: 0000000000faf970 230 FUNC GLOBAL DEFAULT 10
_Unwind_ForcedUnwind
18388: 0000000000fad890 75 FUNC GLOBAL DEFAULT 10 _Unwind_SetGR
19462: 0000000000fad830 72 FUNC GLOBAL DEFAULT 10 _Unwind_GetGR
20086: 0000000000fad970 8 FUNC GLOBAL DEFAULT 10
_Unwind_GetDataRelBase
1345: 0000000000fb0ec0 38 FUNC GLOBAL DEFAULT 10
__register_frame
8011: 0000000000fb0f80 26 FUNC GLOBAL DEFAULT 10
__register_frame_table
8532: 0000000000fb0e20 130 FUNC GLOBAL DEFAULT 10
__register_frame_info_bas
14325: 0000000000fb0ef0 114 FUNC GLOBAL DEFAULT 10
__register_frame_info_tab
20736: 0000000000fb0f70 9 FUNC GLOBAL DEFAULT 10
__register_frame_info_tab
20856: 0000000000fb0eb0 9 FUNC GLOBAL DEFAULT 10
__register_frame_info
9544: 0000000000fb10a0 5 FUNC GLOBAL DEFAULT 10
__deregister_frame_info
10772: 0000000000fb0fa0 256 FUNC GLOBAL DEFAULT 10
__deregister_frame_info_b
15277: 0000000000fb10b0 33 FUNC GLOBAL DEFAULT 10
__deregister_frame
3677: 0000000001284260 256 OBJECT GLOBAL DEFAULT 12 __popcount_tab
18046: 0000000000fad460 44 FUNC GLOBAL DEFAULT 10 __popcountdi2
I'm pretty well convinced that the NetBSD symbols should also be
classified as GLOBAL DEFAULT and this explains NetBSD's issue with
functions such as _Unwind_Resume and _Unwind_GetIPInfo. I've gone
over config.gcc and the various NetBSD headers many times, but I don't
see what's causing this or what omission might be causing it.
Can anybody suggest what may be wrong and how to correct it?
Thanks,
John