This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Patch gas/mach-o] let obj-mach-o know if we're generating 64b code.
- From: Iain Sandoe <developer at sandoe-acoustics dot co dot uk>
- To: binutils Development <binutils at sourceware dot org>
- Cc: Tristan Gingold <gingold at adacore dot com>
- Date: Fri, 17 Feb 2012 20:06:03 +0000
- Subject: [Patch gas/mach-o] let obj-mach-o know if we're generating 64b code.
Although there are changes to tc-i386.c, they are local to a mach-o
ifdef'd section.
for some reloc insertion, processing and validation, we need to act
differently if the code gen is 64bit.
this copies the flag from the tc file - I did this because the call
arguments of the relevant routines are generally fixed - so rather
than having a lot of dummy routines in tc-i386.c whose only purpose
would be to pick up the value of object_64_bit.
OK?
Iain
gas:
* config/obj-macho.c (obj_mach_o_generating_64_bit): New var.
* config/obj-macho.h (obj_mach_o_generating_64_bit): Declare.
* config/tc-i386.c (i386_target_format): Set
obj_mach_o_generating_64_bit
gas/config/obj-macho.c | 6 ++++++
gas/config/obj-macho.h | 4 ++++
gas/config/tc-i386.c | 8 ++++++--
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index 632eafa..bb33281 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -56,8 +56,14 @@ static int obj_mach_o_is_static;
/* TODO: Implement the "-n" command line option to suppress the
initial
switch to the text segment. */
+
static int obj_mach_o_start_with_text_section = 1;
+/* We need, for a number of relocation and checking processes, to
know if we
+ are generating 64 bit code. */
+
+int obj_mach_o_generating_64_bit;
+
/* Allow for special re-ordering on output. */
static int obj_mach_o_seen_objc_section;
diff --git a/gas/config/obj-macho.h b/gas/config/obj-macho.h
index b49038c..3fbf91f 100644
--- a/gas/config/obj-macho.h
+++ b/gas/config/obj-macho.h
@@ -30,6 +30,10 @@
#define OUTPUT_FLAVOR bfd_target_mach_o_flavour
+/* We need, for a number of relocation processes, to know if we are
generating
+ 64 bit code. */
+extern int obj_mach_o_generating_64_bit;
+
/* We want to control how the sections are pre-defined on startup. */
#define obj_begin() mach_o_begin ()
extern void mach_o_begin (void);
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 97cb68e..4569222 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -8872,12 +8872,16 @@ i386_target_format (void)
case bfd_target_mach_o_flavour:
if (flag_code == CODE_64BIT)
{
- use_rela_relocations = 1;
object_64bit = 1;
+ obj_mach_o_generating_64_bit = 1;
return "mach-o-x86-64";
}
else
- return "mach-o-i386";
+ {
+ object_64bit = 0;
+ obj_mach_o_generating_64_bit = 0;
+ return "mach-o-i386";
+ }
#endif
default:
abort ();