This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: _bfd_link_section_stabs: hash value weakness
- From: "Paul N. Hilfinger" <hilfingr at otisco dot mckusick dot com>
- To: ian at airs dot com
- Cc: Hilfinger at otisco dot mckusick dot com, binutils at sources dot redhat dot com
- Date: Sun, 15 Sep 2002 03:37:58 -0700
- Subject: Re: _bfd_link_section_stabs: hash value weakness
- References: <200209150754.AAA26116@otisco.McKusick.COM> <m3fzwb3cor.fsf@gossamer.airs.com>
- Reply-to: Hilfinger at otisco dot mckusick dot com
>> I recently encountered a case (on Linux) in which
>> STABS data in several .o files for a certain header file were
>> improperly merged in the executable. That is, the version of the
>> STABS data for one include file from one .o file was removed, and
>> replaced with an EXCL reference to the STABS data for the same include
>> file from another .o file, even though the two versions were not, in
>> fact identical (specifically, the type indices did not quite agree).
>This normally only happens when you're doing something odd, like using
>the same name for two different objects. Can you describe the failure
>in more detail?
Sure. I encountered the problem while debugging a version of GDB.
The include file language.h appears in numerous .o files. I've
appended the "colliding" stabs for language.h from two of the .o
files. I used a simple Emacs script to compute the hash values, and
did indeed get the same value for each. Notice the departure at about
type index 15.
I really don't see anything odd going on in the use of headers. The data
really is supposed to be semantically identical, but a difference in
header file inclusion order gave rise to differing type indices, so
one cannot substitute for the other.
> The idea and the implementation, including the hash function used, are
> taken from Solaris. That's not to say that it couldn't be done
> differently; it's just the explanation for why that particular hash
> function was chosen.
You don't say? Well, is there any bar to substituting a slightly juicier
algorithm? I gather that the particular value fields chosen are arbitrary.
Paul
Here is the STABS data for the colliding files, extracted by objdump.
Version 1:
--------------------------------------------------
10960 BINCL 0 0 0001c7ba 84181 ../../../ada-gdb-5.0-merge/gdb/language.h
10961 LSYM 0 0 00000000 119264 range_mode:T(100,1)=erange_mode_auto:0,range_mode_manual:1,;
10962 LSYM 0 0 00000000 119325 range_check:T(100,2)=erange_check_off:0,range_check_warn:1,\
10963 LSYM 0 0 00000000 84343 range_check_on:2,;
10964 LSYM 0 0 00000000 119386 type_mode:T(100,3)=etype_mode_auto:0,type_mode_manual:1,;
10965 LSYM 0 0 00000000 119444 type_check:T(100,4)=etype_check_off:0,type_check_warn:1,\
10966 LSYM 0 0 00000000 84476 type_check_on:2,;
10967 LSYM 0 0 00000000 119502 case_mode:T(100,5)=ecase_mode_auto:0,case_mode_manual:1,;
10968 LSYM 0 0 00000000 119560 case_sensitivity:T(100,6)=ecase_sensitive_on:0,case_sensitive_off:1,;
10969 LSYM 0 0 00000000 119630 language_format_info:T(100,7)=s16la_format:(9,35),0,32;\
10970 LSYM 0 0 00000000 84676 la_format_prefix:(9,35),32,32;la_format_specifier:(9,35),64,32;\
10971 LSYM 0 0 00000000 84741 la_format_suffix:(9,35),96,32;;
10972 LSYM 0 0 00000000 119687 language_defn:T(98,5)=s144la_name:(9,35),0,32;la_language:(1,2),32,32;\
10973 LSYM 0 0 00000000 119759 la_builtin_type_vector:(100,8)=*(92,5),64,32;la_range_check:(100,2),96,32;\
10974 LSYM 0 0 00000000 119835 la_type_check:(100,4),128,32;la_case_sensitivity:(100,6),160,32;\
10975 LSYM 0 0 00000000 119901 la_parser:(100,9)=*(100,10)=f(0,1),192,32;la_error:(100,11)=*(100,12)=f(0,19),224,32;\
10976 LSYM 0 0 00000000 119988 evaluate_exp:(100,13)=*(100,14)=f(93,5),256,32;la_printchar:(100,15)=*(100,16)=f(0,19),288,32;\
10977 LSYM 0 0 00000000 120084 la_printstr:(100,17)=*(100,18)=f(0,19),320,32;la_emitchar:(100,19)=*(100,20)=f(0,19),352,32;\
10978 LSYM 0 0 00000000 120178 la_fund_type:(100,21)=*(100,22)=f(81,29),384,32;la_print_type:(100,23)=*(100,24)=f(0,19),416,32;\
10979 LSYM 0 0 00000000 120276 la_val_print:(100,25)=*(100,26)=f(0,1),448,32;la_value_print:(100,27)=*(100,28)=f(0,1),480,32;\
10980 LSYM 0 0 00000000 120372 la_binary_format:(100,7),512,128;la_octal_format:(100,7),640,128;\
10981 LSYM 0 0 00000000 120439 la_decimal_format:(100,7),768,128;la_hex_format:(100,7),896,128;\
10982 LSYM 0 0 00000000 120505 la_op_print_tab:(100,29)=*(100,30)=xsop_print:,1024,32;c_style_arrays:(0,2),1056,8;\
10983 LSYM 0 0 00000000 120590 string_lower_bound:(0,2),1064,8;string_char_type:(92,5),1088,32;\
10984 LSYM 0 0 00000000 85741 la_magic:(0,3),1120,32;;
10985 LSYM 0 0 00000000 120656 language_mode:T(100,31)=elanguage_mode_auto:0,language_mode_manual:1,;
10986 EINCL 0 0 00000000 0
--------------------------------------------------
Version 2:
--------------------------------------------------
1465 BINCL 0 0 00000000 73035 ../../../ada-gdb-5.0-merge/gdb/language.h
1466 LSYM 0 0 00000000 73077 range_mode:T(108,1)=erange_mode_auto:0,range_mode_manual:1,;
1467 LSYM 0 0 00000000 73138 range_check:T(108,2)=erange_check_off:0,range_check_warn:1,\
1468 LSYM 0 0 00000000 73199 range_check_on:2,;
1469 LSYM 0 0 00000000 73218 type_mode:T(108,3)=etype_mode_auto:0,type_mode_manual:1,;
1470 LSYM 0 0 00000000 73276 type_check:T(108,4)=etype_check_off:0,type_check_warn:1,\
1471 LSYM 0 0 00000000 73334 type_check_on:2,;
1472 LSYM 0 0 00000000 73352 case_mode:T(108,5)=ecase_mode_auto:0,case_mode_manual:1,;
1473 LSYM 0 0 00000000 73410 case_sensitivity:T(108,6)=ecase_sensitive_on:0,case_sensitive_off:1,;
1474 LSYM 0 0 00000000 73480 language_format_info:T(108,7)=s16la_format:(7,35),0,32;\
1475 LSYM 0 0 00000000 73537 la_format_prefix:(7,35),32,32;la_format_specifier:(7,35),64,32;\
1476 LSYM 0 0 00000000 73602 la_format_suffix:(7,35),96,32;;
1477 LSYM 0 0 00000000 73634 language_defn:T(103,7)=s144la_name:(7,35),0,32;la_language:(24,2),32,32;\
1478 LSYM 0 0 00000000 73708 la_builtin_type_vector:(108,8)=*(99,5),64,32;la_range_check:(108,2),96,32;\
1479 LSYM 0 0 00000000 73784 la_type_check:(108,4),128,32;la_case_sensitivity:(108,6),160,32;\
1480 LSYM 0 0 00000000 73850 la_parser:(108,9)=*(108,10)=f(0,1),192,32;la_error:(108,11)=*(108,12)=f(0,19),224,32;\
1481 LSYM 0 0 00000000 73937 evaluate_exp:(108,13)=*(108,14)=f(108,15)=*(108,16)=xsvalue:,256,32;la_printchar:(108,17)=*(108,18)=f(0,19),288,32;\
1482 LSYM 0 0 00000000 74054 la_printstr:(108,19)=*(108,20)=f(0,19),320,32;la_emitchar:(108,21)=*(108,22)=f(0,19),352,32;\
1483 LSYM 0 0 00000000 74148 la_fund_type:(108,23)=*(108,24)=f(86,29),384,32;la_print_type:(108,25)=*(108,26)=f(0,19),416,32;\
1484 LSYM 0 0 00000000 74246 la_val_print:(108,27)=*(108,28)=f(0,1),448,32;la_value_print:(108,29)=*(108,30)=f(0,1),480,32;\
1485 LSYM 0 0 00000000 74342 la_binary_format:(108,7),512,128;la_octal_format:(108,7),640,128;\
1486 LSYM 0 0 00000000 74409 la_decimal_format:(108,7),768,128;la_hex_format:(108,7),896,128;\
1487 LSYM 0 0 00000000 74475 la_op_print_tab:(108,31)=*(107,8),1024,32;c_style_arrays:(0,2),1056,8;\
1488 LSYM 0 0 00000000 74547 string_lower_bound:(0,2),1064,8;string_char_type:(99,5),1088,32;\
1489 LSYM 0 0 00000000 74613 la_magic:(0,3),1120,32;;
1490 LSYM 0 0 00000000 74638 language_mode:T(108,32)=elanguage_mode_auto:0,language_mode_manual:1,;
1491 EINCL 0 0 00000000 0
--------------------------------------------------