aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMichael Eager <eager@eagercon.com>2018-04-17 14:47:13 -0700
committerMichael Eager <eager@eagercon.com>2018-04-17 14:47:13 -0700
commit3f0a5f17d7fe1f3d0911ad67a5993be59983fb00 (patch)
tree76261ae8c3c1153a62dc11d955eb7502ef6c8483 /ld
parentbedda9aced2b3a8ab05e0fbf1372e394e32afbde (diff)
downloadbinutils-3f0a5f17d7fe1f3d0911ad67a5993be59983fb00.zip
binutils-3f0a5f17d7fe1f3d0911ad67a5993be59983fb00.tar.gz
binutils-3f0a5f17d7fe1f3d0911ad67a5993be59983fb00.tar.bz2
[MicroBlaze] PIC data text relative
Andrew Sadek <andrew.sadek.se@gmail.com> A new implemented feature in GCC Microblaze that allows Position Independent Code to run using Data Text Relative addressing instead of using Global Offset Table. Its aim was to make 'PIC' more efficient and flexible as elf size excess performance overhead were noticed when using GOT due to the indirect addressing. include/ChangeLog: * bfdlink.h (Add flag): Add new flag @ 'bfd_link_info' struct. * elf/microblaze.h (Add 3 new relocations): R_MICROBLAZE_TEXTPCREL_64, R_MICROBLAZE_TEXTREL_64 and R_MICROBLAZE_TEXTREL_32_LO for relax function. bfd/ChangeLog: * bfd/reloc.c (2 new BFD relocations): BFD_RELOC_MICROBLAZE_64_TEXTPCREL & BFD_RELOC_MICROBLAZE_64_TEXTPCREL * bfd/bfd-in2.h: Regenerate * bfd/libbfd.h: Regenerate * bfd/elf32-microblaze.c (Handle new relocs): define 'HOWTO' of 3 new relocs and handle them in both relocate and relax functions. (microblaze_elf_reloc_type_lookup): add mapping between for new bfd relocs. (microblaze_elf_relocate_section): Handle new relocs in case of elf relocation. (microblaze_elf_relax_section): Handle new relocs for elf relaxation. gas/ChangeLog: * gas/config/tc-microblaze.c (Handle new relocs directives in assembler): Handle new relocs from compiler output. (imm_types): add new imm types for data text relative addressing TEXT_OFFSET, TEXT_PC_OFFSET (md_convert_frag): conversion for BFD_RELOC_MICROBLAZE_64_TEXTPCREL, BFD_RELOC_MICROBLAZE_64_TEXTPCREL (md_apply_fix): apply fix for BFD_RELOC_MICROBLAZE_64_TEXTPCREL, BFD_RELOC_MICROBLAZE_64_TEXTPCREL (md_estimate_size_before_relax): estimate size for BFD_RELOC_MICROBLAZE_64_TEXTPCREL, BFD_RELOC_MICROBLAZE_64_TEXTPCREL (tc_gen_reloc): generate relocations for BFD_RELOC_MICROBLAZE_64_TEXTPCREL, BFD_RELOC_MICROBLAZE_64_TEXTPCREL ld/ChangeLog: * ld/lexsup.c (Add 2 ld options): (ld_options): add disable-multiple-abs-defs @ 'ld_options' array (parse_args): parse new option and pass flag to 'link_info' struct. * ld/ldlex.h (Add enum): add new enum @ 'option_values' enum. * ld/ld.texinfo (Add new option): Add description for 'disable-multiple-abs-defs' * ld/main.c: Initialize flags with false @ 'main'. Handle disable-multiple-abs-defs @ 'mutiple_definition'.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/ld.texinfo5
-rw-r--r--ld/ldlex.h1
-rw-r--r--ld/ldmain.c14
-rw-r--r--ld/lexsup.c8
5 files changed, 35 insertions, 6 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index bdf1e3f..580abaf 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
+2018-04-09 Andrew Sadek <andrew.sadek.se@gmail.com>
+
+ Microblaze Target: PIC data text relative
+
+ * ld/lexsup.c (Add 2 ld options):
+ (ld_options): add disable-multiple-abs-defs @ 'ld_options' array
+ (parse_args): parse new option and pass flag to 'link_info' struct.
+ * ld/ldlex.h (Add enum): add new enum @ 'option_values' enum.
+ * ld/ld.texinfo (Add new option): Add description for
+ 'disable-multiple-abs-defs'
+ * ld/main.c: Initialize flags with false @ 'main'. Handle
+ disable-multiple-abs-defs @ 'mutiple_definition'.
+
2018-04-16 Alan Modra <amodra@gmail.com>
* emultempl/sunos.em: Delete.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 9679afd..40d79dd 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -1561,6 +1561,11 @@ that the relocs are stored in a target specific section. This option
is only supported by the @samp{BFIN}, @samp{CR16} and @emph{M68K}
targets.
+@kindex --disable-multiple-abs-defs
+@item --disable-multiple-abs-defs
+Do not allow multiple definitions with symbols included
+in filename invoked by -R or --just-symbols
+
@kindex --fatal-warnings
@kindex --no-fatal-warnings
@item --fatal-warnings
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 1ecb152..04d6fd5 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -143,6 +143,7 @@ enum option_values
OPTION_IGNORE_UNRESOLVED_SYMBOL,
OPTION_PUSH_STATE,
OPTION_POP_STATE,
+ OPTION_DISABLE_MULTIPLE_DEFS_ABS,
OPTION_PRINT_MEMORY_USAGE,
OPTION_REQUIRE_DEFINED_SYMBOL,
OPTION_ORPHAN_HANDLING,
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 43602fe..f31eeb2 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -280,6 +280,7 @@ main (int argc, char **argv)
link_info.keep_memory = TRUE;
link_info.combreloc = TRUE;
link_info.strip_discarded = TRUE;
+ link_info.prohibit_multiple_definition_absolute = FALSE;
link_info.emit_hash = DEFAULT_EMIT_SYSV_HASH;
link_info.emit_gnu_hash = DEFAULT_EMIT_GNU_HASH;
link_info.callbacks = &link_callbacks;
@@ -968,12 +969,13 @@ multiple_definition (struct bfd_link_info *info,
discarded, and this is not really a multiple definition at all.
FIXME: It would be cleaner to somehow ignore symbols defined in
sections which are being discarded. */
- if ((osec->output_section != NULL
- && !bfd_is_abs_section (osec)
- && bfd_is_abs_section (osec->output_section))
- || (nsec->output_section != NULL
- && !bfd_is_abs_section (nsec)
- && bfd_is_abs_section (nsec->output_section)))
+ if (!info->prohibit_multiple_definition_absolute
+ && ((osec->output_section != NULL
+ && ! bfd_is_abs_section (osec)
+ && bfd_is_abs_section (osec->output_section))
+ || (nsec->output_section != NULL
+ && !bfd_is_abs_section (nsec)
+ && bfd_is_abs_section (nsec->output_section))))
return;
name = h->root.string;
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 636ce17..a4bc7da 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -314,6 +314,11 @@ static const struct ld_option ld_options[] =
{ {"demangle", optional_argument, NULL, OPTION_DEMANGLE},
'\0', N_("[=STYLE]"), N_("Demangle symbol names [using STYLE]"),
TWO_DASHES },
+ { {"disable-multiple-abs-defs", no_argument, NULL,
+ OPTION_DISABLE_MULTIPLE_DEFS_ABS},
+ '\0', NULL, N_("Do not allow multiple definitions with symbols included\n"
+ " in filename invoked by -R or --just-symbols"),
+ TWO_DASHES},
{ {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
'\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
{ {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL},
@@ -1159,6 +1164,9 @@ parse_args (unsigned argc, char **argv)
case OPTION_NO_STRIP_DISCARDED:
link_info.strip_discarded = FALSE;
break;
+ case OPTION_DISABLE_MULTIPLE_DEFS_ABS:
+ link_info.prohibit_multiple_definition_absolute = TRUE;
+ break;
case OPTION_SHARED:
if (config.has_shared)
{