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 gas/mach-o 1/2] implement mach-o subsections-via-symbols.


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. */




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