diff options
author | Kaz Kojima <kkojima@rr.iij4u.or.jp> | 2003-04-24 05:19:09 +0000 |
---|---|---|
committer | Kaz Kojima <kkojima@rr.iij4u.or.jp> | 2003-04-24 05:19:09 +0000 |
commit | 267fb3c1cef03b0f00c9186f0de0ed3e9e5e1e00 (patch) | |
tree | 02ee07882b8ee78ab80185c8e7861628182f28be | |
parent | 0f0569c4ae6c593d573b2961438826fc80ae1e42 (diff) | |
download | gdb-267fb3c1cef03b0f00c9186f0de0ed3e9e5e1e00.zip gdb-267fb3c1cef03b0f00c9186f0de0ed3e9e5e1e00.tar.gz gdb-267fb3c1cef03b0f00c9186f0de0ed3e9e5e1e00.tar.bz2 |
* elf32-sh.c (tpoff): New.
(struct elf_sh_dyn_relocs): Remove tls_tpoff32.
(WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
(allocate_dynrelocs): Don't make unnecessary dynamic TLS
relocations. Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses.
(sh_elf_relocate_section): Likewise. Remove unnecessary tests.
(dtpoff_base): Fix wrong indentation.
(sh_elf_check_relocs): Don't set DF_STATIC_TLS flag with non-TLS
relocations. Don't set tls_tpoff32 flag. Don't make unnecessary
R_SH_TLS_TPOFF32 relocations.
* ld-sh/tlsbin-1.d, ld-sh/tlsbin-2.d, ld-sh/tlsbin-3.d,
ld-sh/tlstpoff-1.d, ld-sh/tlstpoff-2.d: Update for removing
unnecessary TLS relocs.
-rw-r--r-- | bfd/ChangeLog | 13 | ||||
-rw-r--r-- | bfd/elf32-sh.c | 267 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-sh/tlsbin-1.d | 58 | ||||
-rw-r--r-- | ld/testsuite/ld-sh/tlsbin-2.d | 31 | ||||
-rw-r--r-- | ld/testsuite/ld-sh/tlsbin-3.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-sh/tlstpoff-1.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-sh/tlstpoff-2.d | 6 |
8 files changed, 130 insertions, 257 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e701854..6b83979 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,16 @@ +2003-04-23 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * elf32-sh.c (tpoff): New. + (struct elf_sh_dyn_relocs): Remove tls_tpoff32. + (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO. + (allocate_dynrelocs): Don't make unnecessary dynamic TLS + relocations. Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses. + (sh_elf_relocate_section): Likewise. Remove unnecessary tests. + (dtpoff_base): Fix wrong indentation. + (sh_elf_check_relocs): Don't set DF_STATIC_TLS flag with non-TLS + relocations. Don't set tls_tpoff32 flag. Don't make unnecessary + R_SH_TLS_TPOFF32 relocations. + 2003-04-23 J"orn Rennecke <joern.rennecke@superh.com> * archures.c (enum bfd_architecture): Amend comment to refer to SuperH. diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 789ee78..35a4dda 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -90,6 +90,8 @@ static bfd_boolean sh_elf_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static bfd_vma dtpoff_base PARAMS ((struct bfd_link_info *)); +static bfd_vma tpoff + PARAMS ((struct bfd_link_info *, bfd_vma)); static asection * sh_elf_gc_mark_hook PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); @@ -3525,9 +3527,6 @@ struct elf_sh_dyn_relocs /* Number of pc-relative relocs copied for the input section. */ bfd_size_type pc_count; - - /* If TRUE, R_SH_TLS_TPOFF32 relocation is generated. */ - bfd_boolean tls_tpoff32; }; /* sh ELF linker hash entry. */ @@ -4039,9 +4038,9 @@ sh_elf_adjust_dynamic_symbol (info, h) will be called from elflink.h. If elflink.h doesn't call our finish_dynamic_symbol routine, we'll need to do something about initializing any .plt and .got entries in sh_elf_relocate_section. */ -#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \ ((DYN) \ - && ((INFO)->shared \ + && ((SHARED) \ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ && ((H)->dynindx != -1 \ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) @@ -4095,7 +4094,8 @@ allocate_dynrelocs (h, inf) return FALSE; } - if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) + if (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) { asection *s = htab->splt; @@ -4162,14 +4162,15 @@ allocate_dynrelocs (h, inf) if (tls_type == GOT_TLS_GD) s->_raw_size += 4; dyn = htab->root.dynamic_sections_created; - /* R_SH_TLS_IE_32 needs one dynamic relocation, + /* R_SH_TLS_IE_32 needs one dynamic relocation if dynamic, R_SH_TLS_GD needs one if local symbol and two if global. */ if ((tls_type == GOT_TLS_GD && h->dynindx == -1) - || tls_type == GOT_TLS_IE) + || (tls_type == GOT_TLS_IE && dyn)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); else if (tls_type == GOT_TLS_GD) htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela); - else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + else if (info->shared || + WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); } else @@ -4194,7 +4195,7 @@ allocate_dynrelocs (h, inf) eh->datalabel_got.offset = s->_raw_size; s->_raw_size += 4; dyn = htab->root.dynamic_sections_created; - if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); } else @@ -4231,10 +4232,6 @@ allocate_dynrelocs (h, inf) } else { - for (p = eh->dyn_relocs; p; p = p->next) - if (p->tls_tpoff32) - goto keep; - /* For the non-shared case, discard space for relocs against symbols which turn out to need copy relocs or are not dynamic. */ @@ -4752,7 +4749,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_SH_GOT_MEDLOW16 || r_type == R_SH_GOT_MEDHI16 || r_type == R_SH_GOT_HI16) - && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) + && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) && (! info->shared || (! info->symbolic && h->dynindx != -1) || (h->elf_link_hash_flags @@ -5052,7 +5049,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (off != (bfd_vma) -1); dyn = htab->root.dynamic_sections_created; - if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) || (info->shared && (info->symbolic || h->dynindx == -1 || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) @@ -5280,17 +5277,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (! info->shared && (h->dynindx == -1 || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - struct elf_sh_dyn_relocs *p; - - /* If TPOFF32 relocation can be created, convert it. */ - for (p = sh_elf_hash_entry (h)->dyn_relocs; p; p = p->next) - if (p->sec == input_section && p->tls_tpoff32) - { - r_type = R_SH_TLS_LE_32; - break; - } - } + r_type = R_SH_TLS_LE_32; } if (r_type == R_SH_TLS_GD_32 && tls_type == GOT_TLS_IE) @@ -5300,9 +5287,6 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, { bfd_vma offset; unsigned short insn; - int indx; - Elf_Internal_Rela outrel; - bfd_byte *loc; if (ELF32_R_TYPE (rel->r_info) == R_SH_TLS_GD_32) { @@ -5379,45 +5363,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_put_16 (output_bfd, 0x0009, contents + offset + 4); } - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - - if (h == NULL - || h->dynindx == -1 - || (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - indx = 0; - else - indx = h->dynindx; - outrel.r_offset = (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); - outrel.r_info = ELF32_R_INFO (indx, R_SH_TLS_TPOFF32); - if (indx == 0) - outrel.r_addend = relocation - dtpoff_base (info); - else - outrel.r_addend = 0; - - loc = sreloc->contents; - loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_put_32 (output_bfd, tpoff (info, relocation), + contents + rel->r_offset); continue; } @@ -5435,6 +5382,18 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, off = local_got_offsets[r_symndx]; } + /* Relocate R_SH_TLS_IE_32 directly when statically linking. */ + if (r_type == R_SH_TLS_IE_32 + && ! htab->root.dynamic_sections_created) + { + off &= ~1; + bfd_put_32 (output_bfd, tpoff (info, relocation), + sgot->contents + off); + bfd_put_32 (output_bfd, sgot->output_offset + off, + contents + rel->r_offset); + continue; + } + if ((off & 1) != 0) off &= ~1; else @@ -5452,13 +5411,11 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_offset = (sgot->output_section->vma + sgot->output_offset + off); - if (h == NULL - || h->dynindx == -1 - || (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + if (h == NULL || h->dynindx == -1) indx = 0; else indx = h->dynindx; + dr_type = (r_type == R_SH_TLS_GD_32 ? R_SH_TLS_DTPMOD32 : R_SH_TLS_TPOFF32); if (dr_type == R_SH_TLS_TPOFF32 && indx == 0) @@ -5640,46 +5597,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_SH_TLS_LDO_32: if (! info->shared) - { - int indx; - Elf_Internal_Rela outrel; - bfd_byte *loc; - - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - - indx = (h && h->dynindx != -1) ? h->dynindx : 0; - outrel.r_offset = (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); - outrel.r_info = ELF32_R_INFO (indx, R_SH_TLS_TPOFF32); - if (indx == 0) - outrel.r_addend = relocation - dtpoff_base (info); - else - outrel.r_addend = 0; - - loc = sreloc->contents; - loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); - continue; - } + relocation = tpoff (info, relocation); else relocation -= dtpoff_base (info); @@ -5692,6 +5610,13 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela outrel; bfd_byte *loc; + if (! info->shared) + { + relocation = tpoff (info, relocation); + addend = rel->r_addend; + goto final_link_relocate; + } + if (sreloc == NULL) { const char *name; @@ -5712,7 +5637,11 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (sreloc != NULL); } - indx = (h && h->dynindx != -1) ? h->dynindx : 0; + if (h == NULL || h->dynindx == -1) + indx = 0; + else + indx = h->dynindx; + outrel.r_offset = (input_section->output_section->vma + input_section->output_offset + rel->r_offset); @@ -5882,12 +5811,27 @@ static bfd_vma dtpoff_base (info) struct bfd_link_info *info; { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) - return 0; + /* If tls_segment is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_segment == NULL) + return 0; return elf_hash_table (info)->tls_segment->start; } +/* Return the relocation value for R_SH_TLS_TPOFF32.. */ + +static bfd_vma +tpoff (info, address) + struct bfd_link_info *info; + bfd_vma address; +{ + /* If tls_segment is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_segment == NULL) + return 0; + /* SH TLS ABI is variant I and static TLS block start just after tcbhead + structure which has 2 pointer fields. */ + return (address - dtpoff_base (info) + 8); +} + static asection * sh_elf_gc_mark_hook (sec, info, rel, h, sym) asection *sec; @@ -6349,12 +6293,12 @@ sh_elf_check_relocs (abfd, info, sec, relocs) return FALSE; break; - force_got: case R_SH_TLS_IE_32: if (info->shared) info->flags |= DF_STATIC_TLS; /* FALLTHROUGH */ + force_got: case R_SH_TLS_GD_32: case R_SH_GOT32: #ifdef INCLUDE_SHMEDIA @@ -6633,7 +6577,6 @@ sh_elf_check_relocs (abfd, info, sec, relocs) p->sec = sec; p->count = 0; p->pc_count = 0; - p->tls_tpoff32 = FALSE; } p->count += 1; @@ -6651,92 +6594,10 @@ sh_elf_check_relocs (abfd, info, sec, relocs) return FALSE; } - if (ELF32_R_TYPE (rel->r_info) == R_SH_TLS_LD_32) - break; + break; - /* FALLTHROUGH */ case R_SH_TLS_LDO_32: - /* We make a R_SH_TLS_TPOFF32 relocation. Count it as a - copy relocation. */ - if (! info->shared) - { - struct elf_sh_dyn_relocs *p; - struct elf_sh_dyn_relocs **head; - - if (dynobj == NULL) - htab->root.dynobj = dynobj = abfd; - - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - flagword flags; - - sreloc = bfd_make_section (dynobj, name); - flags = (SEC_HAS_CONTENTS | SEC_READONLY - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if ((sec->flags & SEC_ALLOC) != 0) - flags |= SEC_ALLOC | SEC_LOAD; - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) - || ! bfd_set_section_alignment (dynobj, sreloc, 2)) - return FALSE; - } - elf_section_data (sec)->sreloc = sreloc; - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; - } - - /* If this is a global symbol, we count the number of - relocations we need for this symbol. */ - if (h != NULL) - head = &((struct elf_sh_link_hash_entry *) h)->dyn_relocs; - else - { - asection *s; - - /* Track dynamic relocs needed for local syms too. */ - s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, - sec, r_symndx); - if (s == NULL) - return FALSE; - - head = ((struct elf_sh_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - } - - p = *head; - if (p == NULL || p->sec != sec) - { - bfd_size_type amt = sizeof (*p); - p = ((struct elf_sh_dyn_relocs *) bfd_alloc (dynobj, amt)); - if (p == NULL) - return FALSE; - p->next = *head; - *head = p; - p->sec = sec; - p->count = 0; - p->pc_count = 0; - p->tls_tpoff32 = FALSE; - } - - p->count += 1; - p->tls_tpoff32 = TRUE; - } + /* Nothing to do. */ break; default: diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 8d2c9de..b7438ef 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2003-04-23 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * ld-sh/tlsbin-1.d, ld-sh/tlsbin-2.d, ld-sh/tlsbin-3.d, + ld-sh/tlstpoff-1.d, ld-sh/tlstpoff-2.d: Update for removing + unnecessary TLS relocs. + 2003-04-23 J"orn Rennecke <joern.rennecke@superh.com> * ld-sh/sh64/crange3-cmpct.rd (Machine): Change to refer to SuperH. diff --git a/ld/testsuite/ld-sh/tlsbin-1.d b/ld/testsuite/ld-sh/tlsbin-1.d index 58acf5c..9f6d84f 100644 --- a/ld/testsuite/ld-sh/tlsbin-1.d +++ b/ld/testsuite/ld-sh/tlsbin-1.d @@ -54,7 +54,7 @@ Disassembly of section \.text: 401052: 09 00 nop 401054: 09 00 nop 401056: 09 00 nop - 401058: 03 d4 mov\.l 401068 <fn2\+0x68>,r4 ! 0x0 + 401058: 03 d4 mov\.l 401068 <fn2\+0x68>,r4 ! 0x8 40105a: 12 00 stc gbr,r0 40105c: 4c 30 add r4,r0 40105e: 09 00 nop @@ -62,7 +62,7 @@ Disassembly of section \.text: 401062: 09 00 nop 401064: 04 a0 bra 401070 <fn2\+0x70> 401066: 09 00 nop - 401068: 00 00 .*[ ]*.* + 401068: 08 00 .*[ ]*.* 40106a: 00 00 .*[ ]*.* 40106c: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* 40106e: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* @@ -70,7 +70,7 @@ Disassembly of section \.text: 401072: 09 00 nop 401074: 09 00 nop 401076: 09 00 nop - 401078: 03 d4 mov\.l 401088 <fn2\+0x88>,r4 ! 0x0 + 401078: 03 d4 mov\.l 401088 <fn2\+0x88>,r4 ! 0x10 40107a: 12 00 stc gbr,r0 40107c: 4c 30 add r4,r0 40107e: 09 00 nop @@ -78,7 +78,7 @@ Disassembly of section \.text: 401082: 09 00 nop 401084: 04 a0 bra 401090 <fn2\+0x90> 401086: 09 00 nop - 401088: 00 00 .*[ ]*.* + 401088: 10 00 .*[ ]*.* 40108a: 00 00 .*[ ]*.* 40108c: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* 40108e: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* @@ -86,7 +86,7 @@ Disassembly of section \.text: 401092: 09 00 nop 401094: 09 00 nop 401096: 09 00 nop - 401098: 03 d4 mov\.l 4010a8 <fn2\+0xa8>,r4 ! 0x0 + 401098: 03 d4 mov\.l 4010a8 <fn2\+0xa8>,r4 ! 0x18 40109a: 12 00 stc gbr,r0 40109c: 4c 30 add r4,r0 40109e: 09 00 nop @@ -94,7 +94,7 @@ Disassembly of section \.text: 4010a2: 09 00 nop 4010a4: 04 a0 bra 4010b0 <fn2\+0xb0> 4010a6: 09 00 nop - 4010a8: 00 00 .*[ ]*.* + 4010a8: 18 00 .*[ ]*.* 4010aa: 00 00 .*[ ]*.* 4010ac: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* 4010ae: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* @@ -116,11 +116,11 @@ Disassembly of section \.text: 4010ce: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* 4010d0: 09 00 nop 4010d2: 09 00 nop - 4010d4: 2c d1 mov\.l 401188 <fn2\+0x188>,r1 ! 0x0 + 4010d4: 2c d1 mov\.l 401188 <fn2\+0x188>,r1 ! 0x10 4010d6: 0c 31 add r0,r1 4010d8: 09 00 nop 4010da: 09 00 nop - 4010dc: 2b d2 mov\.l 40118c <fn2\+0x18c>,r2 ! 0x0 + 4010dc: 2b d2 mov\.l 40118c <fn2\+0x18c>,r2 ! 0x14 4010de: 0c 32 add r0,r2 4010e0: 09 00 nop 4010e2: 09 00 nop @@ -140,11 +140,11 @@ Disassembly of section \.text: 4010fe: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* 401100: 09 00 nop 401102: 09 00 nop - 401104: 22 d1 mov\.l 401190 <fn2\+0x190>,r1 ! 0x0 + 401104: 22 d1 mov\.l 401190 <fn2\+0x190>,r1 ! 0x18 401106: 0c 31 add r0,r1 401108: 09 00 nop 40110a: 09 00 nop - 40110c: 21 d2 mov\.l 401194 <fn2\+0x194>,r2 ! 0x0 + 40110c: 21 d2 mov\.l 401194 <fn2\+0x194>,r2 ! 0x1c 40110e: 0c 32 add r0,r2 401110: 09 00 nop 401112: 09 00 nop @@ -174,25 +174,25 @@ Disassembly of section \.text: 401142: 09 00 nop 401144: 09 00 nop 401146: 09 00 nop - 401148: 02 d0 mov\.l 401154 <fn2\+0x154>,r0 ! 0x0 + 401148: 02 d0 mov\.l 401154 <fn2\+0x154>,r0 ! 0x8 40114a: 12 01 stc gbr,r1 40114c: 09 00 nop 40114e: 03 a0 bra 401158 <fn2\+0x158> 401150: 0c 31 add r0,r1 401152: 09 00 nop - 401154: 00 00 .*[ ]*.* + 401154: 08 00 .*[ ]*.* 401156: 00 00 .*[ ]*.* 401158: 09 00 nop 40115a: 09 00 nop 40115c: 09 00 nop 40115e: 09 00 nop - 401160: 02 d0 mov\.l 40116c <fn2\+0x16c>,r0 ! 0x0 + 401160: 02 d0 mov\.l 40116c <fn2\+0x16c>,r0 ! 0x18 401162: 12 01 stc gbr,r1 401164: 09 00 nop 401166: 03 a0 bra 401170 <fn2\+0x170> 401168: 0c 31 add r0,r1 40116a: 09 00 nop - 40116c: 00 00 .*[ ]*.* + 40116c: 18 00 .*[ ]*.* 40116e: 00 00 .*[ ]*.* 401170: 09 00 nop 401172: 09 00 nop @@ -206,6 +206,13 @@ Disassembly of section \.text: 401182: 09 00 nop 401184: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* 401186: 01 00 .*[ ]*.* + 401188: 10 00 .*[ ]*.* + 40118a: 00 00 .*[ ]*.* + 40118c: 14 00 .*[ ]*.* + 40118e: 00 00 .*[ ]*.* + 401190: 18 00 .*[ ]*.* + 401192: 00 00 .*[ ]*.* + 401194: 1c 00 .*[ ]*.* \.\.\. 00402000 <_start>: @@ -231,58 +238,58 @@ Disassembly of section \.text: 402026: 09 00 nop 402028: 09 00 nop 40202a: 09 00 nop - 40202c: 02 d0 mov\.l 402038 <_start\+0x38>,r0 ! 0x0 + 40202c: 02 d0 mov\.l 402038 <_start\+0x38>,r0 ! 0x20 40202e: 12 01 stc gbr,r1 402030: 09 00 nop 402032: 03 a0 bra 40203c <_start\+0x3c> 402034: 0c 31 add r0,r1 402036: 09 00 nop - 402038: 00 00 .*[ ]*.* + 402038: 20 00 .*[ ]*.* 40203a: 00 00 .*[ ]*.* 40203c: 09 00 nop 40203e: 09 00 nop 402040: 09 00 nop 402042: 09 00 nop - 402044: 02 d0 mov\.l 402050 <_start\+0x50>,r0 ! 0x0 + 402044: 02 d0 mov\.l 402050 <_start\+0x50>,r0 ! 0x2c 402046: 12 01 stc gbr,r1 402048: 09 00 nop 40204a: 03 a0 bra 402054 <_start\+0x54> 40204c: 0c 31 add r0,r1 40204e: 09 00 nop - 402050: 00 00 .*[ ]*.* + 402050: 2c 00 .*[ ]*.* 402052: 00 00 .*[ ]*.* 402054: 09 00 nop 402056: 09 00 nop 402058: 09 00 nop 40205a: 09 00 nop - 40205c: 02 d0 mov\.l 402068 <_start\+0x68>,r0 ! 0x0 + 40205c: 02 d0 mov\.l 402068 <_start\+0x68>,r0 ! 0x1c 40205e: 12 01 stc gbr,r1 402060: 09 00 nop 402062: 03 a0 bra 40206c <_start\+0x6c> 402064: 0c 31 add r0,r1 402066: 09 00 nop - 402068: 00 00 .*[ ]*.* + 402068: 1c 00 .*[ ]*.* 40206a: 00 00 .*[ ]*.* 40206c: 09 00 nop 40206e: 09 00 nop 402070: 09 00 nop 402072: 09 00 nop 402074: 12 01 stc gbr,r1 - 402076: 0c d0 mov\.l 4020a8 <_start\+0xa8>,r0 ! 0x0 + 402076: 0c d0 mov\.l 4020a8 <_start\+0xa8>,r0 ! 0x8 402078: 1c 30 add r1,r0 40207a: 09 00 nop 40207c: 09 00 nop 40207e: 09 00 nop 402080: 09 00 nop 402082: 12 01 stc gbr,r1 - 402084: 09 d0 mov\.l 4020ac <_start\+0xac>,r0 ! 0x0 + 402084: 09 d0 mov\.l 4020ac <_start\+0xac>,r0 ! 0x28 402086: 1c 30 add r1,r0 402088: 09 00 nop 40208a: 09 00 nop 40208c: 09 00 nop 40208e: 09 00 nop 402090: 12 01 stc gbr,r1 - 402092: 07 d0 mov\.l 4020b0 <_start\+0xb0>,r0 ! 0x0 + 402092: 07 d0 mov\.l 4020b0 <_start\+0xb0>,r0 ! 0x18 402094: 1c 30 add r1,r0 402096: 09 00 nop 402098: 09 00 nop @@ -293,4 +300,9 @@ Disassembly of section \.text: 4020a2: f6 6e mov\.l @r15\+,r14 4020a4: [0-9a-f]+ [0-9a-f]+ .*[ ]*.* 4020a6: 01 00 .*[ ]*.* + 4020a8: 08 00 .*[ ]*.* + 4020aa: 00 00 .*[ ]*.* + 4020ac: 28 00 .*[ ]*.* + 4020ae: 00 00 .*[ ]*.* + 4020b0: 18 00 .*[ ]*.* \.\.\. diff --git a/ld/testsuite/ld-sh/tlsbin-2.d b/ld/testsuite/ld-sh/tlsbin-2.d index a010ea9..d84b102 100644 --- a/ld/testsuite/ld-sh/tlsbin-2.d +++ b/ld/testsuite/ld-sh/tlsbin-2.d @@ -23,7 +23,7 @@ Section Headers: \[11\] \.tbss +NOBITS +0+413018 [0-9a-f]+ 0+010 00 WAT 0 0 1 \[12\] \.dynamic +DYNAMIC +0+413018 .* #... - \[[0-9a-f]+\] \.got +PROGBITS +0+4130c0 .* + \[[0-9a-f]+\] \.got +PROGBITS +0+4130b8 .* \[[0-9a-f]+\] \.sbss +.* \[[0-9a-f]+\] \.bss +.* #... @@ -58,31 +58,16 @@ Program Headers: 04 +\.tbss \.dynamic * 05 +\.tdata \.tbss * -Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 19 entries: +Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 4 entries: Offset +Info +Type +Sym\.Value +Sym\. Name \+ Addend -0+401068 00000097 R_SH_TLS_TPOFF32 +0+00 -0+401088 00000097 R_SH_TLS_TPOFF32 +0+08 -0+4010a8 00000097 R_SH_TLS_TPOFF32 +0+10 -0+401154 00000097 R_SH_TLS_TPOFF32 +0+00 -0+40116c 00000097 R_SH_TLS_TPOFF32 +0+10 -0+401188 00000097 R_SH_TLS_TPOFF32 +0+08 -0+40118c 00000097 R_SH_TLS_TPOFF32 +0+0c -0+401190 00000097 R_SH_TLS_TPOFF32 +0+10 -0+401194 00000097 R_SH_TLS_TPOFF32 +0+14 -0+402038 00000097 R_SH_TLS_TPOFF32 +0+18 -0+402050 00000097 R_SH_TLS_TPOFF32 +0+24 -0+402068 00000097 R_SH_TLS_TPOFF32 +0+14 -0+4020a8 00000097 R_SH_TLS_TPOFF32 +0+00 -0+4020ac 00000097 R_SH_TLS_TPOFF32 +0+20 -0+4020b0 00000097 R_SH_TLS_TPOFF32 +0+10 -0+4130d0 00000197 R_SH_TLS_TPOFF32 +0+ +sG3 \+ 0 -0+4130d4 00000397 R_SH_TLS_TPOFF32 +0+ +sG2 \+ 0 -0+4130d8 00000497 R_SH_TLS_TPOFF32 +0+ +sG4 \+ 0 -0+4130dc 0000[0-9a-f]+97 R_SH_TLS_TPOFF32 +0+ +sG1 \+ 0 +0+4130c8 00000197 R_SH_TLS_TPOFF32 +0+ +sG3 \+ 0 +0+4130cc 00000397 R_SH_TLS_TPOFF32 +0+ +sG2 \+ 0 +0+4130d0 00000497 R_SH_TLS_TPOFF32 +0+ +sG4 \+ 0 +0+4130d4 0000[0-9a-f]+97 R_SH_TLS_TPOFF32 +0+ +sG1 \+ 0 Relocation section '\.rela\.plt' at offset 0x[0-9a-f]+ contains 1 entries: Offset +Info +Type +Sym\.Value +Sym\. Name \+ Addend -0+4130cc 000005a4 R_SH_JMP_SLOT +[0-9a-f]+ +__tls_get_addr \+ [0-9a-f]+ +0+4130c4 000005a4 R_SH_JMP_SLOT +[0-9a-f]+ +__tls_get_addr \+ [0-9a-f]+ Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name @@ -135,7 +120,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +[0-9]+: 00000004 +0 TLS +GLOBAL DEFAULT +10 sg2 +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT UND sG1 +[0-9]+: 00000010 +0 TLS +GLOBAL HIDDEN +10 sh1 - +[0-9]+: 004130e0 +0 NOTYPE GLOBAL DEFAULT ABS _edata + +[0-9]+: 004130d8 +0 NOTYPE GLOBAL DEFAULT ABS _edata +[0-9]+: [0-9a-f]+ +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ +[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end +[0-9]+: 00000014 +0 TLS +GLOBAL HIDDEN +10 sh2 diff --git a/ld/testsuite/ld-sh/tlsbin-3.d b/ld/testsuite/ld-sh/tlsbin-3.d index 59600d4..5a3222b 100644 --- a/ld/testsuite/ld-sh/tlsbin-3.d +++ b/ld/testsuite/ld-sh/tlsbin-3.d @@ -8,5 +8,5 @@ .*: +file format elf32-sh.* Contents of section \.got: - 4130c0 [0-9a-f]+ 00000000 00000000 [0-9a-f]+ .* - 4130d0 00000000 00000000 00000000 00000000 .* + 4130b8 [0-9a-f]+ 00000000 00000000 [0-9a-f]+ .* + 4130c8 00000000 00000000 00000000 00000000 .* diff --git a/ld/testsuite/ld-sh/tlstpoff-1.d b/ld/testsuite/ld-sh/tlstpoff-1.d index 2364b1e..25de25b 100644 --- a/ld/testsuite/ld-sh/tlstpoff-1.d +++ b/ld/testsuite/ld-sh/tlstpoff-1.d @@ -16,7 +16,7 @@ Disassembly of section \.text: [0-9a-f]+: 0c 3c add r0,r12 [0-9a-f]+: 02 d0 mov.l [0-9a-f]+ <foo\+0x14>,r0 ! 0xc [0-9a-f]+: 12 01 stc gbr,r1 - [0-9a-f]+: ce 00 mov.l @\(r0,r12\),r0 + [0-9a-f]+: 09 00 nop [0-9a-f]+: 03 a0 bra [0-9a-f]+ <foo\+0x18> [0-9a-f]+: 0c 31 add r0,r1 [0-9a-f]+: 09 00 nop diff --git a/ld/testsuite/ld-sh/tlstpoff-2.d b/ld/testsuite/ld-sh/tlstpoff-2.d index ee928fd..519c6ef 100644 --- a/ld/testsuite/ld-sh/tlstpoff-2.d +++ b/ld/testsuite/ld-sh/tlstpoff-2.d @@ -5,8 +5,4 @@ #readelf: -r #target: sh*-*-linux* sh*-*-netbsd* -Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 2 entries: - Offset +Info +Type +Sym\.Value +Sym\. Name \+ Addend -0+[0-9a-f]+ 00000097 R_SH_TLS_TPOFF32 +0+04 -0+[0-9a-f]+ 00000097 R_SH_TLS_TPOFF32 +0+04 - +There are no relocations in this file. |