diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-08-11 08:31:03 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-08-11 08:31:03 +0200 |
commit | e74e2b4c336fad993b0dd31b859af919ad52ec9e (patch) | |
tree | d2da95940234a9ed70a44738a018f4ee2919bd53 /gas | |
parent | e2295dade838ad296e1e1cd1096177058139b6b3 (diff) | |
download | gdb-e74e2b4c336fad993b0dd31b859af919ad52ec9e.zip gdb-e74e2b4c336fad993b0dd31b859af919ad52ec9e.tar.gz gdb-e74e2b4c336fad993b0dd31b859af919ad52ec9e.tar.bz2 |
x86/ELF: fix .ds.x output
The ELF psABI-s are quite clear here: On 32-bit the underlying data type
is 12 bytes long (with 2 bytes of trailing padding), while on 64-bit it
is 16 bytes long (with 6 bytes of padding). Make s_space() capable of
handling 'x' (and 'p') type floating point being other than 12 bytes
wide (also adjusting documentation). This requires duplicating the
definition of X_PRECISION in the target speciifc header; the compiler
would complain if this was out of sync with config/atof-ieee.c.
Note that for now padding space doesn't get separated from actual
storage, which means that things will work correctly only for little-
endian cases, and which also means that by specifying large enough
numbers padding space can be set to non-zero. Since the logic is needed
for a single little-endian architecture only for now, I'm hoping that
this might be acceptable for the time being; otherwise the change will
become more intrusive.
Note also that this brings the emitted data size of .ds.x vs .tfloat in
line for non-ELF targets as well; the issue will be even more obvious
when further taking into account a subsequent patch fixing .dc.x/.dcb.x
(where output sizes currently differ depending on input format).
Extend existing x86 testcases.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-i386.h | 1 | ||||
-rw-r--r-- | gas/doc/as.texi | 4 | ||||
-rw-r--r-- | gas/read.c | 27 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/fp-elf32.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/fp-elf64.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/fp.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/fp.s | 4 |
7 files changed, 38 insertions, 7 deletions
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index f94226e..2dc6312 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -134,6 +134,7 @@ extern bfd_reloc_code_real_type x86_cons (expressionS *, int); extern void x86_cons_fix_new (fragS *, unsigned int, unsigned int, expressionS *, bfd_reloc_code_real_type); +#define X_PRECISION 5 #define X_PRECISION_PAD x86_tfloat_pad () extern int x86_tfloat_pad (void); diff --git a/gas/doc/as.texi b/gas/doc/as.texi index 292c4af2..b8d5b9b 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -5125,13 +5125,13 @@ Emits 8-byte values. @item @samp{.l} Emits 4-byte values. @item @samp{.p} -Emits 12-byte values. +Emits values with size matching packed-decimal floating-point ones. @item @samp{.s} Emits 4-byte values. @item @samp{.w} Emits 2-byte values. @item @samp{.x} -Emits 12-byte values. +Emits values with size matching long double precision floating-point ones. @end table Note - unlike the @code{.dcb} directive the @samp{.d}, @samp{.s} and @samp{.x} @@ -382,10 +382,10 @@ static const pseudo_typeS potable[] = { {"ds.b", s_space, 1}, {"ds.d", s_space, 8}, {"ds.l", s_space, 4}, - {"ds.p", s_space, 12}, + {"ds.p", s_space, 'p'}, {"ds.s", s_space, 4}, {"ds.w", s_space, 2}, - {"ds.x", s_space, 12}, + {"ds.x", s_space, 'x'}, {"debug", s_ignore, 0}, #ifdef S_SET_DESC {"desc", s_desc, 0}, @@ -3327,6 +3327,29 @@ s_space (int mult) md_flush_pending_output (); #endif + switch (mult) + { + case 'x': +#ifdef X_PRECISION +# ifndef P_PRECISION +# define P_PRECISION X_PRECISION +# define P_PRECISION_PAD X_PRECISION_PAD +# endif + mult = (X_PRECISION + X_PRECISION_PAD) * sizeof (LITTLENUM_TYPE); + if (!mult) +#endif + mult = 12; + break; + + case 'p': +#ifdef P_PRECISION + mult = (P_PRECISION + P_PRECISION_PAD) * sizeof (LITTLENUM_TYPE); + if (!mult) +#endif + mult = 12; + break; + } + #ifdef md_cons_align md_cons_align (1); #endif diff --git a/gas/testsuite/gas/i386/fp-elf32.d b/gas/testsuite/gas/i386/fp-elf32.d index 6ef9c83a..9e12546 100644 --- a/gas/testsuite/gas/i386/fp-elf32.d +++ b/gas/testsuite/gas/i386/fp-elf32.d @@ -9,4 +9,5 @@ Contents of section .data: 0010 4f930a40 789a5440 789a5440 00000000 .* 0020 e65e1710 20395e3b e65e1710 20395e3b .* 0030 00000000 0000a044 01000000 0000a044 .* - 0040 00000000 0000f03f .* + 0040 00000000 0000f03f 00000000 00000000 .* + 0050 ffffffff ffffffff ffffffff cccccccc .* diff --git a/gas/testsuite/gas/i386/fp-elf64.d b/gas/testsuite/gas/i386/fp-elf64.d index 2e68ac8..0314929 100644 --- a/gas/testsuite/gas/i386/fp-elf64.d +++ b/gas/testsuite/gas/i386/fp-elf64.d @@ -9,4 +9,5 @@ Contents of section .data: 0010 71a37909 4f930a40 789a5440 789a5440 .* 0020 e65e1710 20395e3b e65e1710 20395e3b .* 0030 00000000 0000a044 01000000 0000a044 .* - 0040 00000000 0000f03f .* + 0040 00000000 0000f03f 00000000 00000000 .* + 0050 ffffffff ffffffff ffffffff ffffffff .* diff --git a/gas/testsuite/gas/i386/fp.d b/gas/testsuite/gas/i386/fp.d index edf79ff..dd7e028 100644 --- a/gas/testsuite/gas/i386/fp.d +++ b/gas/testsuite/gas/i386/fp.d @@ -8,4 +8,5 @@ Contents of section .data: 0010 0a40789a 5440789a 54400000 00000000 .* 0020 e65e1710 20395e3b e65e1710 20395e3b .* 0030 00000000 0000a044 01000000 0000a044 .* - 0040 00000000 0000f03f .* + 0040 00000000 0000f03f 00000000 00000000 .* + 0050 ffffffff ffffffff ffffcccc cccccccc .* diff --git a/gas/testsuite/gas/i386/fp.s b/gas/testsuite/gas/i386/fp.s index fca56f2..601709c 100644 --- a/gas/testsuite/gas/i386/fp.s +++ b/gas/testsuite/gas/i386/fp.s @@ -20,3 +20,7 @@ .double 37778931862957165903873.0 # Ensure we handle a crazy number of digits .double 1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 + .p2align 4,0 + + .ds.x 1, -1 + .p2align 4,0xcc |