Sourceware Bugzilla – Attachment 6162 Details for
Bug 13597
Broken sysv-style hash table when --hash-style=both
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Reorder the output order between .gnu.hash and .hash v2
goldv2.patch (text/plain), 3.04 KB, created by
Kito Cheng
on 2012-01-18 08:41:02 UTC
(
hide
)
Description:
Reorder the output order between .gnu.hash and .hash v2
Filename:
MIME Type:
Creator:
Kito Cheng
Created:
2012-01-18 08:41:02 UTC
Size:
3.04 KB
patch
obsolete
>Index: layout.cc >=================================================================== >RCS file: /cvs/src/src/gold/layout.cc,v >retrieving revision 1.222 >diff -u -p -r1.222 layout.cc >--- layout.cc 19 Oct 2011 15:05:58 -0000 1.222 >+++ layout.cc 18 Jan 2012 08:40:13 -0000 >@@ -3831,17 +3831,22 @@ Layout::create_dynamic_symtab(const Inpu > } > > // Create the hash tables. >+ // >+ // Create GNU-sytle hash table first since string table index will change >+ // during creating GNU-sytle hash table. It's will break the SysV-sytle >+ // hash table since SysV-style hash table contain out-of-date string >+ // table index. > >- if (strcmp(parameters->options().hash_style(), "sysv") == 0 >+ if (strcmp(parameters->options().hash_style(), "gnu") == 0 > || strcmp(parameters->options().hash_style(), "both") == 0) > { > unsigned char* phash; > unsigned int hashlen; >- Dynobj::create_elf_hash_table(*pdynamic_symbols, local_symcount, >+ Dynobj::create_gnu_hash_table(*pdynamic_symbols, local_symcount, > &phash, &hashlen); > > Output_section* hashsec = >- this->choose_output_section(NULL, ".hash", elfcpp::SHT_HASH, >+ this->choose_output_section(NULL, ".gnu.hash", elfcpp::SHT_GNU_HASH, > elfcpp::SHF_ALLOC, false, > ORDER_DYNAMIC_LINKER, false); > >@@ -3856,23 +3861,28 @@ Layout::create_dynamic_symtab(const Inpu > { > if (dynsym != NULL) > hashsec->set_link_section(dynsym); >- hashsec->set_entsize(4); >- } > >- if (odyn != NULL) >- odyn->add_section_address(elfcpp::DT_HASH, hashsec); >+ // For a 64-bit target, the entries in .gnu.hash do not have >+ // a uniform size, so we only set the entry size for a >+ // 32-bit target. >+ if (parameters->target().get_size() == 32) >+ hashsec->set_entsize(4); >+ >+ if (odyn != NULL) >+ odyn->add_section_address(elfcpp::DT_GNU_HASH, hashsec); >+ } > } > >- if (strcmp(parameters->options().hash_style(), "gnu") == 0 >+ if (strcmp(parameters->options().hash_style(), "sysv") == 0 > || strcmp(parameters->options().hash_style(), "both") == 0) > { > unsigned char* phash; > unsigned int hashlen; >- Dynobj::create_gnu_hash_table(*pdynamic_symbols, local_symcount, >+ Dynobj::create_elf_hash_table(*pdynamic_symbols, local_symcount, > &phash, &hashlen); > > Output_section* hashsec = >- this->choose_output_section(NULL, ".gnu.hash", elfcpp::SHT_GNU_HASH, >+ this->choose_output_section(NULL, ".hash", elfcpp::SHT_HASH, > elfcpp::SHF_ALLOC, false, > ORDER_DYNAMIC_LINKER, false); > >@@ -3887,16 +3897,11 @@ Layout::create_dynamic_symtab(const Inpu > { > if (dynsym != NULL) > hashsec->set_link_section(dynsym); >- >- // For a 64-bit target, the entries in .gnu.hash do not have >- // a uniform size, so we only set the entry size for a >- // 32-bit target. >- if (parameters->target().get_size() == 32) >- hashsec->set_entsize(4); >- >- if (odyn != NULL) >- odyn->add_section_address(elfcpp::DT_GNU_HASH, hashsec); >+ hashsec->set_entsize(4); > } >+ >+ if (odyn != NULL) >+ odyn->add_section_address(elfcpp::DT_HASH, hashsec); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 13597
:
6159
|
6161
| 6162