Lines 3831-3847
Layout::create_dynamic_symtab(const Inpu
Link Here
|
3831 |
} |
3831 |
} |
3832 |
|
3832 |
|
3833 |
// Create the hash tables. |
3833 |
// Create the hash tables. |
|
|
3834 |
// |
3835 |
// Create GNU-sytle hash table first since string table index will change |
3836 |
// during creating GNU-sytle hash table. It's will break the SysV-sytle |
3837 |
// hash table since SysV-style hash table contain out-of-date string |
3838 |
// table index. |
3834 |
|
3839 |
|
3835 |
if (strcmp(parameters->options().hash_style(), "sysv") == 0 |
3840 |
if (strcmp(parameters->options().hash_style(), "gnu") == 0 |
3836 |
|| strcmp(parameters->options().hash_style(), "both") == 0) |
3841 |
|| strcmp(parameters->options().hash_style(), "both") == 0) |
3837 |
{ |
3842 |
{ |
3838 |
unsigned char* phash; |
3843 |
unsigned char* phash; |
3839 |
unsigned int hashlen; |
3844 |
unsigned int hashlen; |
3840 |
Dynobj::create_elf_hash_table(*pdynamic_symbols, local_symcount, |
3845 |
Dynobj::create_gnu_hash_table(*pdynamic_symbols, local_symcount, |
3841 |
&phash, &hashlen); |
3846 |
&phash, &hashlen); |
3842 |
|
3847 |
|
3843 |
Output_section* hashsec = |
3848 |
Output_section* hashsec = |
3844 |
this->choose_output_section(NULL, ".hash", elfcpp::SHT_HASH, |
3849 |
this->choose_output_section(NULL, ".gnu.hash", elfcpp::SHT_GNU_HASH, |
3845 |
elfcpp::SHF_ALLOC, false, |
3850 |
elfcpp::SHF_ALLOC, false, |
3846 |
ORDER_DYNAMIC_LINKER, false); |
3851 |
ORDER_DYNAMIC_LINKER, false); |
3847 |
|
3852 |
|
Lines 3856-3878
Layout::create_dynamic_symtab(const Inpu
Link Here
|
3856 |
{ |
3861 |
{ |
3857 |
if (dynsym != NULL) |
3862 |
if (dynsym != NULL) |
3858 |
hashsec->set_link_section(dynsym); |
3863 |
hashsec->set_link_section(dynsym); |
3859 |
hashsec->set_entsize(4); |
|
|
3860 |
} |
3861 |
|
3864 |
|
3862 |
if (odyn != NULL) |
3865 |
// For a 64-bit target, the entries in .gnu.hash do not have |
3863 |
odyn->add_section_address(elfcpp::DT_HASH, hashsec); |
3866 |
// a uniform size, so we only set the entry size for a |
|
|
3867 |
// 32-bit target. |
3868 |
if (parameters->target().get_size() == 32) |
3869 |
hashsec->set_entsize(4); |
3870 |
|
3871 |
if (odyn != NULL) |
3872 |
odyn->add_section_address(elfcpp::DT_GNU_HASH, hashsec); |
3873 |
} |
3864 |
} |
3874 |
} |
3865 |
|
3875 |
|
3866 |
if (strcmp(parameters->options().hash_style(), "gnu") == 0 |
3876 |
if (strcmp(parameters->options().hash_style(), "sysv") == 0 |
3867 |
|| strcmp(parameters->options().hash_style(), "both") == 0) |
3877 |
|| strcmp(parameters->options().hash_style(), "both") == 0) |
3868 |
{ |
3878 |
{ |
3869 |
unsigned char* phash; |
3879 |
unsigned char* phash; |
3870 |
unsigned int hashlen; |
3880 |
unsigned int hashlen; |
3871 |
Dynobj::create_gnu_hash_table(*pdynamic_symbols, local_symcount, |
3881 |
Dynobj::create_elf_hash_table(*pdynamic_symbols, local_symcount, |
3872 |
&phash, &hashlen); |
3882 |
&phash, &hashlen); |
3873 |
|
3883 |
|
3874 |
Output_section* hashsec = |
3884 |
Output_section* hashsec = |
3875 |
this->choose_output_section(NULL, ".gnu.hash", elfcpp::SHT_GNU_HASH, |
3885 |
this->choose_output_section(NULL, ".hash", elfcpp::SHT_HASH, |
3876 |
elfcpp::SHF_ALLOC, false, |
3886 |
elfcpp::SHF_ALLOC, false, |
3877 |
ORDER_DYNAMIC_LINKER, false); |
3887 |
ORDER_DYNAMIC_LINKER, false); |
3878 |
|
3888 |
|
Lines 3887-3902
Layout::create_dynamic_symtab(const Inpu
Link Here
|
3887 |
{ |
3897 |
{ |
3888 |
if (dynsym != NULL) |
3898 |
if (dynsym != NULL) |
3889 |
hashsec->set_link_section(dynsym); |
3899 |
hashsec->set_link_section(dynsym); |
3890 |
|
3900 |
hashsec->set_entsize(4); |
3891 |
// For a 64-bit target, the entries in .gnu.hash do not have |
|
|
3892 |
// a uniform size, so we only set the entry size for a |
3893 |
// 32-bit target. |
3894 |
if (parameters->target().get_size() == 32) |
3895 |
hashsec->set_entsize(4); |
3896 |
|
3897 |
if (odyn != NULL) |
3898 |
odyn->add_section_address(elfcpp::DT_GNU_HASH, hashsec); |
3899 |
} |
3901 |
} |
|
|
3902 |
|
3903 |
if (odyn != NULL) |
3904 |
odyn->add_section_address(elfcpp::DT_HASH, hashsec); |
3900 |
} |
3905 |
} |
3901 |
} |
3906 |
} |
3902 |
|
3907 |
|