This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Committed]: Darwin: enable gas for x86-64
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils Development <binutils at sourceware dot org>
- Date: Fri, 6 Jan 2012 17:23:22 +0100
- Subject: [Committed]: Darwin: enable gas for x86-64
Hi,
this patch enables gas to assemble some trivial program. The hard work (properly handling relocations) will come later…
Committed on trunk.
Tristan.
gas/
2012-01-06 Tristan Gingold <gingold@adacore.com>
* config/tc-i386.c: Update copyright year.
(lex_got): Also defined for Mach-O.
Add a guard for non-ELF configuration.
(md_longopts): Also handle -64 for Mach-O.
(md_parse_option): Likewise.
(i386_target_format): Adjust for x86_64-darwin.
Index: config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.478
diff -c -r1.478 tc-i386.c
*** config/tc-i386.c 1 Aug 2011 23:04:22 -0000 1.478
--- config/tc-i386.c 6 Jan 2012 15:59:10 -0000
***************
*** 6526,6532 ****
fix_new_exp (frag, off, len, exp, 0, r);
}
! #if (!defined (OBJ_ELF) && !defined (OBJ_MAYBE_ELF)) || defined (LEX_AT)
# define lex_got(reloc, adjust, types) NULL
#else
/* Parse operands of the form
--- 6526,6533 ----
fix_new_exp (frag, off, len, exp, 0, r);
}
! #if !(defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (OBJ_MACH_O)) \
! || defined (LEX_AT)
# define lex_got(reloc, adjust, types) NULL
#else
/* Parse operands of the form
***************
*** 6609,6616 ****
--- 6610,6619 ----
char *cp;
unsigned int j;
+ #if defined (OBJ_MAYBE_ELF)
if (!IS_ELF)
return NULL;
+ #endif
for (cp = input_line_pointer; *cp != '@'; cp++)
if (is_end_of_line[(unsigned char) *cp] || *cp == ',')
***************
*** 8283,8289 ****
{
{"32", no_argument, NULL, OPTION_32},
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
! || defined (TE_PE) || defined (TE_PEP))
{"64", no_argument, NULL, OPTION_64},
#endif
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
--- 8286,8292 ----
{
{"32", no_argument, NULL, OPTION_32},
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
! || defined (TE_PE) || defined (TE_PEP) || defined (OBJ_MACH_O))
{"64", no_argument, NULL, OPTION_64},
#endif
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
***************
*** 8341,8347 ****
break;
#endif
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
! || defined (TE_PE) || defined (TE_PEP))
case OPTION_64:
{
const char **list, **l;
--- 8344,8350 ----
break;
#endif
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
! || defined (TE_PE) || defined (TE_PEP) || defined (OBJ_MACH_O))
case OPTION_64:
{
const char **list, **l;
***************
*** 8351,8357 ****
if (CONST_STRNEQ (*l, "elf64-x86-64")
|| strcmp (*l, "coff-x86-64") == 0
|| strcmp (*l, "pe-x86-64") == 0
! || strcmp (*l, "pei-x86-64") == 0)
{
default_arch = "x86_64";
break;
--- 8354,8361 ----
if (CONST_STRNEQ (*l, "elf64-x86-64")
|| strcmp (*l, "coff-x86-64") == 0
|| strcmp (*l, "pe-x86-64") == 0
! || strcmp (*l, "pei-x86-64") == 0
! || strcmp (*l, "mach-o-x86-64") == 0)
{
default_arch = "x86_64";
break;
***************
*** 8773,8779 ****
#endif
#if defined (OBJ_MACH_O)
case bfd_target_mach_o_flavour:
! return flag_code == CODE_64BIT ? "mach-o-x86-64" : "mach-o-i386";
#endif
default:
abort ();
--- 8777,8790 ----
#endif
#if defined (OBJ_MACH_O)
case bfd_target_mach_o_flavour:
! if (flag_code == CODE_64BIT)
! {
! use_rela_relocations = 1;
! object_64bit = 1;
! return "mach-o-x86-64";
! }
! else
! return "mach-o-i386";
#endif
default:
abort ();