sections as well.
(elfNN_ia64_final_write_processing): Map .gnu.linkonce.ia64unw.FOO
to .gnu.linkonce.t.FOO text section.
* readelf.c (process_unwind): Print all unwind sections, not just
one.
* config/tc-ia64.c (special_linkonce_name): New.
(make_unw_section): Map .gnu.linkonce.t.FOO text section into
.gnu.linkonce.ia64unw{,i}.FOO.
(ia64_elf_section_type): Handle .gnu.linkonce.ia64unw{,i}.FOO.
(dot_endp): Add comment about it.
* elf/ia64.h (ELF_STRING_ia64_unwind_once): Define.
(ELF_STRING_ia64_unwind_info_once): Define.
* emulparams/elf64_ia64.sh (OTHER_READONLY_SECTIONS): Put
.gnu.linkonce.ia64unw{,i} sections into corresponding .IA_64.unwind*
output sections.
* emulparams/elf64_aix.sh (OTHER_READONLY_SECTIONS): Likewise.
+2001-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (is_unwind_section_name): Consider linkonce unwind
+ sections as well.
+ (elfNN_ia64_final_write_processing): Map .gnu.linkonce.ia64unw.FOO
+ to .gnu.linkonce.t.FOO text section.
+
2001-05-11 Jakub Jelinek <jakub@redhat.com>
* merge.c (struct sec_merge_hash_entry): Add u.entsize and u.suffix
is_unwind_section_name (name)
const char *name;
{
- size_t len1, len2;
+ size_t len1, len2, len3;
len1 = sizeof (ELF_STRING_ia64_unwind) - 1;
len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
- return (strncmp (name, ELF_STRING_ia64_unwind, len1) == 0
- && strncmp (name, ELF_STRING_ia64_unwind_info, len2) != 0);
+ len3 = sizeof (ELF_STRING_ia64_unwind_once) - 1;
+ return ((strncmp (name, ELF_STRING_ia64_unwind, len1) == 0
+ && strncmp (name, ELF_STRING_ia64_unwind_info, len2) != 0)
+ || strncmp (name, ELF_STRING_ia64_unwind_once, len3) == 0);
}
/* Handle an IA-64 specific section when reading an object file. This
/* .IA_64.unwindFOO -> FOO */
text_sect = bfd_get_section_by_name (abfd, sname);
}
+ else if (sname
+ && (len = sizeof (ELF_STRING_ia64_unwind_once) - 1,
+ strncmp (sname, ELF_STRING_ia64_unwind_once, len)) == 0)
+ {
+ /* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.t.FOO */
+ size_t len2 = sizeof (".gnu.linkonce.t.") - 1;
+ char *once_name = alloca (len2 + strlen (sname) - len + 1);
+
+ memcpy (once_name, ".gnu.linkonce.t.", len2);
+ strcpy (once_name + len2, sname + len);
+ text_sect = bfd_get_section_by_name (abfd, once_name);
+ }
else
/* last resort: fall back on .text */
text_sect = bfd_get_section_by_name (abfd, ".text");
+2001-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ * readelf.c (process_unwind): Print all unwind sections, not just
+ one.
+
2001-05-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* readelf.c (process_unwind): Remove const specifier.
FILE * file;
{
Elf32_Internal_Shdr *sec, *unwsec = NULL, *strsec;
- unsigned long i, addr_size;
+ unsigned long i, addr_size, unwcount = 0, unwstart = 0;
struct unw_aux_info aux;
if (!do_unwind)
aux.strtab, char *, "string table");
}
else if (sec->sh_type == SHT_IA_64_UNWIND)
- unwsec = sec;
- else if (strcmp (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info) == 0)
+ unwcount++;
+ }
+
+ if (!unwcount)
+ printf (_("\nThere are no unwind sections in this file.\n"));
+
+ while (unwcount-- > 0)
+ {
+ char *suffix;
+ size_t len, len2;
+
+ for (i = unwstart, sec = section_headers + unwstart;
+ i < elf_header.e_shnum; ++i, ++sec)
+ if (sec->sh_type == SHT_IA_64_UNWIND)
+ {
+ unwsec = sec;
+ break;
+ }
+
+ unwstart = i + 1;
+ len = sizeof (ELF_STRING_ia64_unwind_once) - 1;
+
+ if (strncmp (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind_once,
+ len) == 0)
+ {
+ /* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.ia64unwi.FOO */
+ len2 = sizeof (ELF_STRING_ia64_unwind_info_once) - 1;
+ suffix = SECTION_NAME (unwsec) + len;
+ for (i = 0, sec = section_headers; i < elf_header.e_shnum;
+ ++i, ++sec)
+ if (strncmp (SECTION_NAME (sec),
+ ELF_STRING_ia64_unwind_info_once, len2) == 0
+ && strcmp (SECTION_NAME (sec) + len2, suffix) == 0)
+ break;
+ }
+ else
+ {
+ /* .IA_64.unwindFOO -> .IA_64.unwind_infoFOO
+ .IA_64.unwind or BAR -> .IA_64.unwind_info */
+ len = sizeof (ELF_STRING_ia64_unwind) - 1;
+ len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
+ suffix = "";
+ if (strncmp (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind,
+ len) == 0)
+ suffix = SECTION_NAME (unwsec) + len;
+ for (i = 0, sec = section_headers; i < elf_header.e_shnum;
+ ++i, ++sec)
+ if (strncmp (SECTION_NAME (sec),
+ ELF_STRING_ia64_unwind_info, len2) == 0
+ && strcmp (SECTION_NAME (sec) + len2, suffix) == 0)
+ break;
+ }
+
+ if (i == elf_header.e_shnum)
+ {
+ printf (_("\nCould not find unwind info section for "));
+
+ if (string_table == NULL)
+ printf ("%d", unwsec->sh_name);
+ else
+ printf ("'%s'", SECTION_NAME (unwsec));
+ }
+ else
{
aux.info_size = sec->sh_size;
aux.info_addr = sec->sh_addr;
GET_DATA_ALLOC (sec->sh_offset, aux.info_size, aux.info,
char *, "unwind info");
- }
- }
- if (unwsec)
- {
- printf (_("\nUnwind section "));
+ printf (_("\nUnwind section "));
- if (string_table == NULL)
- printf ("%d", unwsec->sh_name);
- else
- printf ("'%s'", SECTION_NAME (unwsec));
+ if (string_table == NULL)
+ printf ("%d", unwsec->sh_name);
+ else
+ printf ("'%s'", SECTION_NAME (unwsec));
- printf (_(" at offset 0x%lx contains %lu entries:\n"),
- unwsec->sh_offset, (unsigned long) (unwsec->sh_size / (3 * addr_size)));
+ printf (_(" at offset 0x%lx contains %lu entries:\n"),
+ unwsec->sh_offset,
+ (unsigned long) (unwsec->sh_size / (3 * addr_size)));
- (void) slurp_ia64_unwind_table (file, & aux, unwsec);
+ (void) slurp_ia64_unwind_table (file, & aux, unwsec);
- if (aux.table_len > 0)
- dump_ia64_unwind (& aux);
+ if (aux.table_len > 0)
+ dump_ia64_unwind (& aux);
+
+ if (aux.table)
+ free ((char *) aux.table);
+ if (aux.info)
+ free ((char *) aux.info);
+ aux.table = NULL;
+ aux.info = NULL;
+ }
}
- else
- printf (_("\nThere are no unwind sections in this file.\n"));
- if (aux.table)
- free ((char *) aux.table);
- if (aux.info)
- free ((char *) aux.info);
if (aux.symtab)
free (aux.symtab);
if (aux.strtab)
+2001-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ * config/tc-ia64.c (special_linkonce_name): New.
+ (make_unw_section): Map .gnu.linkonce.t.FOO text section into
+ .gnu.linkonce.ia64unw{,i}.FOO.
+ (ia64_elf_section_type): Handle .gnu.linkonce.ia64unw{,i}.FOO.
+ (dot_endp): Add comment about it.
+
2001-05-11 Nick Clifton <nickc@cambridge.redhat.com>
* config/tc-arm.c (arm_handle_align): When truncating an aligned
{".IA_64.unwind"}, {".IA_64.unwind_info"}
};
+static char *special_linkonce_name[] =
+ {
+ ".gnu.linkonce.ia64unw.", ".gnu.linkonce.ia64unwi."
+ };
+
/* The best template for a particular sequence of up to three
instructions: */
#define N IA64_NUM_TYPES
#define make_unw_section_name(special, text_name, result) \
{ \
char *_prefix = special_section_name[special]; \
- size_t _prefix_len = strlen (_prefix), _text_len = strlen (text_name); \
- char *_result = alloca (_prefix_len + _text_len + 1); \
+ char *_suffix = text_name; \
+ size_t _prefix_len, _suffix_len; \
+ char *_result; \
+ if (strncmp (text_name, ".gnu.linkonce.t.", \
+ sizeof (".gnu.linkonce.t.") - 1) == 0) \
+ { \
+ _prefix = special_linkonce_name[special - SPECIAL_SECTION_UNWIND]; \
+ _suffix += sizeof (".gnu.linkonce.t.") - 1; \
+ } \
+ _prefix_len = strlen (_prefix), _suffix_len = strlen (_suffix); \
+ _result = alloca (_prefix_len + _suffix_len + 1); \
memcpy(_result, _prefix, _prefix_len); \
- memcpy(_result + _prefix_len, text_name, _text_len); \
- _result[_prefix_len + _text_len] = '\0'; \
+ memcpy(_result + _prefix_len, _suffix, _suffix_len); \
+ _result[_prefix_len + _suffix_len] = '\0'; \
result = _result; \
} \
while (0)
if (strncmp (str, ELF_STRING_ia64_unwind_info, len) == 0)
return SHT_PROGBITS;
+ len = sizeof (ELF_STRING_ia64_unwind_info_once) - 1;
+ if (strncmp (str, ELF_STRING_ia64_unwind_info_once, len) == 0)
+ return SHT_PROGBITS;
+
len = sizeof (ELF_STRING_ia64_unwind) - 1;
if (strncmp (str, ELF_STRING_ia64_unwind, len) == 0)
return SHT_IA_64_UNWIND;
+ len = sizeof (ELF_STRING_ia64_unwind_once) - 1;
+ if (strncmp (str, ELF_STRING_ia64_unwind_once, len) == 0)
+ return SHT_IA_64_UNWIND;
+
return -1;
}
.text .IA_64.unwind
.text.foo .IA_64.unwind.text.foo
.foo .IA_64.unwind.foo
+ .gnu.linkonce.t.foo
+ .gnu.linkonce.ia64unw.foo
_info .IA_64.unwind_info gas issues error message (ditto)
_infoFOO .IA_64.unwind_infoFOO gas issues error message (ditto)
+2001-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/ia64.h (ELF_STRING_ia64_unwind_once): Define.
+ (ELF_STRING_ia64_unwind_info_once): Define.
+
2001-05-07 Zack Weinberg <zackw@stanford.edu>
* demangle.h: Use PARAMS for all prototypes.
#define ELF_STRING_ia64_pltoff ".IA_64.pltoff"
#define ELF_STRING_ia64_unwind ".IA_64.unwind"
#define ELF_STRING_ia64_unwind_info ".IA_64.unwind_info"
+#define ELF_STRING_ia64_unwind_once ".gnu.linkonce.ia64unw."
+#define ELF_STRING_ia64_unwind_info_once ".gnu.linkonce.ia64unwi."
/* Bits in the sh_flags field of Elf64_Shdr: */
+2001-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ * emulparams/elf64_ia64.sh (OTHER_READONLY_SECTIONS): Put
+ .gnu.linkonce.ia64unw{,i} sections into corresponding .IA_64.unwind*
+ output sections.
+ * emulparams/elf64_aix.sh (OTHER_READONLY_SECTIONS): Likewise.
+
2001-05-11 Jakub Jelinek <jakub@redhat.com>
* ldlang.c (lang_process): Call bfd_merge_sections.
OTHER_GOT_SYMBOLS='. = ALIGN (8); PROVIDE (__gp = . + 0x200000);'
OTHER_GOT_SECTIONS='.IA_64.pltoff : { *(.IA_64.pltoff) }'
OTHER_PLT_RELOC_SECTIONS='.rela.IA_64.pltoff : { *(.rela.IA_64.pltoff) }'
-OTHER_READONLY_SECTIONS='.opd : { *(.opd) } .IA_64.unwind_info : { *(.IA_64.unwind_info*) } .IA_64.unwind : { *(.IA_64.unwind*) }'
+OTHER_READONLY_SECTIONS='.opd : { *(.opd) } .IA_64.unwind_info : { *(.IA_64.unwind_info*) *(.gnu.linkonce.ia64unwi.*) } .IA_64.unwind : { *(.IA_64.unwind*) *(.gnu.linkonce.ia64unw.*) }'
LIB_PATH=/usr/lib/ia64l64:/usr/lib:/usr/local/lib
NOP=0x00300000010070000002000001000400 # a bundle full of nops
OTHER_GOT_SECTIONS='.IA_64.pltoff : { *(.IA_64.pltoff) }'
OTHER_PLT_RELOC_SECTIONS='.rela.IA_64.pltoff : { *(.rela.IA_64.pltoff) }'
-OTHER_READONLY_SECTIONS='.opd : { *(.opd) } .IA_64.unwind_info : { *(.IA_64.unwind_info*) } .IA_64.unwind : { *(.IA_64.unwind*) }'
+OTHER_READONLY_SECTIONS='.opd : { *(.opd) } .IA_64.unwind_info : { *(.IA_64.unwind_info*) *(.gnu.linkonce.ia64unwi.*) } .IA_64.unwind : { *(.IA_64.unwind*) *(.gnu.linkonce.ia64unw.*) }'