Fix build error in aarch64-linux-tdep.c on macOS

Message ID 20180920202212.26274-1-simon.marchi@ericsson.com
State New, archived
Headers

Commit Message

Simon Marchi Sept. 20, 2018, 8:22 p.m. UTC
  When building with --enable-targets=all on macOS, I get this error:

  CXX    aarch64-linux-tdep.o
/Users/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c:328:7: error: no matching function for call to 'store_integer'
      store_integer ((gdb_byte *)&vg_target, sizeof (uint64_t), byte_order,
      ^~~~~~~~~~~~~
/Users/simark/src/binutils-gdb/gdb/defs.h:556:13: note: candidate template ignored: requirement 'Or<is_same<unsigned long long, long>, is_same<unsigned long long, unsigned long> >::value' was not satisfied [with T = unsigned long long]
extern void store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
            ^

I believe it's because uint64_t is defined as "unsigned long long" on macOS,
even though "unsigned long" is also 64 bits.  Other 64-bits platforms define
uint64_t as "unsigned long".

This makes the type of the argument to store_integer (unsigned long long) not
match the requirement that it must be the same as ULONGEST, which is unsigned
long.

Fix it by changing the type of the vl variable to be ULONGEST, which is what
extract_unsigned_integer returns anyway.

gdb/ChangeLog:

	* aarch64-linux-tdep.c (aarch64_linux_supply_sve_regset): Change type
	of vl to ULONGEST.
---
 gdb/aarch64-linux-tdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Kevin Buettner Sept. 20, 2018, 10:13 p.m. UTC | #1
On Thu, 20 Sep 2018 20:22:26 +0000
Simon Marchi <simon.marchi@ericsson.com> wrote:

> Fix it by changing the type of the vl variable to be ULONGEST, which is what
> extract_unsigned_integer returns anyway.
> 
> gdb/ChangeLog:
> 
> 	* aarch64-linux-tdep.c (aarch64_linux_supply_sve_regset): Change type
> 	of vl to ULONGEST.

LGTM.

Kevin
  
Simon Marchi Sept. 23, 2018, 2:13 p.m. UTC | #2
On 2018-09-20 6:13 p.m., Kevin Buettner wrote:
> On Thu, 20 Sep 2018 20:22:26 +0000
> Simon Marchi <simon.marchi@ericsson.com> wrote:
> 
>> Fix it by changing the type of the vl variable to be ULONGEST, which is what
>> extract_unsigned_integer returns anyway.
>>
>> gdb/ChangeLog:
>>
>> 	* aarch64-linux-tdep.c (aarch64_linux_supply_sve_regset): Change type
>> 	of vl to ULONGEST.
> 
> LGTM.
> 
> Kevin
> 

Thanks, I pushed it.

Simon
  

Patch

diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index dc2b89121a6..42cd49e0154 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -316,7 +316,7 @@  aarch64_linux_supply_sve_regset (const struct regset *regset,
      passed in SVE regset or a NEON fpregset.  */
 
   /* Extract required fields from the header.  */
-  uint64_t vl = extract_unsigned_integer (header + SVE_HEADER_VL_OFFSET,
+  ULONGEST vl = extract_unsigned_integer (header + SVE_HEADER_VL_OFFSET,
 					  SVE_HEADER_VL_LENGTH, byte_order);
   uint16_t flags = extract_unsigned_integer (header + SVE_HEADER_FLAGS_OFFSET,
 					     SVE_HEADER_FLAGS_LENGTH,