public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch gas/mach-o 1/2] implement mach-o subsections-via-symbols.
@ 2012-02-17 17:21 Iain Sandoe
  2012-02-20 20:51 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Iain Sandoe @ 2012-02-17 17:21 UTC (permalink / raw)
  To: binutils Development; +Cc: Tristan Gingold

This provides the hooks and variable extensions required to implement  
the scheme.

The addition to frags.h and obj_frob_colon allows this process:
   when we see new externally-visible label:
	start a new frag
	record the symbol in it.

   the pre-relax hook allows the concatenation of frags that comprise  
sub-sections - and sizing thereof.

   the additions to tc-i386.h allow us to force relocs between symbols  
when they lie in different (symbol)subsections.

OK for trunk?
Iain

gas:
	* config/tc-i386.h (OBJ_MACH_O): New section.
	(TC_FORCE_RELOCATION): Use obj_mach_o_force_reloc.
	(TC_FORCE_RELOCATION_SUB_SAME): New
	(TC_FORCE_RELOCATION_SUB_LOCAL): New.
	(TC_VALIDATE_FIX_SUB): New.
	* frags.h (struct frag): OBJ_FRAG_TYPE, new field.
	* symbols.c (colon): obj_frob_colon: New hook.
	* write.c (write_object_file): md_pre_relax_hook, new
	hook.

  gas/config/tc-i386.h |   14 ++++++++++++++
  gas/frags.h          |    3 +++
  gas/subsegs.h        |    3 +++
  gas/symbols.c        |    4 ++++
  gas/write.c          |    4 ++++
  5 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 688c69a..cc86c9d 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/
@@ -316,4 +316,18 @@ void tc_pe_dwarf2_emit_offset (symbolS *,  
unsigned int);
  /* X_add_symbol:X_op_symbol (Intel mode only) */
  #define O_full_ptr O_md2

+#ifdef OBJ_MACH_O
+
+#define TC_FORCE_RELOCATION(FIX) (obj_mach_o_force_reloc (FIX))
+
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX,SEG) \
+	  (obj_mach_o_force_reloc_sub_same (FIX, SEG))
+
+#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX,SEG) \
+	(obj_mach_o_force_reloc_sub_local (FIX, SEG))
+
+#define TC_VALIDATE_FIX_SUB(FIX, SEG) 1
+
+#endif /* OBJ_MACH_O */
+
  #endif /* TC_I386 */
diff --git a/gas/frags.h b/gas/frags.h
index dd247f9..a1fabfb 100644
--- a/gas/frags.h
+++ b/gas/frags.h
@@ -100,6 +100,9 @@ struct frag {
  #ifdef TC_FRAG_TYPE
    TC_FRAG_TYPE tc_frag_data;
  #endif
+#ifdef OBJ_FRAG_TYPE
+  OBJ_FRAG_TYPE obj_frag_data;
+#endif

    /* Data begins here.  */
    char fr_literal[1];
diff --git a/gas/symbols.c b/gas/symbols.c
index 12b2f8f..679534d 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -317,6 +317,10 @@ colon (/* Just seen "x:" - rattle symbols &  
frags.  */
      }
  #endif /* WORKING_DOT_WORD */

+#ifdef obj_frob_colon
+  obj_frob_colon (sym_name);
+#endif
+
    if ((symbolP = symbol_find (sym_name)) != 0)
      {
        S_CLEAR_WEAKREFR (symbolP);
diff --git a/gas/write.c b/gas/write.c
index 5d4e073..f640c61 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -1790,6 +1790,10 @@ write_object_file (void)
        }
    }

+#ifdef md_pre_relax_hook
+  md_pre_relax_hook;
+#endif
+
    /* From now on, we don't care about sub-segments.  Build one frag  
chain
       for each segment. Linked thru fr_next.  */


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch gas/mach-o 1/2] implement mach-o subsections-via-symbols.
  2012-02-17 17:21 [Patch gas/mach-o 1/2] implement mach-o subsections-via-symbols Iain Sandoe
@ 2012-02-20 20:51 ` Alan Modra
  2012-02-21  9:14   ` Iain Sandoe
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2012-02-20 20:51 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: binutils Development, Tristan Gingold

On Fri, Feb 17, 2012 at 05:21:01PM +0000, Iain Sandoe wrote:
> 	* config/tc-i386.h (OBJ_MACH_O): New section.
> 	(TC_FORCE_RELOCATION): Use obj_mach_o_force_reloc.
> 	(TC_FORCE_RELOCATION_SUB_SAME): New
> 	(TC_FORCE_RELOCATION_SUB_LOCAL): New.
> 	(TC_VALIDATE_FIX_SUB): New.
> 	* frags.h (struct frag): OBJ_FRAG_TYPE, new field.
> 	* symbols.c (colon): obj_frob_colon: New hook.
> 	* write.c (write_object_file): md_pre_relax_hook, new
> 	hook.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch gas/mach-o 1/2] implement mach-o subsections-via-symbols.
  2012-02-20 20:51 ` Alan Modra
@ 2012-02-21  9:14   ` Iain Sandoe
  0 siblings, 0 replies; 3+ messages in thread
From: Iain Sandoe @ 2012-02-21  9:14 UTC (permalink / raw)
  To: binutils Development; +Cc: Tristan Gingold


On 20 Feb 2012, at 20:51, Alan Modra wrote:

> On Fri, Feb 17, 2012 at 05:21:01PM +0000, Iain Sandoe wrote:
>> 	* config/tc-i386.h (OBJ_MACH_O): New section.
>> 	(TC_FORCE_RELOCATION): Use obj_mach_o_force_reloc.
>> 	(TC_FORCE_RELOCATION_SUB_SAME): New
>> 	(TC_FORCE_RELOCATION_SUB_LOCAL): New.
>> 	(TC_VALIDATE_FIX_SUB): New.
>> 	* frags.h (struct frag): OBJ_FRAG_TYPE, new field.
>> 	* symbols.c (colon): obj_frob_colon: New hook.
>> 	* write.c (write_object_file): md_pre_relax_hook, new
>> 	hook.
>
> OK.
thanks, applied.
Iain


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-21  9:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-17 17:21 [Patch gas/mach-o 1/2] implement mach-o subsections-via-symbols Iain Sandoe
2012-02-20 20:51 ` Alan Modra
2012-02-21  9:14   ` Iain Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).