aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-01-14 22:35:41 +0000
committerIan Lance Taylor <ian@airs.com>1994-01-14 22:35:41 +0000
commit38a5f510bcb7f0c5ee302c21caa363c474c3a1fc (patch)
tree4e081d4ff2af1d4489e2b15f16e0a9ff304b527f /bfd
parent46050fe4d0ecf83fa5ebafd2b3834ead87bd2966 (diff)
downloadgdb-38a5f510bcb7f0c5ee302c21caa363c474c3a1fc.zip
gdb-38a5f510bcb7f0c5ee302c21caa363c474c3a1fc.tar.gz
gdb-38a5f510bcb7f0c5ee302c21caa363c474c3a1fc.tar.bz2
* elfcode.h (elf_object_p): If there is a SHT_DYNAMIC section, set
the DYNAMIC flag for the BFD. (NAME(bfd_elf,write_object_contents)): Don't try to write out a BFD with the DYNAMIC flag set, since we don't generate the program header table correctly.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog13
-rw-r--r--bfd/elfcode.h23
2 files changed, 30 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f50f5bb..b6e6912 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,16 @@
+Fri Jan 14 16:45:43 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * elfcode.h (elf_object_p): If there is a SHT_DYNAMIC section, set
+ the DYNAMIC flag for the BFD.
+ (NAME(bfd_elf,write_object_contents)): Don't try to write out a
+ BFD with the DYNAMIC flag set, since we don't generate the program
+ header table correctly.
+
+Fri Jan 14 01:04:36 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
+
+ * elfcode.h (elf_slurp_symbol_table): Free x_symp at the end
+ of the function to avoid storage leak.
+
Thu Jan 13 23:07:32 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* ecoff.c (ecoff_link_write_external): An ifd can be -1.
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index e8a40f7..81a3bca 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -951,6 +951,11 @@ DEFUN (elf_object_p, (abfd), bfd * abfd)
goto got_system_call_error;
elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
elf_elfsections(abfd)[shindex] = i_shdrp + shindex;
+
+ /* If this is a .dynamic section, mark the object file as being
+ dynamically linked. */
+ if (i_shdrp[shindex].sh_type == SHT_DYNAMIC)
+ abfd->flags |= DYNAMIC;
}
if (i_ehdrp->e_shstrndx)
{
@@ -1123,7 +1128,7 @@ write_relocs (abfd, sec, xxx)
int idx;
int use_rela_p = get_elf_backend_data (abfd)->use_rela_p;
asymbol *last_sym = 0;
- int last_sym_idx;
+ int last_sym_idx = 9999999; /* should always be written before use */
if ((sec->flags & SEC_RELOC) == 0)
return;
@@ -2125,7 +2130,7 @@ swap_out_syms (abfd)
}
if (bfd_is_com_section (syms[idx]->section))
- sym.st_info = ELF_ST_INFO (STB_GLOBAL, STT_NOTYPE);
+ sym.st_info = ELF_ST_INFO (STB_GLOBAL, STT_OBJECT);
else if (syms[idx]->section == &bfd_und_section)
sym.st_info = ELF_ST_INFO (STB_GLOBAL, STT_NOTYPE);
else if (syms[idx]->flags & BSF_SECTION_SYM)
@@ -2262,6 +2267,15 @@ DEFUN (NAME(bfd_elf,write_object_contents), (abfd), bfd * abfd)
Elf_Internal_Shdr **i_shdrp;
int count;
+ /* We don't know how to write dynamic objects. Specifically, we
+ don't know how to construct the program header. */
+ if ((abfd->flags & DYNAMIC) != 0)
+ {
+ fprintf (stderr, "Writing ELF dynamic objects is not supported\n");
+ bfd_error = wrong_format;
+ return false;
+ }
+
if (abfd->output_has_begun == false)
{
prep_headers (abfd);
@@ -2473,10 +2487,6 @@ DEFUN (elf_slurp_symbol_table, (abfd, symptrs),
to be prepared to read both (and merge them) or ensure that we
only read the full symbol table. Currently we only get called to
read the full symbol table. -fnf */
- if (bfd_get_outsymbols (abfd) != NULL)
- {
- return true;
- }
/* Read each raw ELF symbol, converting from external ELF form to
internal ELF form, and then using the information to create a
@@ -2608,6 +2618,7 @@ DEFUN (elf_slurp_symbol_table, (abfd, symptrs),
*symptrs = 0; /* Final null pointer */
}
+ free ((PTR) x_symp);
return true;
}