From 357d1bd8fd0ba1a79f347f9d989058ea1615236a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 13 Jun 2012 21:41:07 +0000 Subject: [PATCH] Fix .dc.a for x32 gas/ * config/tc-i386.c (x86_address_bytes): New. * config/tc-i386.h (TC_ADDRESS_BYTES): Likewise. (x86_address_bytes): Likewise. gas/testsuite/ * gas/i386/ilp32/x86-64-dc_a.d: New. * gas/i386/ilp32/x86-64-dc_a.s: Likewise. --- gas/ChangeLog | 6 ++++++ gas/config/tc-i386.c | 11 +++++++++++ gas/config/tc-i386.h | 3 +++ gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/i386/ilp32/x86-64-dc_a.d | 5 +++++ gas/testsuite/gas/i386/ilp32/x86-64-dc_a.s | 5 +++++ 6 files changed, 35 insertions(+) create mode 100644 gas/testsuite/gas/i386/ilp32/x86-64-dc_a.d create mode 100644 gas/testsuite/gas/i386/ilp32/x86-64-dc_a.s diff --git a/gas/ChangeLog b/gas/ChangeLog index a9fc59ab8a5..7860d0f5039 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2012-06-13 H.J. Lu + + * config/tc-i386.c (x86_address_bytes): New. + * config/tc-i386.h (TC_ADDRESS_BYTES): Likewise. + (x86_address_bytes): Likewise. + 2012-06-13 Zhenqiang Chen PR gas/12698 diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index ccf54bcae54..d2b492762f3 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -6619,6 +6619,17 @@ x86_cons_fix_new (fragS *frag, unsigned int off, unsigned int len, fix_new_exp (frag, off, len, exp, 0, r); } +/* Export the ABI address size for use by TC_ADDRESS_BYTES for the + purpose of the `.dc.a' internal pseudo-op. */ + +int +x86_address_bytes (void) +{ + if ((stdoutput->arch_info->mach & bfd_mach_x64_32)) + return 4; + return stdoutput->arch_info->bits_per_address / 8; +} + #if !(defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (OBJ_MACH_O)) \ || defined (LEX_AT) # define lex_got(reloc, adjust, types) NULL diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 51c6cb63826..d4d7d96e046 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -140,6 +140,9 @@ extern void x86_cons (expressionS *, int); extern void x86_cons_fix_new (fragS *, unsigned int, unsigned int, expressionS *); +#define TC_ADDRESS_BYTES x86_address_bytes +extern int x86_address_bytes (void); + #define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */ #define NO_RELOC BFD_RELOC_NONE diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index a729175c011..1129df01bfe 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-06-13 H.J. Lu + + * gas/i386/ilp32/x86-64-dc_a.d: New. + * gas/i386/ilp32/x86-64-dc_a.s: Likewise. + 2012-06-11 Andreas Schwab * gas/ppc/e500mc.d: Update. diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-dc_a.d b/gas/testsuite/gas/i386/ilp32/x86-64-dc_a.d new file mode 100644 index 00000000000..8b2cdcdad4b --- /dev/null +++ b/gas/testsuite/gas/i386/ilp32/x86-64-dc_a.d @@ -0,0 +1,5 @@ +#nm: -n +#name: x86-64 (ILP32) .dc.a + +0+ d foo +0+4 d bar diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-dc_a.s b/gas/testsuite/gas/i386/ilp32/x86-64-dc_a.s new file mode 100644 index 00000000000..46743921d03 --- /dev/null +++ b/gas/testsuite/gas/i386/ilp32/x86-64-dc_a.s @@ -0,0 +1,5 @@ + .data +foo: + .dc.a 0 +bar: + .dc.a 0 -- 2.30.2