📄 001-debian.patch
字号:
diff -urN binutils-2.14.90.0.7.orig/bfd/ChangeLog binutils-2.14.90.0.7/bfd/ChangeLog--- binutils-2.14.90.0.7.orig/bfd/ChangeLog 2003-10-29 10:37:47.000000000 -0700+++ binutils-2.14.90.0.7/bfd/ChangeLog 2004-04-20 01:26:12.000000000 -0600@@ -1,3 +1,34 @@+2003-10-29 Daniel Jacobowitz <drow@mvista.com>++ * elf32-arm.h (elf32_arm_final_link_relocate): Move check for+ SEC_ALLOC.++2003-10-29 Philip Blundell <philb@gnu.org>++ * elf32-arm.h (elf32_arm_plt0_entry, elf32_arm_plt_entry): New+ code sequence.+ (PLT_HEADER_SIZE): New.+ (struct elf32_arm_pcrel_relocs_copied): Rename to ...+ (struct elf32_arm_relocs_copied): ... this. Count both+ pcrel and non-pcrel relocs. All uses updated.+ (struct elf32_arm_link_hash_table): Add pointers to dynamic linker+ sections and symbol/section mapping cache.+ (create_got_section): New.+ (elf32_arm_create_dynamic_sections): New.+ (elf_backend_create_dynamic_sections): Use it.+ (elf32_arm_final_link_relocate): Support garbage collection of relocs.+ (elf32_arm_check_relocs): Likewise.+ (elf32_arm_adjust_dynamic_symbol): Likewise.+ (elf32_arm_copy_indirect_symbol): New.+ (elf32_arm_link_hash_table_create): Initialise new fields. + (elf32_arm_gc_sweep_hook): Implement.+ (elf32_arm_discard_copies): Delete.+ (elf32_arm_finish_dynamic_symbol): Use new PLT code.+ (elf32_arm_finish_dynamic_sections): Likewise.+ (elf_backend_can_refcount): Define.+ (elf_backend_copy_indirect_symbol): Likewise.+ (elf_backend_plt_header_size): Set to PLT_HEADER_SIZE.+ 2003-10-29 Alan Modra <amodra@bigpond.net.au> * elf64-ppc.c (elf_backend_grok_prstatus): Define.diff -urN binutils-2.14.90.0.7.orig/bfd/elf-bfd.h binutils-2.14.90.0.7/bfd/elf-bfd.h--- binutils-2.14.90.0.7.orig/bfd/elf-bfd.h 2003-10-29 10:37:47.000000000 -0700+++ binutils-2.14.90.0.7/bfd/elf-bfd.h 2004-04-20 01:26:12.000000000 -0600@@ -1303,7 +1303,7 @@ extern enum elf_reloc_type_class _bfd_elf_reloc_type_class (const Elf_Internal_Rela *); extern bfd_vma _bfd_elf_rela_local_sym- (bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *);+ (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *); extern bfd_vma _bfd_elf_rel_local_sym (bfd *, Elf_Internal_Sym *, asection **, bfd_vma); extern bfd_vma _bfd_elf_section_offsetdiff -urN binutils-2.14.90.0.7.orig/bfd/elf-hppa.h binutils-2.14.90.0.7/bfd/elf-hppa.h--- binutils-2.14.90.0.7.orig/bfd/elf-hppa.h 2003-08-21 09:28:47.000000000 -0600+++ binutils-2.14.90.0.7/bfd/elf-hppa.h 2004-04-20 01:26:12.000000000 -0600@@ -1346,11 +1346,11 @@ /* This is a local symbol. */ sym = local_syms + r_symndx; sym_sec = local_sections[r_symndx];- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); /* If this symbol has an entry in the PA64 dynamic hash table, then get it. */- dyn_name = get_dyn_name (input_section, h, rel,+ dyn_name = get_dyn_name (input_bfd, h, rel, &dynh_buf, &dynh_buflen); dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, dyn_name, FALSE, FALSE);@@ -1373,7 +1373,7 @@ /* If this symbol has an entry in the PA64 dynamic hash table, then get it. */- dyn_name = get_dyn_name (input_section, h, rel,+ dyn_name = get_dyn_name (input_bfd, h, rel, &dynh_buf, &dynh_buflen); dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, dyn_name, FALSE, FALSE);@@ -1410,7 +1410,7 @@ /* If this symbol has an entry in the PA64 dynamic hash table, then get it. */- dyn_name = get_dyn_name (input_section, h, rel,+ dyn_name = get_dyn_name (input_bfd, h, rel, &dynh_buf, &dynh_buflen); dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, dyn_name, FALSE, FALSE);@@ -1426,7 +1426,7 @@ } else if (h->root.type == bfd_link_hash_undefweak) {- dyn_name = get_dyn_name (input_section, h, rel,+ dyn_name = get_dyn_name (input_bfd, h, rel, &dynh_buf, &dynh_buflen); dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, dyn_name, FALSE, FALSE);diff -urN binutils-2.14.90.0.7.orig/bfd/elf-m10200.c binutils-2.14.90.0.7/bfd/elf-m10200.c--- binutils-2.14.90.0.7.orig/bfd/elf-m10200.c 2003-07-23 09:08:08.000000000 -0600+++ binutils-2.14.90.0.7/bfd/elf-m10200.c 2004-04-20 01:26:12.000000000 -0600@@ -373,7 +373,7 @@ { sym = local_syms + r_symndx; sec = local_sections[r_symndx];- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else {diff -urN binutils-2.14.90.0.7.orig/bfd/elf-m10300.c binutils-2.14.90.0.7/bfd/elf-m10300.c--- binutils-2.14.90.0.7.orig/bfd/elf-m10300.c 2003-08-21 09:28:47.000000000 -0600+++ binutils-2.14.90.0.7/bfd/elf-m10300.c 2004-04-20 01:26:12.000000000 -0600@@ -1574,7 +1574,7 @@ { sym = local_syms + r_symndx; sec = local_sections[r_symndx];- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else {diff -urN binutils-2.14.90.0.7.orig/bfd/elf.c binutils-2.14.90.0.7/bfd/elf.c--- binutils-2.14.90.0.7.orig/bfd/elf.c 2003-10-29 10:37:47.000000000 -0700+++ binutils-2.14.90.0.7/bfd/elf.c 2004-04-20 01:26:12.000000000 -0600@@ -7367,9 +7367,10 @@ bfd_vma _bfd_elf_rela_local_sym (bfd *abfd, Elf_Internal_Sym *sym,- asection *sec,+ asection **psec, Elf_Internal_Rela *rel) {+ asection *sec = *psec; bfd_vma relocation; relocation = (sec->output_section->vma@@ -7379,16 +7380,14 @@ && ELF_ST_TYPE (sym->st_info) == STT_SECTION && sec->sec_info_type == ELF_INFO_TYPE_MERGE) {- asection *msec;-- msec = sec; rel->r_addend =- _bfd_merged_section_offset (abfd, &msec,+ _bfd_merged_section_offset (abfd, psec, elf_section_data (sec)->sec_info, sym->st_value + rel->r_addend,- 0)- - relocation;- rel->r_addend += msec->output_section->vma + msec->output_offset;+ 0);+ sec = *psec;+ rel->r_addend -= relocation;+ rel->r_addend += sec->output_section->vma + sec->output_offset; } return relocation; }diff -urN binutils-2.14.90.0.7.orig/bfd/elf32-arm.h binutils-2.14.90.0.7/bfd/elf32-arm.h--- binutils-2.14.90.0.7.orig/bfd/elf32-arm.h 2003-10-29 10:37:47.000000000 -0700+++ binutils-2.14.90.0.7/bfd/elf32-arm.h 2004-04-20 01:26:12.000000000 -0600@@ -84,6 +84,12 @@ static void arm_add_to_rel PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma)); #endif+static bfd_boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *h, PTR inf));+static bfd_boolean create_got_section + PARAMS ((bfd * dynobj, struct bfd_link_info * info));+static bfd_boolean elf32_arm_create_dynamic_sections + PARAMS ((bfd * dynobj, struct bfd_link_info * info)); static enum elf_reloc_type_class elf32_arm_reloc_type_class PARAMS ((const Elf_Internal_Rela *)); static bfd_boolean elf32_arm_object_p@@ -119,6 +125,12 @@ section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" +#ifdef FOUR_WORD_PLT++/* The size in bytes of the special first entry in the procedure+ linkage table. */+#define PLT_HEADER_SIZE 16+ /* The size in bytes of an entry in the procedure linkage table. */ #define PLT_ENTRY_SIZE 16 @@ -126,23 +138,56 @@ this. It is set up so that any shared library function that is called before the relocation has been set up calls the dynamic linker first. */-static const bfd_vma elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] =+static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] = {- 0xe52de004, /* str lr, [sp, #-4]! */- 0xe59fe010, /* ldr lr, [pc, #16] */- 0xe08fe00e, /* add lr, pc, lr */- 0xe5bef008 /* ldr pc, [lr, #8]! */+ 0xe52de004, /* str lr, [sp, #-4]! */+ 0xe59fe010, /* ldr lr, [pc, #16] */+ 0xe08fe00e, /* add lr, pc, lr */+ 0xe5bef008, /* ldr pc, [lr, #8]! */ }; /* Subsequent entries in a procedure linkage table look like this. */ static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =- {- 0xe59fc004, /* ldr ip, [pc, #4] */- 0xe08fc00c, /* add ip, pc, ip */- 0xe59cf000, /* ldr pc, [ip] */- 0x00000000 /* offset to symbol in got */- };+ {+ 0xe28fc600, /* add ip, pc, #NN */+ 0xe28cca00, /* add ip, ip, #NN */+ 0xe5bcf000, /* ldr pc, [ip, #NN]! */+ 0x00000000, /* unused */+ };++#else++/* The size in bytes of the special first entry in the procedure+ linkage table. */+#define PLT_HEADER_SIZE 20++/* The size in bytes of an entry in the procedure linkage table. */+#define PLT_ENTRY_SIZE 12++/* The first entry in a procedure linkage table looks like+ this. It is set up so that any shared library function that is+ called before the relocation has been set up calls the dynamic+ linker first. */+static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] =+ {+ 0xe52de004, /* str lr, [sp, #-4]! */+ 0xe59fe004, /* ldr lr, [pc, #4] */+ 0xe08fe00e, /* add lr, pc, lr */+ 0xe5bef008, /* ldr pc, [lr, #8]! */+ 0x00000000, /* &GOT[0] - . */+ };++/* Subsequent entries in a procedure linkage table look like+ this. */+static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =+ {+ 0xe28fc600, /* add ip, pc, #0xNN00000 */+ 0xe28cca00, /* add ip, ip, #0xNN000 */+ 0xe5bcf000, /* ldr pc, [ip, #0xNNN]! */+ };++#endif /* The ARM linker needs to keep track of the number of relocs that it decides to copy in check_relocs for each symbol. This is so that@@ -152,14 +197,16 @@ /* This structure keeps track of the number of PC relative relocs we have copied for a given symbol. */-struct elf32_arm_pcrel_relocs_copied+struct elf32_arm_relocs_copied { /* Next section. */- struct elf32_arm_pcrel_relocs_copied * next;+ struct elf32_arm_relocs_copied * next; /* A section in dynobj. */ asection * section; /* Number of relocs copied in this section. */ bfd_size_type count;+ /* Number of relocs copied in this section. */+ bfd_size_type pc_count; }; /* Arm ELF linker hash entry. */@@ -168,13 +215,9 @@ struct elf_link_hash_entry root; /* Number of PC relative relocs copied for this symbol. */- struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied;+ struct elf32_arm_relocs_copied * relocs_copied; }; -/* Declare this now that the above structures are defined. */-static bfd_boolean elf32_arm_discard_copies- PARAMS ((struct elf32_arm_link_hash_entry *, PTR));- /* Traverse an arm ELF linker hash table. */ #define elf32_arm_link_hash_traverse(table, func, info) \ (elf_link_hash_traverse \@@ -204,6 +247,18 @@ /* A boolean indicating whether knowledge of the ARM's pipeline length should be applied by the linker. */ int no_pipeline_knowledge;++ /* Short-cuts to get to dynamic linker sections. */+ asection *sgot;+ asection *sgotplt;+ asection *srelgot;+ asection *splt;+ asection *srelplt;+ asection *sdynbss;+ asection *srelbss;++ /* Small local sym to section mapping cache. */+ struct sym_sec_cache sym_sec; }; /* Create an entry in an ARM ELF linker hash table. */@@ -231,11 +286,121 @@ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); if (ret != (struct elf32_arm_link_hash_entry *) NULL)- ret->pcrel_relocs_copied = NULL;+ ret->relocs_copied = NULL; return (struct bfd_hash_entry *) ret; } +/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up+ shortcuts to them in our hash table. */++static bfd_boolean+create_got_section (dynobj, info)+ bfd *dynobj;+ struct bfd_link_info *info;+{+ struct elf32_arm_link_hash_table *htab;++ if (! _bfd_elf_create_got_section (dynobj, info))+ return FALSE;++ htab = elf32_arm_hash_table (info);+ htab->sgot = bfd_get_section_by_name (dynobj, ".got");+ htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");+ if (!htab->sgot || !htab->sgotplt)+ abort ();++ htab->srelgot = bfd_make_section (dynobj, ".rel.got");+ if (htab->srelgot == NULL+ || ! bfd_set_section_flags (dynobj, htab->srelgot,+ (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS+ | SEC_IN_MEMORY | SEC_LINKER_CREATED+ | SEC_READONLY))+ || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))+ return FALSE;+ return TRUE;+}++/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and+ .rel.bss sections in DYNOBJ, and set up shortcuts to them in our+ hash table. */++static bfd_boolean+elf32_arm_create_dynamic_sections (dynobj, info)+ bfd *dynobj;+ struct bfd_link_info *info;+{+ struct elf32_arm_link_hash_table *htab;++ htab = elf32_arm_hash_table (info);+ if (!htab->sgot && !create_got_section (dynobj, info))+ return FALSE;++ if (!_bfd_elf_create_dynamic_sections (dynobj, info))+ return FALSE;++ htab->splt = bfd_get_section_by_name (dynobj, ".plt");+ htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt");+ htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");+ if (!info->shared)+ htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss");++ if (!htab->splt || !htab->srelplt || !htab->sdynbss+ || (!info->shared && !htab->srelbss))+ abort ();++ return TRUE;+}+
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -