diff options
author | Alan Modra <amodra@gmail.com> | 2022-07-07 08:40:26 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-07-09 21:15:30 +0930 |
commit | c30081c1f955a9fea2da8988bab96191e3d2171e (patch) | |
tree | b8ecf3a18a6dcbf012f432928e46daabf0e1826c /gas/as.h | |
parent | d3be5dab558ab91789800a03fc2c1dc3c529eaf5 (diff) | |
download | gdb-c30081c1f955a9fea2da8988bab96191e3d2171e.zip gdb-c30081c1f955a9fea2da8988bab96191e3d2171e.tar.gz gdb-c30081c1f955a9fea2da8988bab96191e3d2171e.tar.bz2 |
gas: utility notes memory alloc functions
Makes it a little easier to use the notes obstack for persistent
storage.
* as.h (gas_mul_overflow): Define.
* symbols.h (notes_alloc, notes_calloc, notes_memdup),
(notes_strdup, notes_concat, notes_free): Declare.
* symbols.c (notes_alloc, notes_calloc, notes_memdup),
(notes_strdup, notes_concat, notes_free): New functions.
(save_symbol_name): Use notes_strdup.
(symbol_create, local_symbol_make, local_symbol_convert),
(symbol_clone, decode_local_label_name): Use notes_alloc.
Diffstat (limited to 'gas/as.h')
-rw-r--r-- | gas/as.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -122,6 +122,14 @@ void *mempcpy(void *, const void *, size_t); #define xfree free +#if GCC_VERSION >= 7000 +#define gas_mul_overflow(a, b, res) __builtin_mul_overflow (a, b, res) +#else +/* Assumes unsigned values. Careful! Args evaluated multiple times. */ +#define gas_mul_overflow(a, b, res) \ + ((*res) = (a), (*res) *= (b), (b) != 0 && (*res) / (b) != (a)) +#endif + #include "asintl.h" #define BAD_CASE(val) \ |