aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog16
-rw-r--r--bfd/elflink.h13
-rw-r--r--include/ChangeLog10
-rw-r--r--include/bfdlink.h2
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/NEWS6
-rw-r--r--ld/ld.texinfo10
-rw-r--r--ld/ldmain.c3
-rw-r--r--ld/lexsup.c5
9 files changed, 60 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5dbe6a2..5e98cb9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2000-05-17 S. Bharadwaj Yadavalli <sby@scrugs.lkg.dec.com>
+ Rick Gorton <gorton@scrugs.lkg.dec.com>
+
+ * elflink.h: Add emitrelocations support: when enabled, relocation
+ information and relocation sections are put into final output
+ executables. If the emitrelocations flag is set, do the following:
+ (elf_bfd_final_link): Emit relocation sections.
+ (elf_link_input_bfd): Compute relocation section contents.
+ (elf_gc_sections): Don't clean relocation sections.
+
2000-05-16 Catherine Moore <clm@cygnux.com>
* som.c (som_decode_symclass): Recognize weak symbols.
@@ -1246,7 +1256,7 @@ Thu Feb 10 20:07:50 GMT 2000 Toshiyasu Morita (toshi.morita@sega.com)
2000-02-08 Mark Elbrecht <snowball3@bigfoot.com>
* coff-go32.c: Update comment. Update copyright.
-
+
2000-01-27 Thomas de Lellis <tdel@windriver.com>
* syms.c (bfd_decode_symclass)
@@ -2603,8 +2613,8 @@ Mon Jul 19 14:03:44 1999 Mark P. Mitchell <mark@codesourcery.com>
* coffcode.h (CREATE_BIG_COFF_TARGET_VEC): New macro.
(CREATE_LITTLE_COFF_TARGET_VEC): New macro.
- * aix386-core.c: Initialise new field of bfd_target structure.
- * aout-adobe.c: Initialise new field of bfd_target structure.
+ * aix386-core.c: Initialise new field of bfd_target structure.
+ * aout-adobe.c: Initialise new field of bfd_target structure.
* aout-arm.c: Initialise new field of bfd_target structure.
* aout-target.h: Initialise new field of bfd_target structure.
* aout-tic30.c: Initialise new field of bfd_target structure.
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 16f2f98..fc3f1d1 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -357,7 +357,6 @@ elf_link_add_archive_symbols (abfd, info)
}
/* We need to include this archive member. */
-
element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
if (element == (bfd *) NULL)
goto error_return;
@@ -4104,7 +4103,7 @@ elf_bfd_final_link (abfd, info)
the linker has decided to not include. */
sec->linker_mark = true;
- if (info->relocateable)
+ if (info->relocateable || info->emitrelocations)
o->reloc_count += sec->reloc_count;
if (sec->_raw_size > max_contents_size)
@@ -4172,7 +4171,7 @@ elf_bfd_final_link (abfd, info)
/* Figure out how many relocations we will have in each section.
Just using RELOC_COUNT isn't good enough since that doesn't
maintain a separate value for REL vs. RELA relocations. */
- if (info->relocateable)
+ if (info->relocateable || info->emitrelocations)
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
for (o = sub->sections; o != NULL; o = o->next)
{
@@ -4280,7 +4279,7 @@ elf_bfd_final_link (abfd, info)
/* Start writing out the symbol table. The first symbol is always a
dummy symbol. */
- if (info->strip != strip_all || info->relocateable)
+ if (info->strip != strip_all || info->relocateable || info->emitrelocations)
{
elfsym.st_value = 0;
elfsym.st_size = 0;
@@ -4313,7 +4312,7 @@ elf_bfd_final_link (abfd, info)
symbols have no names. We store the index of each one in the
index field of the section, so that we can find it again when
outputting relocs. */
- if (info->strip != strip_all || info->relocateable)
+ if (info->strip != strip_all || info->relocateable || info->emitrelocations)
{
elfsym.st_size = 0;
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
@@ -4324,7 +4323,7 @@ elf_bfd_final_link (abfd, info)
if (o != NULL)
o->target_index = bfd_get_symcount (abfd);
elfsym.st_shndx = i;
- if (info->relocateable || o == NULL)
+ if (info->relocateable || info->emitrelocations || o == NULL)
elfsym.st_value = 0;
else
elfsym.st_value = o->vma;
@@ -5492,7 +5491,7 @@ elf_link_input_bfd (finfo, input_bfd)
finfo->sections))
return false;
- if (finfo->info->relocateable)
+ if (finfo->info->relocateable || finfo->info->emitrelocations)
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
diff --git a/include/ChangeLog b/include/ChangeLog
index 70bd96a..76e73fb 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2000-05-17 S. Bharadwaj Yadavalli <sby@scrugs.lkg.dec.com>
+ Rick Gorton <gorton@scrugs.lkg.dec.com>
+
+ * bfdlink.h (struct bfd_link_info): Add emitrelocations flag.
+
2000-05-08 Alan Modra <alan@linuxcare.com.au>
* dis-asm.h (print_insn_tic54x): Declare.
@@ -269,7 +274,7 @@ Mon Feb 1 21:05:46 1999 Catherine Moore <clm@cygnus.com>
* dis-asm.h (print_insn_i386_att): Declare.
(print_insn_i386_intel): Declare.
-998-12-30 Michael Meissner <meissner@cygnus.com>
+1998-12-30 Michael Meissner <meissner@cygnus.com>
* dis-asm.h (INIT_DISASSEMBLE_INFO_NO_ARCH): Cast STREAM and
FPRINTF_FUNC to avoid compiler warnings.
@@ -299,8 +304,7 @@ Tue Dec 8 00:30:31 1998 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
(demangling_styles): add new edg_demangling style
(EDG_DEMANGLING_STYLE_STRING): new macro
(EDG_DEMANGLING): new macro
-
- * demangle.h (DMGL_HP): new macro, for HP/aCC compiler.
+ (DMGL_HP): new macro, for HP/aCC compiler.
(DMGL_STYLE_MASK): modify to include new HP's style.
(demangling_styles): add new hp_demangling value.
(HP_DEMANGLING_STYLE_STRING): new macro.
diff --git a/include/bfdlink.h b/include/bfdlink.h
index bb827a3..2285775 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -179,6 +179,8 @@ struct bfd_link_info
const struct bfd_link_callbacks *callbacks;
/* true if BFD should generate a relocateable object file. */
boolean relocateable;
+ /* true if BFD should generate relocation information in the final executable. */
+ boolean emitrelocations;
/* true if BFD should generate a "task linked" object file,
similar to relocatable but also with globals converted to statics. */
boolean task_link;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 38bebc7..5465848 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2000-05-17 S. Bharadwaj Yadavalli <sby@scrugs.lkg.dec.com>
+ Rick Gorton <gorton@scrugs.lkg.dec.com>
+
+ Add support for '-q' == '--emit-relocs' switch.
+ * ldmain.c (main): Default to false.
+ * lexsup.c (parse_args): Turn on emitrelocations flag if set.
+ * NEWS: Describe the emitrelocations switch.
+ * ld.texinfo: Describe the emitrelocations switch.
+
2000-05-16 Charles Wilson <cwilson@ece.gatech.edu>
* ld/emultempl/pe.em (_open_dynamic_archive): New function: Search
diff --git a/ld/NEWS b/ld/NEWS
index f78d4e5..325d8a8 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -2,6 +2,12 @@
Changes in version 2.10:
+* Added ability to emit full relocation information in linked executables,
+ enabled by --emit-relocs. Some post-linkage optimization tools need
+ this information in order to be able to correctly identify and perform
+ symbol relative addressing in the event of changes in section contents
+ (instructions being added or deleted, extending data sections, etc.)
+
* Added AT> to the linker script language to allow load-time allocation of
sections into regions.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index e8c11d9..1ff0ecb 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -588,6 +588,16 @@ If @var{level} is a numeric values greater than zero @code{ld} optimizes
the output. This might take significantly longer and therefore probably
should only be enabled for the final binary.
+@kindex -q
+@kindex --emit-relocs
+@cindex retain relocations in final executable
+@item -q
+@itemx --emit-relocs
+Leave relocation sections and contents in fully linked exececutables.
+Post link analysis and optimization tools may need this information in
+order to perform correct modifications of executables. This results
+in larger executables.
+
@cindex partial link
@cindex relocatable output
@kindex -r
diff --git a/ld/ldmain.c b/ld/ldmain.c
index ba2a592..cfdbdd7 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -214,6 +214,7 @@ main (argc, argv)
link_info.callbacks = &link_callbacks;
link_info.relocateable = false;
+ link_info.emitrelocations = false;
link_info.shared = false;
link_info.symbolic = false;
link_info.static_link = false;
@@ -1150,7 +1151,7 @@ undefined_symbol (info, name, abfd, section, address, fatal)
bfd *abfd;
asection *section;
bfd_vma address;
- boolean fatal;
+ boolean fatal ATTRIBUTE_UNUSED;
{
static char *error_name;
static unsigned int error_count;
diff --git a/ld/lexsup.c b/ld/lexsup.c
index e2aac47..e09b58a 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -205,6 +205,8 @@ static const struct ld_option ld_options[] =
'\0', NULL, N_("Ignored for SVR4 compatibility"), ONE_DASH },
{ {"relocateable", no_argument, NULL, 'r'},
'r', NULL, N_("Generate relocateable output"), TWO_DASHES },
+ { {"emit-relocs", no_argument, NULL, 'q'},
+ 'q', NULL, "Generate relocations in final output", TWO_DASHES },
{ {NULL, no_argument, NULL, '\0'},
'i', NULL, NULL, ONE_DASH },
{ {"just-symbols", required_argument, NULL, 'R'},
@@ -717,6 +719,9 @@ parse_args (argc, argv)
lang_add_output_format (optarg, (char *) NULL, (char *) NULL, 0);
break;
case 'i':
+ case 'q':
+ link_info.emitrelocations = true;
+ break;
case 'r':
link_info.relocateable = true;
config.build_constructors = false;