--emit-relocs switch to the linker to preserve relocs in an output executable
+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.
2000-05-16 Catherine Moore <clm@cygnux.com>
* som.c (som_decode_symclass): Recognize weak symbols.
2000-02-08 Mark Elbrecht <snowball3@bigfoot.com>
* coff-go32.c: Update comment. Update copyright.
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)
2000-01-27 Thomas de Lellis <tdel@windriver.com>
* syms.c (bfd_decode_symclass)
* coffcode.h (CREATE_BIG_COFF_TARGET_VEC): New macro.
(CREATE_LITTLE_COFF_TARGET_VEC): New macro.
* 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.
* 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.
}
/* We need to include this archive member. */
}
/* We need to include this archive member. */
element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
if (element == (bfd *) NULL)
goto error_return;
element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
if (element == (bfd *) NULL)
goto error_return;
the linker has decided to not include. */
sec->linker_mark = true;
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)
o->reloc_count += sec->reloc_count;
if (sec->_raw_size > max_contents_size)
/* 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. */
/* 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)
{
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
for (o = sub->sections; o != NULL; o = o->next)
{
/* Start writing out the symbol table. The first symbol is always a
dummy symbol. */
/* 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;
{
elfsym.st_value = 0;
elfsym.st_size = 0;
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. */
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);
{
elfsym.st_size = 0;
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
if (o != NULL)
o->target_index = bfd_get_symcount (abfd);
elfsym.st_shndx = i;
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;
elfsym.st_value = 0;
else
elfsym.st_value = o->vma;
finfo->sections))
return false;
finfo->sections))
return false;
- if (finfo->info->relocateable)
+ if (finfo->info->relocateable || finfo->info->emitrelocations)
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
+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.
2000-05-08 Alan Modra <alan@linuxcare.com.au>
* dis-asm.h (print_insn_tic54x): Declare.
* dis-asm.h (print_insn_i386_att): Declare.
(print_insn_i386_intel): Declare.
* 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.
* dis-asm.h (INIT_DISASSEMBLE_INFO_NO_ARCH): Cast STREAM and
FPRINTF_FUNC to avoid compiler warnings.
(demangling_styles): add new edg_demangling style
(EDG_DEMANGLING_STYLE_STRING): new macro
(EDG_DEMANGLING): new macro
(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.
(DMGL_STYLE_MASK): modify to include new HP's style.
(demangling_styles): add new hp_demangling value.
(HP_DEMANGLING_STYLE_STRING): new macro.
const struct bfd_link_callbacks *callbacks;
/* true if BFD should generate a relocateable object file. */
boolean relocateable;
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;
/* true if BFD should generate a "task linked" object file,
similar to relocatable but also with globals converted to statics. */
boolean task_link;
+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
2000-05-16 Charles Wilson <cwilson@ece.gatech.edu>
* ld/emultempl/pe.em (_open_dynamic_archive): New function: Search
+* 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.
* Added AT> to the linker script language to allow load-time allocation of
sections into regions.
the output. This might take significantly longer and therefore probably
should only be enabled for the final binary.
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
@cindex partial link
@cindex relocatable output
@kindex -r
link_info.callbacks = &link_callbacks;
link_info.relocateable = false;
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;
link_info.shared = false;
link_info.symbolic = false;
link_info.static_link = false;
bfd *abfd;
asection *section;
bfd_vma address;
bfd *abfd;
asection *section;
bfd_vma address;
+ boolean fatal ATTRIBUTE_UNUSED;
{
static char *error_name;
static unsigned int error_count;
{
static char *error_name;
static unsigned int error_count;
'\0', NULL, N_("Ignored for SVR4 compatibility"), ONE_DASH },
{ {"relocateable", no_argument, NULL, 'r'},
'r', NULL, N_("Generate relocateable output"), TWO_DASHES },
'\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'},
{ {NULL, no_argument, NULL, '\0'},
'i', NULL, NULL, ONE_DASH },
{ {"just-symbols", required_argument, NULL, 'R'},
lang_add_output_format (optarg, (char *) NULL, (char *) NULL, 0);
break;
case 'i':
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;
case 'r':
link_info.relocateable = true;
config.build_constructors = false;