GNU Binutils with patches for OS216
Révision | 493f652c956f2037c1c638c1887b634d67da0835 (tree) |
---|---|
l'heure | 2016-04-30 00:27:29 |
Auteur | H.J. Lu <hjl.tools@gmai...> |
Commiter | H.J. Lu |
Set interpreter in x86 create_dynamic_sections
Set interpreter in x86 create_dynamic_sections to make this information
available to x86 check_relocs.
* elf32-i386.c (elf_i386_size_dynamic_sections): Move interp
setting to ...
(elf_i386_create_dynamic_sections): Here.
* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Move
interp setting to ...
(elf_x86_64_create_dynamic_sections): Here.
@@ -1,5 +1,14 @@ | ||
1 | 1 | 2016-04-29 H.J. Lu <hongjiu.lu@intel.com> |
2 | 2 | |
3 | + * elf32-i386.c (elf_i386_size_dynamic_sections): Move interp | |
4 | + setting to ... | |
5 | + (elf_i386_create_dynamic_sections): Here. | |
6 | + * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Move | |
7 | + interp setting to ... | |
8 | + (elf_x86_64_create_dynamic_sections): Here. | |
9 | + | |
10 | +2016-04-29 H.J. Lu <hongjiu.lu@intel.com> | |
11 | + | |
3 | 12 | * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Take GOT_RELOC |
4 | 13 | and replace (EH)->has_got_reloc with GOT_RELOC. |
5 | 14 | (elf_i386_fixup_symbol): Pass has_got_reloc to |
@@ -1066,6 +1066,17 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) | ||
1066 | 1066 | if (htab == NULL) |
1067 | 1067 | return FALSE; |
1068 | 1068 | |
1069 | + /* Set the contents of the .interp section to the interpreter. */ | |
1070 | + if (bfd_link_executable (info) && !info->nointerp) | |
1071 | + { | |
1072 | + asection *s = bfd_get_linker_section (dynobj, ".interp"); | |
1073 | + if (s == NULL) | |
1074 | + abort (); | |
1075 | + s->size = sizeof ELF_DYNAMIC_INTERPRETER; | |
1076 | + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; | |
1077 | + htab->interp = s; | |
1078 | + } | |
1079 | + | |
1069 | 1080 | htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss"); |
1070 | 1081 | if (!htab->sdynbss) |
1071 | 1082 | abort (); |
@@ -3089,20 +3100,6 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) | ||
3089 | 3100 | if (dynobj == NULL) |
3090 | 3101 | abort (); |
3091 | 3102 | |
3092 | - if (htab->elf.dynamic_sections_created) | |
3093 | - { | |
3094 | - /* Set the contents of the .interp section to the interpreter. */ | |
3095 | - if (bfd_link_executable (info) && !info->nointerp) | |
3096 | - { | |
3097 | - s = bfd_get_linker_section (dynobj, ".interp"); | |
3098 | - if (s == NULL) | |
3099 | - abort (); | |
3100 | - s->size = sizeof ELF_DYNAMIC_INTERPRETER; | |
3101 | - s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; | |
3102 | - htab->interp = s; | |
3103 | - } | |
3104 | - } | |
3105 | - | |
3106 | 3103 | /* Set up .got offsets for local syms, and space for local dynamic |
3107 | 3104 | relocs. */ |
3108 | 3105 | for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) |
@@ -1109,6 +1109,17 @@ elf_x86_64_create_dynamic_sections (bfd *dynobj, | ||
1109 | 1109 | if (htab == NULL) |
1110 | 1110 | return FALSE; |
1111 | 1111 | |
1112 | + /* Set the contents of the .interp section to the interpreter. */ | |
1113 | + if (bfd_link_executable (info) && !info->nointerp) | |
1114 | + { | |
1115 | + asection *s = bfd_get_linker_section (dynobj, ".interp"); | |
1116 | + if (s == NULL) | |
1117 | + abort (); | |
1118 | + s->size = htab->dynamic_interpreter_size; | |
1119 | + s->contents = (unsigned char *) htab->dynamic_interpreter; | |
1120 | + htab->interp = s; | |
1121 | + } | |
1122 | + | |
1112 | 1123 | htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss"); |
1113 | 1124 | if (!htab->sdynbss) |
1114 | 1125 | abort (); |
@@ -3446,20 +3457,6 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd, | ||
3446 | 3457 | if (dynobj == NULL) |
3447 | 3458 | abort (); |
3448 | 3459 | |
3449 | - if (htab->elf.dynamic_sections_created) | |
3450 | - { | |
3451 | - /* Set the contents of the .interp section to the interpreter. */ | |
3452 | - if (bfd_link_executable (info) && !info->nointerp) | |
3453 | - { | |
3454 | - s = bfd_get_linker_section (dynobj, ".interp"); | |
3455 | - if (s == NULL) | |
3456 | - abort (); | |
3457 | - s->size = htab->dynamic_interpreter_size; | |
3458 | - s->contents = (unsigned char *) htab->dynamic_interpreter; | |
3459 | - htab->interp = s; | |
3460 | - } | |
3461 | - } | |
3462 | - | |
3463 | 3460 | /* Set up .got offsets for local syms, and space for local dynamic |
3464 | 3461 | relocs. */ |
3465 | 3462 | for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) |