0001-sbi_ipi.c-Ignore-address-of-packed-member-warning-wi.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From dbd2fdb9956417e1d49a14b9aea162b10598c6c0 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Thu, 7 Mar 2019 20:48:04 -0800
  4. Subject: [PATCH] sbi_ipi.c: Ignore address-of-packed-member warning with gcc 9
  5. or newer
  6. This is a workaround until fixed correctly, for following error
  7. sbi_ipi.c:34:28: error: taking address of packed member of 'struct sbi_scratch' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  8. | 34 | atomic_raw_set_bit(event, &remote_scratch->ipi_type);
  9. | | ^~~~~~~~~~~~~~~~~~~~~~~~~
  10. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  11. ---
  12. lib/sbi_ipi.c | 12 ++++++++++++
  13. 1 file changed, 12 insertions(+)
  14. diff --git a/lib/sbi_ipi.c b/lib/sbi_ipi.c
  15. index 5f189c8..bc9df11 100644
  16. --- a/lib/sbi_ipi.c
  17. +++ b/lib/sbi_ipi.c
  18. @@ -31,7 +31,13 @@ static int sbi_ipi_send(struct sbi_scratch *scratch, u32 hartid, u32 event)
  19. * trigger the interrupt
  20. */
  21. remote_scratch = sbi_hart_id_to_scratch(scratch, hartid);
  22. +#if __GNUC__ >= 9
  23. +#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
  24. +#endif
  25. atomic_raw_set_bit(event, &remote_scratch->ipi_type);
  26. +#if __GNUC__ >= 9
  27. +#pragma GCC diagnostic pop
  28. +#endif
  29. mb();
  30. sbi_platform_ipi_send(plat, hartid);
  31. if (event != SBI_IPI_EVENT_SOFT)
  32. @@ -97,7 +103,13 @@ void sbi_ipi_process(struct sbi_scratch *scratch)
  33. sbi_hart_hang();
  34. break;
  35. };
  36. +#if __GNUC__ >= 9
  37. +#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
  38. +#endif
  39. ipi_type = atomic_raw_clear_bit(ipi_event, &scratch->ipi_type);
  40. +#if __GNUC__ >= 9
  41. +#pragma GCC diagnostic pop
  42. +#endif
  43. } while(ipi_type > 0);
  44. }
  45. --
  46. 2.21.0