diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-08-11 08:31:41 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-08-11 08:31:41 +0200 |
commit | 8f2200fe8e7f17295ed6d9bbc908da533c95e089 (patch) | |
tree | fc606ca2fff1395fc1965304f92a2440d21e986d /gas/read.c | |
parent | e74e2b4c336fad993b0dd31b859af919ad52ec9e (diff) | |
download | binutils-gdb-8f2200fe8e7f17295ed6d9bbc908da533c95e089.tar.gz |
x86/ELF: fix .tfloat output with hex input
The ELF psABI-s are quite clear here: On 32-bit the 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 hex_float() capable of
handling such padding.
Note that this brings the emitted data size of .dc.x / .dcb.x in line
also for non-ELF targets; so far they were different depending on input
format (dec vs hex).
Extend the existing x86 testcases.
Diffstat (limited to 'gas/read.c')
-rw-r--r-- | gas/read.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gas/read.c b/gas/read.c index 6bba696cebc..b8e845dd569 100644 --- a/gas/read.c +++ b/gas/read.c @@ -4847,7 +4847,7 @@ parse_repeat_cons (expressionS *exp, unsigned int nbytes) static int hex_float (int float_type, char *bytes) { - int length; + int length, pad = 0; int i; switch (float_type) @@ -4868,12 +4868,22 @@ hex_float (int float_type, char *bytes) case 'x': case 'X': - length = 12; +#ifdef X_PRECISION + length = X_PRECISION * sizeof (LITTLENUM_TYPE); + pad = X_PRECISION_PAD * sizeof (LITTLENUM_TYPE); + if (!length) +#endif + length = 12; break; case 'p': case 'P': - length = 12; +#ifdef P_PRECISION + length = P_PRECISION * sizeof (LITTLENUM_TYPE); + pad = P_PRECISION_PAD * sizeof (LITTLENUM_TYPE); + if (!length) +#endif + length = 12; break; default: @@ -4926,7 +4936,9 @@ hex_float (int float_type, char *bytes) memset (bytes, 0, length - i); } - return length; + memset (bytes + length, 0, pad); + + return length + pad; } /* float_cons() |