diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c index da63a077b962..d1061f7ac8f0 100644 --- a/contrib/binutils/bfd/elf32-i386.c +++ b/contrib/binutils/bfd/elf32-i386.c @@ -506,11 +506,7 @@ elf_i386_grok_psinfo (abfd, note) /* The name of the dynamic interpreter. This is put in the .interp section. */ - -#ifndef ELF_DYNAMIC_INTERPRETER #define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" -#endif - /* The size in bytes of an entry in the procedure linkage table. */ @@ -2622,36 +2618,40 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (rel->r_offset >= 1); val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); - if (val != 0xa1) - { - BFD_ASSERT (rel->r_offset >= 2); - type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); - } if (val == 0xa1) { /* movl foo, %eax. */ - bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 2); - } - else if (type == 0x8b) - { - /* movl */ - BFD_ASSERT ((val & 0xc7) == 0x05); - bfd_put_8 (output_bfd, 0xc7, - contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), - contents + rel->r_offset - 1); - } - else if (type == 0x03) - { - /* addl */ - BFD_ASSERT ((val & 0xc7) == 0x05); - bfd_put_8 (output_bfd, 0x81, - contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), - contents + rel->r_offset - 1); + bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 1); } else - BFD_FAIL (); + { + BFD_ASSERT (rel->r_offset >= 2); + type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); + switch (type) + { + case 0x8b: + /* movl */ + BFD_ASSERT ((val & 0xc7) == 0x05); + bfd_put_8 (output_bfd, 0xc7, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, + 0xc0 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + break; + case 0x03: + /* addl */ + BFD_ASSERT ((val & 0xc7) == 0x05); + bfd_put_8 (output_bfd, 0x81, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, + 0xc0 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + break; + default: + BFD_FAIL (); + break; + } + } bfd_put_32 (output_bfd, -tpoff (info, relocation), contents + rel->r_offset); continue; @@ -3390,6 +3390,4 @@ elf_i386_finish_dynamic_sections (output_bfd, info) #define elf_backend_relocate_section elf_i386_relocate_section #define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections -#ifndef ELF32_I386_C_INCLUDED #include "elf32-target.h" -#endif diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c index 2115c1035d82..2d9edf0ae0b6 100644 --- a/contrib/binutils/bfd/elf64-alpha.c +++ b/contrib/binutils/bfd/elf64-alpha.c @@ -2317,9 +2317,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) #define MAX_GOT_SIZE (64*1024) -#ifndef ELF_DYNAMIC_INTERPRETER #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so" -#endif /* Handle an Alpha specific section when reading an object file. This is called when elfcode.h finds a section with an unknown type. @@ -2484,6 +2482,7 @@ elf64_alpha_create_dynamic_sections (abfd, info) { asection *s; struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; /* We need to create .plt, .rela.plt, .got, and .rela.got sections. */ @@ -2499,13 +2498,13 @@ elf64_alpha_create_dynamic_sections (abfd, info) /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the .plt section. */ - h = NULL; + bh = NULL; if (! (_bfd_generic_link_add_one_symbol (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) + get_elf_backend_data (abfd)->collect, &bh))) return false; + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_OBJECT; @@ -2543,13 +2542,13 @@ elf64_alpha_create_dynamic_sections (abfd, info) dynobj's .got section. We don't do this in the linker script because we don't want to define the symbol if we are not creating a global offset table. */ - h = NULL; + bh = NULL; if (!(_bfd_generic_link_add_one_symbol (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, alpha_elf_tdata(abfd)->got, (bfd_vma) 0, (const char *) NULL, - false, get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) + false, get_elf_backend_data (abfd)->collect, &bh))) return false; + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_OBJECT; @@ -3103,7 +3102,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) case R_ALPHA_REFLONG: case R_ALPHA_REFQUAD: - if (info->shared || maybe_dynamic) + if ((info->shared && (sec->flags & SEC_ALLOC)) || maybe_dynamic) need = NEED_DYNREL; break; @@ -4580,7 +4579,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, case STO_ALPHA_NOPV: break; case STO_ALPHA_STD_GPLOAD: - addend += 8; + value += 8; break; default: if (h != NULL)