This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add .refsym to msp430 backend


Committed.

* config/tc-msp430.c (msp430_refsym): New: ".refsym <symbol>"
* doc/c-msp430.texi (MSP430 Directives): Document it.

The purpose of this patch is to provide a way for one object file
to require the inclusion of another object, without having to
allocate space for a .word address reference.
---
 gas/ChangeLog          |    5 +++++
 gas/config/tc-msp430.c |   10 ++++++++++
 gas/doc/c-msp430.texi  |    9 +++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 6a64141..79ab63a 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-22  DJ Delorie  <dj@redhat.com>
+
+	* config/tc-msp430.c (msp430_refsym): New: ".refsym <symbol>"
+	* doc/c-msp430.texi (MSP430 Directives): Document it.
+
 2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
 
 	* config/tc-i386.c (check_VecOperands): Remove regzmm from AVX2
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index c2a7b9b..189319e 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -1257,6 +1257,15 @@ msp430_section (int arg)
   obj_elf_section (arg);
 }
 
+static void
+msp430_refsym (int arg ATTRIBUTE_UNUSED)
+{
+  char sym_name[1024];
+  input_line_pointer = extract_word (input_line_pointer, sym_name, 1024);
+
+  (void) symbol_find_or_make (sym_name);
+}
+
 const pseudo_typeS md_pseudo_table[] =
 {
   {"arch", msp430_set_arch, OPTION_MMCU},
@@ -1267,6 +1276,7 @@ const pseudo_typeS md_pseudo_table[] =
   {"sect", msp430_section, 0},
   {"sect.s", msp430_section, 0},
   {"pushsection", msp430_section, 1},
+  {"refsym", msp430_refsym, 0},
   {NULL, NULL, 0}
 };
 
diff --git a/gas/doc/c-msp430.texi b/gas/doc/c-msp430.texi
index 77d6fd1..4a46961 100644
--- a/gas/doc/c-msp430.texi
+++ b/gas/doc/c-msp430.texi
@@ -263,6 +263,15 @@ command line option.
 @item .profiler
 This directive instructs assembler to add new profile entry to the object file.
 
+@cindex @code{refsym} directive, MSP 430
+@item .refsym
+This directive instructs assembler to add an undefined reference to
+the symbol following the directive.  The maximum symbol name length is
+1023 characters.  No relocation is created for this symbol; it will
+exist purely for pulling in object files from archives.  Note that
+this reloc is not sufficient to prevent garbage collection; use a
+KEEP() directive in the linker file to preserve such objects.
+
 @end table
 
 @node MSP430 Opcodes
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]