public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 0/7] Fix compiler warnings for 32-bit ARM
@ 2021-02-07 21:27 Simon Glass
  2021-02-07 21:27 ` [PATCH 1/7] mkeficapsule: Correct printf() strings Simon Glass
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Simon Glass @ 2021-02-07 21:27 UTC (permalink / raw)
  To: u-boot

These were noticed when building sandbox on a Raspberry Pi 400, which uses
32-bit linux.

To make this work, I enabled CONFIG_HOST_32BIT in 'make menuconfig'. It
would be nice if that were automatic, since we have the logic already in
arch/sandbox/config.mk

There are still many errors of the form:

/usr/bin/ld: warning: arch/sandbox/cpu/start.o uses 2-byte wchar_t yet the
   output is to use 4-byte wchar_t; use of wchar_t values across objects
   may fail

I am not sure how to fix those, but they are not fatal (sandbox still
runs).


Simon Glass (7):
  mkeficapsule: Correct printf() strings
  efi: Fix compiler warnings
  pci: swap_case: Allow compilation on 32-bit machines
  tpm: Correct warning on 32-bit build
  test: acpi: Fix warnings on 32-bit build
  doc: sandbox: Fix up dependencies
  doc: sandbox: Update instructions on quitting

 cmd/efidebug.c                 |  2 +-
 doc/arch/sandbox.rst           | 11 ++++++-----
 drivers/misc/swap_case.c       | 13 +++++++++++--
 drivers/tpm/tpm2_tis_sandbox.c |  2 +-
 lib/efi_loader/efi_capsule.c   |  4 ++--
 lib/efi_loader/efi_firmware.c  |  4 ++--
 test/dm/acpi.c                 | 12 ++++++------
 tools/mkeficapsule.c           | 14 +++++++-------
 8 files changed, 36 insertions(+), 26 deletions(-)

-- 
2.30.0.478.g8a0d178c01-goog

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/7] mkeficapsule: Correct printf() strings
  2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
@ 2021-02-07 21:27 ` Simon Glass
  2021-02-07 23:20   ` Heinrich Schuchardt
  2021-02-07 21:27 ` [PATCH 2/7] efi: Fix compiler warnings Simon Glass
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2021-02-07 21:27 UTC (permalink / raw)
  To: u-boot

Use %z when printing size_t values. This avoids errors on 32-bit
machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/mkeficapsule.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
index 162494907a8..ea6151989e9 100644
--- a/tools/mkeficapsule.c
+++ b/tools/mkeficapsule.c
@@ -278,7 +278,7 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
 	}
 	data = malloc(bin_stat.st_size);
 	if (!data) {
-		printf("cannot allocate memory: %lx\n", bin_stat.st_size);
+		printf("cannot allocate memory: %lx\n", (ulong)bin_stat.st_size);
 		goto err_1;
 	}
 	f = fopen(path, "w");
@@ -297,7 +297,7 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
 
 	size = fwrite(&header, 1, sizeof(header), f);
 	if (size < sizeof(header)) {
-		printf("write failed (%lx)\n", size);
+		printf("write failed (%zx)\n", size);
 		goto err_3;
 	}
 
@@ -306,13 +306,13 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
 	capsule.payload_item_count = 1;
 	size = fwrite(&capsule, 1, sizeof(capsule), f);
 	if (size < (sizeof(capsule))) {
-		printf("write failed (%lx)\n", size);
+		printf("write failed (%zx)\n", size);
 		goto err_3;
 	}
 	offset = sizeof(capsule) + sizeof(u64);
 	size = fwrite(&offset, 1, sizeof(offset), f);
 	if (size < sizeof(offset)) {
-		printf("write failed (%lx)\n", size);
+		printf("write failed (%zx)\n", size);
 		goto err_3;
 	}
 
@@ -329,17 +329,17 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
 
 	size = fwrite(&image, 1, sizeof(image), f);
 	if (size < sizeof(image)) {
-		printf("write failed (%lx)\n", size);
+		printf("write failed (%zx)\n", size);
 		goto err_3;
 	}
 	size = fread(data, 1, bin_stat.st_size, g);
 	if (size < bin_stat.st_size) {
-		printf("read failed (%lx)\n", size);
+		printf("read failed (%zx)\n", size);
 		goto err_3;
 	}
 	size = fwrite(data, 1, bin_stat.st_size, f);
 	if (size < bin_stat.st_size) {
-		printf("write failed (%lx)\n", size);
+		printf("write failed (%zx)\n", size);
 		goto err_3;
 	}
 
-- 
2.30.0.478.g8a0d178c01-goog

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/7] efi: Fix compiler warnings
  2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
  2021-02-07 21:27 ` [PATCH 1/7] mkeficapsule: Correct printf() strings Simon Glass
@ 2021-02-07 21:27 ` Simon Glass
  2021-02-07 21:49   ` Heinrich Schuchardt
  2021-02-07 21:27 ` [PATCH 3/7] pci: swap_case: Allow compilation on 32-bit machines Simon Glass
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2021-02-07 21:27 UTC (permalink / raw)
  To: u-boot

This occur when building on Raspberry Pi 400 (32-bit ARM). Fix them.

Examples:

cmd/efidebug.c: In function ?do_efi_capsule_update?:
cmd/efidebug.c:75:49: warning: cast from pointer to integer of different
	size [-Wpointer-to-int-cast]
  ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
                                                 ^
include/efi_loader.h:104:9: note: in definition of macro ?EFI_CALL?
  typeof(exp) _r = exp; \
         ^~~
cmd/efidebug.c:75:49: warning: cast from pointer to integer of different
	size [-Wpointer-to-int-cast]
  ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
                                                 ^
include/efi_loader.h:104:19: note: in definition of macro ?EFI_CALL?
  typeof(exp) _r = exp; \
                   ^~~

In file included from include/common.h:20,
                 from lib/efi_loader/efi_capsule.c:9:
lib/efi_loader/efi_capsule.c: In function ?efi_update_capsule?:
include/efi_loader.h:83:8: warning: format ?%lu? expects argument of type
	?long unsigned int?, but argument 10 has type ?size_t?
	{aka ?unsigned int?} [-Wformat=]
  debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
        ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:37:21: note: in definition of macro ?pr_fmt?
 #define pr_fmt(fmt) fmt
                     ^~~
include/log.h:229:2: note: in expansion of macro ?log?
  log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \
  ^~~
include/log.h:249:2: note: in expansion of macro ?debug_cond?
  debug_cond(_DEBUG, fmt, ##args)
  ^~~~~~~~~~
include/efi_loader.h:83:2: note: in expansion of macro ?debug?
  debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
  ^~~~~
lib/efi_loader/efi_capsule.c:444:2: note: in expansion of macro ?EFI_ENTRY?
  EFI_ENTRY("%p, %lu, %llu\n", capsule_header_array, capsule_count,
  ^~~~~~~~~
lib/efi_loader/efi_capsule.c:444:19: note: format string is defined here
  EFI_ENTRY("%p, %lu, %llu\n", capsule_header_array, capsule_count,
                 ~~^
                 %u

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 cmd/efidebug.c                | 2 +-
 lib/efi_loader/efi_capsule.c  | 4 ++--
 lib/efi_loader/efi_firmware.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index bbbcb0a5464..09c41c950f7 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -72,7 +72,7 @@ static int do_efi_capsule_update(struct cmd_tbl *cmdtp, int flag,
 		       capsule->capsule_image_size);
 	}
 
-	ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
+	ret = EFI_CALL(RT->update_capsule(&capsule, 1, (uintptr_t)NULL));
 	if (ret) {
 		printf("Cannot handle a capsule at %p", capsule);
 		return CMD_RET_FAILURE;
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 0d5a7b63ec8..1c0462ceb21 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -441,7 +441,7 @@ efi_status_t EFIAPI efi_update_capsule(
 	unsigned int i;
 	efi_status_t ret;
 
-	EFI_ENTRY("%p, %lu, %llu\n", capsule_header_array, capsule_count,
+	EFI_ENTRY("%p, %zu, %llu\n", capsule_header_array, capsule_count,
 		  scatter_gather_list);
 
 	if (!capsule_count) {
@@ -501,7 +501,7 @@ efi_status_t EFIAPI efi_query_capsule_caps(
 	unsigned int i;
 	efi_status_t ret;
 
-	EFI_ENTRY("%p, %lu, %p, %p\n", capsule_header_array, capsule_count,
+	EFI_ENTRY("%p, %zu, %p, %p\n", capsule_header_array, capsule_count,
 		  maximum_capsule_size, reset_type);
 
 	if (!maximum_capsule_size) {
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index 5e401bbca2b..7a3cca27936 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -299,7 +299,7 @@ efi_status_t EFIAPI efi_firmware_fit_set_image(
 	efi_status_t (*progress)(efi_uintn_t completion),
 	u16 **abort_reason)
 {
-	EFI_ENTRY("%p %d %p %ld %p %p %p\n", this, image_index, image,
+	EFI_ENTRY("%p %d %p %zd %p %p %p\n", this, image_index, image,
 		  image_size, vendor_code, progress, abort_reason);
 
 	if (!image || image_index != 1)
@@ -414,7 +414,7 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
 	efi_status_t status;
 	efi_uintn_t capsule_payload_size;
 
-	EFI_ENTRY("%p %d %p %ld %p %p %p\n", this, image_index, image,
+	EFI_ENTRY("%p %d %p %zd %p %p %p\n", this, image_index, image,
 		  image_size, vendor_code, progress, abort_reason);
 
 	if (!image)
-- 
2.30.0.478.g8a0d178c01-goog

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/7] pci: swap_case: Allow compilation on 32-bit machines
  2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
  2021-02-07 21:27 ` [PATCH 1/7] mkeficapsule: Correct printf() strings Simon Glass
  2021-02-07 21:27 ` [PATCH 2/7] efi: Fix compiler warnings Simon Glass
@ 2021-02-07 21:27 ` Simon Glass
  2021-02-07 21:34   ` Heinrich Schuchardt
  2021-02-07 21:27 ` [PATCH 4/7] tpm: Correct warning on 32-bit build Simon Glass
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2021-02-07 21:27 UTC (permalink / raw)
  To: u-boot

At present this driver assumes that ulong is 64-bits long. On 32-bit
machines it is not. Use the 64-bit code only on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/misc/swap_case.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c
index 3cbc8f37ec5..7093ad1cd4f 100644
--- a/drivers/misc/swap_case.c
+++ b/drivers/misc/swap_case.c
@@ -302,7 +302,6 @@ static int sandbox_swap_case_write_io(struct udevice *dev, unsigned int addr,
 }
 
 static int pci_ea_bar2_magic = PCI_EA_BAR2_MAGIC;
-static int pci_ea_bar4_magic = PCI_EA_BAR4_MAGIC;
 
 static int sandbox_swap_case_map_physmem(struct udevice *dev,
 		phys_addr_t addr, unsigned long *lenp, void **ptrp)
@@ -332,12 +331,22 @@ static int sandbox_swap_case_map_physmem(struct udevice *dev,
 			*ptrp = &pci_ea_bar2_magic;
 			*lenp = PCI_CAP_EA_SIZE_LO;
 			break;
+#ifdef CONFIG_HOST_64BIT
+		/*
+		 * This cannot be work on a 32-bit machine since *lenp is ulong
+		 * which is 32-bits, but it needs to have a 64-bit value
+		 * assigned
+		 */
 		case (phys_addr_t)((PCI_CAP_EA_BASE_HI4 << 32) |
-				   PCI_CAP_EA_BASE_LO4):
+				   PCI_CAP_EA_BASE_LO4): {
+			static int pci_ea_bar4_magic = PCI_EA_BAR4_MAGIC;
+
 			*ptrp = &pci_ea_bar4_magic;
 			*lenp = (PCI_CAP_EA_SIZE_HI << 32) |
 				PCI_CAP_EA_SIZE_LO;
 			break;
+		}
+#endif
 		default:
 			return -ENOENT;
 		}
-- 
2.30.0.478.g8a0d178c01-goog

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/7] tpm: Correct warning on 32-bit build
  2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
                   ` (2 preceding siblings ...)
  2021-02-07 21:27 ` [PATCH 3/7] pci: swap_case: Allow compilation on 32-bit machines Simon Glass
@ 2021-02-07 21:27 ` Simon Glass
  2021-02-07 21:31   ` Heinrich Schuchardt
  2021-03-15 15:52   ` Tom Rini
  2021-02-07 21:27 ` [PATCH 5/7] test: acpi: Fix warnings " Simon Glass
                   ` (3 subsequent siblings)
  7 siblings, 2 replies; 17+ messages in thread
From: Simon Glass @ 2021-02-07 21:27 UTC (permalink / raw)
  To: u-boot

Fix the warning:

drivers/tpm/tpm2_tis_sandbox.c: In function ?sandbox_tpm2_xfer?:
drivers/tpm/tpm2_tis_sandbox.c:288:48: warning: format ?%ld? expects
	argument of type ?long int?, but argument 2 has type ?size_t?
	{aka ?unsigned int?} [-Wformat=]
   printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
                                              ~~^
                                              %d
          send_size, length);
          ~~~~~~~~~

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/tpm/tpm2_tis_sandbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
index c74bacfd719..24c804a5645 100644
--- a/drivers/tpm/tpm2_tis_sandbox.c
+++ b/drivers/tpm/tpm2_tis_sandbox.c
@@ -285,7 +285,7 @@ static int sandbox_tpm2_xfer(struct udevice *dev, const u8 *sendbuf,
 	length = get_unaligned_be32(sent);
 	sent += sizeof(length);
 	if (length != send_size) {
-		printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
+		printf("TPM2: Unmatching length, received: %zd, expected: %d\n",
 		       send_size, length);
 		rc = TPM2_RC_SIZE;
 		sandbox_tpm2_fill_buf(recv, recv_len, tag, rc);
-- 
2.30.0.478.g8a0d178c01-goog

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/7] test: acpi: Fix warnings on 32-bit build
  2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
                   ` (3 preceding siblings ...)
  2021-02-07 21:27 ` [PATCH 4/7] tpm: Correct warning on 32-bit build Simon Glass
@ 2021-02-07 21:27 ` Simon Glass
  2021-03-15 15:52   ` Tom Rini
  2021-02-07 21:27 ` [PATCH 6/7] doc: sandbox: Fix up dependencies Simon Glass
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2021-02-07 21:27 UTC (permalink / raw)
  To: u-boot

Some format strings use the wrong type. Fix them.

Example warnings:

In file included from test/dm/acpi.c:22:
test/dm/acpi.c: In function ?dm_test_acpi_cmd_list?:
test/dm/acpi.c:362:21: warning: format ?%lx? expects argument of type
  ?long unsigned int?, but argument 4 has type ?unsigned int? [-Wformat=]
  ut_assert_nextline("RSDP %08lx %06lx (v02 U-BOOT)", addr,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       sizeof(struct acpi_rsdp));
       ~~~~~~~~~~~~~~~~~~~~~~~~
include/test/ut.h:282:33: note: in definition of macro ?ut_assert_nextline?
  if (ut_check_console_line(uts, fmt, ##args)) {   \
                                 ^~~

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/dm/acpi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index e0a323ecd40..9dc9950eddc 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -359,24 +359,24 @@ static int dm_test_acpi_cmd_list(struct unit_test_state *uts)
 	run_command("acpi list", 0);
 	addr = (ulong)map_to_sysmem(buf);
 	ut_assert_nextline("ACPI tables start at %lx", addr);
-	ut_assert_nextline("RSDP %08lx %06lx (v02 U-BOOT)", addr,
+	ut_assert_nextline("RSDP %08lx %06zx (v02 U-BOOT)", addr,
 			   sizeof(struct acpi_rsdp));
 	addr = ALIGN(addr + sizeof(struct acpi_rsdp), 16);
-	ut_assert_nextline("RSDT %08lx %06lx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+	ut_assert_nextline("RSDT %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
 			   addr, sizeof(struct acpi_table_header) +
 			   3 * sizeof(u32), U_BOOT_BUILD_DATE);
 	addr = ALIGN(addr + sizeof(struct acpi_rsdt), 16);
-	ut_assert_nextline("XSDT %08lx %06lx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+	ut_assert_nextline("XSDT %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
 			   addr, sizeof(struct acpi_table_header) +
 			   3 * sizeof(u64), U_BOOT_BUILD_DATE);
 	addr = ALIGN(addr + sizeof(struct acpi_xsdt), 64);
-	ut_assert_nextline("DMAR %08lx %06lx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+	ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
 			   addr, sizeof(struct acpi_dmar), U_BOOT_BUILD_DATE);
 	addr = ALIGN(addr + sizeof(struct acpi_dmar), 16);
-	ut_assert_nextline("DMAR %08lx %06lx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+	ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
 			   addr, sizeof(struct acpi_dmar), U_BOOT_BUILD_DATE);
 	addr = ALIGN(addr + sizeof(struct acpi_dmar), 16);
-	ut_assert_nextline("DMAR %08lx %06lx (v01 U-BOOT U-BOOTBL %x INTL 0)",
+	ut_assert_nextline("DMAR %08lx %06zx (v01 U-BOOT U-BOOTBL %x INTL 0)",
 			   addr, sizeof(struct acpi_dmar), U_BOOT_BUILD_DATE);
 	ut_assert_console_end();
 
-- 
2.30.0.478.g8a0d178c01-goog

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/7] doc: sandbox: Fix up dependencies
  2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
                   ` (4 preceding siblings ...)
  2021-02-07 21:27 ` [PATCH 5/7] test: acpi: Fix warnings " Simon Glass
@ 2021-02-07 21:27 ` Simon Glass
  2021-02-07 21:30   ` Heinrich Schuchardt
  2021-02-07 21:27 ` [PATCH 7/7] doc: sandbox: Update instructions on quitting Simon Glass
  2021-03-15 17:06 ` [PATCH 0/7] Fix compiler warnings for 32-bit ARM Heinrich Schuchardt
  7 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2021-02-07 21:27 UTC (permalink / raw)
  To: u-boot

These are out of date. Update them and point to the existing build
instructions to avoid duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/arch/sandbox.rst | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst
index 60ee1e0741a..61b5872e274 100644
--- a/doc/arch/sandbox.rst
+++ b/doc/arch/sandbox.rst
@@ -37,11 +37,12 @@ Note that standalone/API support is not available at present.
 Prerequisites
 -------------
 
-Here are some packages that are worth installing if you are doing sandbox or
-tools development in U-Boot:
+First install the dependencies noted in :doc:`../build/gcc`.
 
-   python3-pytest lzma lzma-alone lz4 python3 python3-virtualenv
-   libssl1.0-dev
+Here are some extra packages that are worth installing if you are doing sandbox
+or tools development in U-Boot:
+
+   lzma lz4 python3-virtualenv
 
 
 Basic Operation
-- 
2.30.0.478.g8a0d178c01-goog

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 7/7] doc: sandbox: Update instructions on quitting
  2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
                   ` (5 preceding siblings ...)
  2021-02-07 21:27 ` [PATCH 6/7] doc: sandbox: Fix up dependencies Simon Glass
@ 2021-02-07 21:27 ` Simon Glass
  2021-03-15 15:52   ` Tom Rini
  2021-03-15 17:06 ` [PATCH 0/7] Fix compiler warnings for 32-bit ARM Heinrich Schuchardt
  7 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2021-02-07 21:27 UTC (permalink / raw)
  To: u-boot

The 'reset' command now resets sandbox but does not quit it. Fix the
instructions.

Fixes: 329dccc0675 ("sandbox: implement reset")
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/arch/sandbox.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst
index 61b5872e274..59929319026 100644
--- a/doc/arch/sandbox.rst
+++ b/doc/arch/sandbox.rst
@@ -77,7 +77,7 @@ console::
 You can issue commands as your would normally. If the command you want is
 not supported you can add it to include/configs/sandbox.h.
 
-To exit, type 'reset' or press Ctrl-C.
+To exit, type 'poweroff' or press Ctrl-C.
 
 
 Console / LCD support
-- 
2.30.0.478.g8a0d178c01-goog

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/7] doc: sandbox: Fix up dependencies
  2021-02-07 21:27 ` [PATCH 6/7] doc: sandbox: Fix up dependencies Simon Glass
@ 2021-02-07 21:30   ` Heinrich Schuchardt
  0 siblings, 0 replies; 17+ messages in thread
From: Heinrich Schuchardt @ 2021-02-07 21:30 UTC (permalink / raw)
  To: u-boot

On 2/7/21 10:27 PM, Simon Glass wrote:
> These are out of date. Update them and point to the existing build
> instructions to avoid duplication.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   doc/arch/sandbox.rst | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst
> index 60ee1e0741a..61b5872e274 100644
> --- a/doc/arch/sandbox.rst
> +++ b/doc/arch/sandbox.rst
> @@ -37,11 +37,12 @@ Note that standalone/API support is not available at present.
>   Prerequisites
>   -------------
>
> -Here are some packages that are worth installing if you are doing sandbox or
> -tools development in U-Boot:
> +First install the dependencies noted in :doc:`../build/gcc`.
>
> -   python3-pytest lzma lzma-alone lz4 python3 python3-virtualenv
> -   libssl1.0-dev
> +Here are some extra packages that are worth installing if you are doing sandbox
> +or tools development in U-Boot:
> +
> +   lzma lz4 python3-virtualenv

I would prefer to add these to doc/build/gcc.rst

Best regards

Heinrich

>
>
>   Basic Operation
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 4/7] tpm: Correct warning on 32-bit build
  2021-02-07 21:27 ` [PATCH 4/7] tpm: Correct warning on 32-bit build Simon Glass
@ 2021-02-07 21:31   ` Heinrich Schuchardt
  2021-03-15 15:52   ` Tom Rini
  1 sibling, 0 replies; 17+ messages in thread
From: Heinrich Schuchardt @ 2021-02-07 21:31 UTC (permalink / raw)
  To: u-boot

On 2/7/21 10:27 PM, Simon Glass wrote:
> Fix the warning:
>
> drivers/tpm/tpm2_tis_sandbox.c: In function ?sandbox_tpm2_xfer?:
> drivers/tpm/tpm2_tis_sandbox.c:288:48: warning: format ?%ld? expects
> 	argument of type ?long int?, but argument 2 has type ?size_t?
> 	{aka ?unsigned int?} [-Wformat=]
>     printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
>                                                ~~^
>                                                %d
>            send_size, length);
>            ~~~~~~~~~
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   drivers/tpm/tpm2_tis_sandbox.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
> index c74bacfd719..24c804a5645 100644
> --- a/drivers/tpm/tpm2_tis_sandbox.c
> +++ b/drivers/tpm/tpm2_tis_sandbox.c
> @@ -285,7 +285,7 @@ static int sandbox_tpm2_xfer(struct udevice *dev, const u8 *sendbuf,
>   	length = get_unaligned_be32(sent);
>   	sent += sizeof(length);
>   	if (length != send_size) {
> -		printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
> +		printf("TPM2: Unmatching length, received: %zd, expected: %d\n",

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

>   		       send_size, length);
>   		rc = TPM2_RC_SIZE;
>   		sandbox_tpm2_fill_buf(recv, recv_len, tag, rc);
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 3/7] pci: swap_case: Allow compilation on 32-bit machines
  2021-02-07 21:27 ` [PATCH 3/7] pci: swap_case: Allow compilation on 32-bit machines Simon Glass
@ 2021-02-07 21:34   ` Heinrich Schuchardt
  0 siblings, 0 replies; 17+ messages in thread
From: Heinrich Schuchardt @ 2021-02-07 21:34 UTC (permalink / raw)
  To: u-boot

On 2/7/21 10:27 PM, Simon Glass wrote:
> At present this driver assumes that ulong is 64-bits long. On 32-bit
> machines it is not. Use the 64-bit code only on 64-bit machines.

The commit title and message leaves it open if this is only to make
compilation work or if the code works correctly on 32-bit with this patch.

Best regards

Heinrich

>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   drivers/misc/swap_case.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c
> index 3cbc8f37ec5..7093ad1cd4f 100644
> --- a/drivers/misc/swap_case.c
> +++ b/drivers/misc/swap_case.c
> @@ -302,7 +302,6 @@ static int sandbox_swap_case_write_io(struct udevice *dev, unsigned int addr,
>   }
>
>   static int pci_ea_bar2_magic = PCI_EA_BAR2_MAGIC;
> -static int pci_ea_bar4_magic = PCI_EA_BAR4_MAGIC;
>
>   static int sandbox_swap_case_map_physmem(struct udevice *dev,
>   		phys_addr_t addr, unsigned long *lenp, void **ptrp)
> @@ -332,12 +331,22 @@ static int sandbox_swap_case_map_physmem(struct udevice *dev,
>   			*ptrp = &pci_ea_bar2_magic;
>   			*lenp = PCI_CAP_EA_SIZE_LO;
>   			break;
> +#ifdef CONFIG_HOST_64BIT
> +		/*
> +		 * This cannot be work on a 32-bit machine since *lenp is ulong
> +		 * which is 32-bits, but it needs to have a 64-bit value
> +		 * assigned
> +		 */
>   		case (phys_addr_t)((PCI_CAP_EA_BASE_HI4 << 32) |
> -				   PCI_CAP_EA_BASE_LO4):
> +				   PCI_CAP_EA_BASE_LO4): {
> +			static int pci_ea_bar4_magic = PCI_EA_BAR4_MAGIC;
> +
>   			*ptrp = &pci_ea_bar4_magic;
>   			*lenp = (PCI_CAP_EA_SIZE_HI << 32) |
>   				PCI_CAP_EA_SIZE_LO;
>   			break;
> +		}
> +#endif
>   		default:
>   			return -ENOENT;
>   		}
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 2/7] efi: Fix compiler warnings
  2021-02-07 21:27 ` [PATCH 2/7] efi: Fix compiler warnings Simon Glass
@ 2021-02-07 21:49   ` Heinrich Schuchardt
  0 siblings, 0 replies; 17+ messages in thread
From: Heinrich Schuchardt @ 2021-02-07 21:49 UTC (permalink / raw)
  To: u-boot

On 2/7/21 10:27 PM, Simon Glass wrote:
> This occur when building on Raspberry Pi 400 (32-bit ARM). Fix them.
>
> Examples:
>
> cmd/efidebug.c: In function ?do_efi_capsule_update?:
> cmd/efidebug.c:75:49: warning: cast from pointer to integer of different
> 	size [-Wpointer-to-int-cast]
>    ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
>                                                   ^
> include/efi_loader.h:104:9: note: in definition of macro ?EFI_CALL?
>    typeof(exp) _r = exp; \
>           ^~~
> cmd/efidebug.c:75:49: warning: cast from pointer to integer of different
> 	size [-Wpointer-to-int-cast]
>    ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
>                                                   ^
> include/efi_loader.h:104:19: note: in definition of macro ?EFI_CALL?
>    typeof(exp) _r = exp; \
>                     ^~~
>
> In file included from include/common.h:20,
>                   from lib/efi_loader/efi_capsule.c:9:
> lib/efi_loader/efi_capsule.c: In function ?efi_update_capsule?:
> include/efi_loader.h:83:8: warning: format ?%lu? expects argument of type
> 	?long unsigned int?, but argument 10 has type ?size_t?
> 	{aka ?unsigned int?} [-Wformat=]
>    debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
>          ^~~~~~~~~~~~~~~~~~
> include/linux/printk.h:37:21: note: in definition of macro ?pr_fmt?
>   #define pr_fmt(fmt) fmt
>                       ^~~
> include/log.h:229:2: note: in expansion of macro ?log?
>    log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \
>    ^~~
> include/log.h:249:2: note: in expansion of macro ?debug_cond?
>    debug_cond(_DEBUG, fmt, ##args)
>    ^~~~~~~~~~
> include/efi_loader.h:83:2: note: in expansion of macro ?debug?
>    debug("%sEFI: Entry %s(" format ")\n", __efi_nesting_inc(), \
>    ^~~~~
> lib/efi_loader/efi_capsule.c:444:2: note: in expansion of macro ?EFI_ENTRY?
>    EFI_ENTRY("%p, %lu, %llu\n", capsule_header_array, capsule_count,
>    ^~~~~~~~~
> lib/efi_loader/efi_capsule.c:444:19: note: format string is defined here
>    EFI_ENTRY("%p, %lu, %llu\n", capsule_header_array, capsule_count,
>                   ~~^
>                   %u
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   cmd/efidebug.c                | 2 +-
>   lib/efi_loader/efi_capsule.c  | 4 ++--
>   lib/efi_loader/efi_firmware.c | 4 ++--
>   3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/cmd/efidebug.c b/cmd/efidebug.c
> index bbbcb0a5464..09c41c950f7 100644
> --- a/cmd/efidebug.c
> +++ b/cmd/efidebug.c
> @@ -72,7 +72,7 @@ static int do_efi_capsule_update(struct cmd_tbl *cmdtp, int flag,
>   		       capsule->capsule_image_size);
>   	}
>
> -	ret = EFI_CALL(RT->update_capsule(&capsule, 1, (u64)NULL));
> +	ret = EFI_CALL(RT->update_capsule(&capsule, 1, (uintptr_t)NULL));

Thanks for addressing this issue.

According to the UEFI specification the third parameter is of type
EFI_PHYSICAL_ADDRESS i.e. u64.

Simply use 0 instead of (uintptr_t)NULL.

>   	if (ret) {
>   		printf("Cannot handle a capsule at %p", capsule);
>   		return CMD_RET_FAILURE;
> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index 0d5a7b63ec8..1c0462ceb21 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -441,7 +441,7 @@ efi_status_t EFIAPI efi_update_capsule(
>   	unsigned int i;
>   	efi_status_t ret;
>
> -	EFI_ENTRY("%p, %lu, %llu\n", capsule_header_array, capsule_count,
> +	EFI_ENTRY("%p, %zu, %llu\n", capsule_header_array, capsule_count,
>   		  scatter_gather_list);

ok

>
>   	if (!capsule_count) {
> @@ -501,7 +501,7 @@ efi_status_t EFIAPI efi_query_capsule_caps(
>   	unsigned int i;
>   	efi_status_t ret;
>
> -	EFI_ENTRY("%p, %lu, %p, %p\n", capsule_header_array, capsule_count,
> +	EFI_ENTRY("%p, %zu, %p, %p\n", capsule_header_array, capsule_count,

ok

>   		  maximum_capsule_size, reset_type);
>
>   	if (!maximum_capsule_size) {
> diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
> index 5e401bbca2b..7a3cca27936 100644
> --- a/lib/efi_loader/efi_firmware.c
> +++ b/lib/efi_loader/efi_firmware.c
> @@ -299,7 +299,7 @@ efi_status_t EFIAPI efi_firmware_fit_set_image(
>   	efi_status_t (*progress)(efi_uintn_t completion),
>   	u16 **abort_reason)
>   {
> -	EFI_ENTRY("%p %d %p %ld %p %p %p\n", this, image_index, image,
> +	EFI_ENTRY("%p %d %p %zd %p %p %p\n", this, image_index, image,
>   		  image_size, vendor_code, progress, abort_reason);

ok

>
>   	if (!image || image_index != 1)
> @@ -414,7 +414,7 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
>   	efi_status_t status;
>   	efi_uintn_t capsule_payload_size;
>
> -	EFI_ENTRY("%p %d %p %ld %p %p %p\n", this, image_index, image,
> +	EFI_ENTRY("%p %d %p %zd %p %p %p\n", this, image_index, image,

ok

Otherwise

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

>   		  image_size, vendor_code, progress, abort_reason);
>
>   	if (!image)
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/7] mkeficapsule: Correct printf() strings
  2021-02-07 21:27 ` [PATCH 1/7] mkeficapsule: Correct printf() strings Simon Glass
@ 2021-02-07 23:20   ` Heinrich Schuchardt
  0 siblings, 0 replies; 17+ messages in thread
From: Heinrich Schuchardt @ 2021-02-07 23:20 UTC (permalink / raw)
  To: u-boot

On 2/7/21 10:27 PM, Simon Glass wrote:
> Use %z when printing size_t values. This avoids errors on 32-bit
> machines.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   tools/mkeficapsule.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
> index 162494907a8..ea6151989e9 100644
> --- a/tools/mkeficapsule.c
> +++ b/tools/mkeficapsule.c
> @@ -278,7 +278,7 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
>   	}
>   	data = malloc(bin_stat.st_size);
>   	if (!data) {
> -		printf("cannot allocate memory: %lx\n", bin_stat.st_size);
> +		printf("cannot allocate memory: %lx\n", (ulong)bin_stat.st_size);

Thanks for addressing the build problem.

bin_stat.st_size is of type off_t which may be u64 on 32bit systems.

We must check that bin_stat.st_size <= SIZE_MAX before calling malloc()
otherwise the value may be truncated.

The capsule file will end up on a FAT file system which has a file size
limit of 2^32-1. Typically the ESP has a size of 100 MiB. We should at
least check that bin_stat.st_size <= 2^32-1.

Converting to size_t instead of ulong seems to be the natural choice for
a parameter called size.

>   		goto err_1;
>   	}
>   	f = fopen(path, "w");
> @@ -297,7 +297,7 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
>
>   	size = fwrite(&header, 1, sizeof(header), f);
>   	if (size < sizeof(header)) {
> -		printf("write failed (%lx)\n", size);
> +		printf("write failed (%zx)\n", size);

ok

>   		goto err_3;
>   	}
>
> @@ -306,13 +306,13 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
>   	capsule.payload_item_count = 1;
>   	size = fwrite(&capsule, 1, sizeof(capsule), f);
>   	if (size < (sizeof(capsule))) {
> -		printf("write failed (%lx)\n", size);
> +		printf("write failed (%zx)\n", size);

ok

>   		goto err_3;
>   	}
>   	offset = sizeof(capsule) + sizeof(u64);
>   	size = fwrite(&offset, 1, sizeof(offset), f);
>   	if (size < sizeof(offset)) {
> -		printf("write failed (%lx)\n", size);
> +		printf("write failed (%zx)\n", size);

ok

>   		goto err_3;
>   	}
>
> @@ -329,17 +329,17 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
>
>   	size = fwrite(&image, 1, sizeof(image), f);
>   	if (size < sizeof(image)) {
> -		printf("write failed (%lx)\n", size);
> +		printf("write failed (%zx)\n", size);

ok

>   		goto err_3;
>   	}
>   	size = fread(data, 1, bin_stat.st_size, g);
>   	if (size < bin_stat.st_size) {
> -		printf("read failed (%lx)\n", size);
> +		printf("read failed (%zx)\n", size);

ok

>   		goto err_3;
>   	}
>   	size = fwrite(data, 1, bin_stat.st_size, f);
>   	if (size < bin_stat.st_size) {
> -		printf("write failed (%lx)\n", size);
> +		printf("write failed (%zx)\n", size);

ok

Best regards

Heinrich

>   		goto err_3;
>   	}
>
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 4/7] tpm: Correct warning on 32-bit build
  2021-02-07 21:27 ` [PATCH 4/7] tpm: Correct warning on 32-bit build Simon Glass
  2021-02-07 21:31   ` Heinrich Schuchardt
@ 2021-03-15 15:52   ` Tom Rini
  1 sibling, 0 replies; 17+ messages in thread
From: Tom Rini @ 2021-03-15 15:52 UTC (permalink / raw)
  To: u-boot

On Sun, Feb 07, 2021 at 02:27:04PM -0700, Simon Glass wrote:

> Fix the warning:
> 
> drivers/tpm/tpm2_tis_sandbox.c: In function ?sandbox_tpm2_xfer?:
> drivers/tpm/tpm2_tis_sandbox.c:288:48: warning: format ?%ld? expects
> 	argument of type ?long int?, but argument 2 has type ?size_t?
> 	{aka ?unsigned int?} [-Wformat=]
>    printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
>                                               ~~^
>                                               %d
>           send_size, length);
>           ~~~~~~~~~
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210315/8ba1167b/attachment.sig>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 5/7] test: acpi: Fix warnings on 32-bit build
  2021-02-07 21:27 ` [PATCH 5/7] test: acpi: Fix warnings " Simon Glass
@ 2021-03-15 15:52   ` Tom Rini
  0 siblings, 0 replies; 17+ messages in thread
From: Tom Rini @ 2021-03-15 15:52 UTC (permalink / raw)
  To: u-boot

On Sun, Feb 07, 2021 at 02:27:05PM -0700, Simon Glass wrote:

> Some format strings use the wrong type. Fix them.
> 
> Example warnings:
> 
> In file included from test/dm/acpi.c:22:
> test/dm/acpi.c: In function ?dm_test_acpi_cmd_list?:
> test/dm/acpi.c:362:21: warning: format ?%lx? expects argument of type
>   ?long unsigned int?, but argument 4 has type ?unsigned int? [-Wformat=]
>   ut_assert_nextline("RSDP %08lx %06lx (v02 U-BOOT)", addr,
>                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>        sizeof(struct acpi_rsdp));
>        ~~~~~~~~~~~~~~~~~~~~~~~~
> include/test/ut.h:282:33: note: in definition of macro ?ut_assert_nextline?
>   if (ut_check_console_line(uts, fmt, ##args)) {   \
>                                  ^~~
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210315/db4d6397/attachment.sig>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 7/7] doc: sandbox: Update instructions on quitting
  2021-02-07 21:27 ` [PATCH 7/7] doc: sandbox: Update instructions on quitting Simon Glass
@ 2021-03-15 15:52   ` Tom Rini
  0 siblings, 0 replies; 17+ messages in thread
From: Tom Rini @ 2021-03-15 15:52 UTC (permalink / raw)
  To: u-boot

On Sun, Feb 07, 2021 at 02:27:07PM -0700, Simon Glass wrote:

> The 'reset' command now resets sandbox but does not quit it. Fix the
> instructions.
> 
> Fixes: 329dccc0675 ("sandbox: implement reset")
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210315/e1dce1dd/attachment.sig>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 0/7] Fix compiler warnings for 32-bit ARM
  2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
                   ` (6 preceding siblings ...)
  2021-02-07 21:27 ` [PATCH 7/7] doc: sandbox: Update instructions on quitting Simon Glass
@ 2021-03-15 17:06 ` Heinrich Schuchardt
  7 siblings, 0 replies; 17+ messages in thread
From: Heinrich Schuchardt @ 2021-03-15 17:06 UTC (permalink / raw)
  To: u-boot

On 07.02.21 22:27, Simon Glass wrote:
> These were noticed when building sandbox on a Raspberry Pi 400, which uses
> 32-bit linux.
>
> To make this work, I enabled CONFIG_HOST_32BIT in 'make menuconfig'. It
> would be nice if that were automatic, since we have the logic already in
> arch/sandbox/config.mk
>
> There are still many errors of the form:
>
> /usr/bin/ld: warning: arch/sandbox/cpu/start.o uses 2-byte wchar_t yet the
>    output is to use 4-byte wchar_t; use of wchar_t values across objects
>    may fail

For the compiler we use -fshort-wchar.

https://stackoverflow.com/questions/19489354/how-to-set-2-byte-wchar-t-output/23896853

discusses the warning. It can be suppressed with a linker flag.

The best thing to do would be to replace all L"" constants by u""
constants and eliminate -fshort-wchar from our compiler flags.

This requires C11 which we already use since 2018.

Best regards

Heinrich

>
> I am not sure how to fix those, but they are not fatal (sandbox still
> runs).
>
>
> Simon Glass (7):
>   mkeficapsule: Correct printf() strings
>   efi: Fix compiler warnings
>   pci: swap_case: Allow compilation on 32-bit machines
>   tpm: Correct warning on 32-bit build
>   test: acpi: Fix warnings on 32-bit build
>   doc: sandbox: Fix up dependencies
>   doc: sandbox: Update instructions on quitting
>
>  cmd/efidebug.c                 |  2 +-
>  doc/arch/sandbox.rst           | 11 ++++++-----
>  drivers/misc/swap_case.c       | 13 +++++++++++--
>  drivers/tpm/tpm2_tis_sandbox.c |  2 +-
>  lib/efi_loader/efi_capsule.c   |  4 ++--
>  lib/efi_loader/efi_firmware.c  |  4 ++--
>  test/dm/acpi.c                 | 12 ++++++------
>  tools/mkeficapsule.c           | 14 +++++++-------
>  8 files changed, 36 insertions(+), 26 deletions(-)
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-03-15 17:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-07 21:27 [PATCH 0/7] Fix compiler warnings for 32-bit ARM Simon Glass
2021-02-07 21:27 ` [PATCH 1/7] mkeficapsule: Correct printf() strings Simon Glass
2021-02-07 23:20   ` Heinrich Schuchardt
2021-02-07 21:27 ` [PATCH 2/7] efi: Fix compiler warnings Simon Glass
2021-02-07 21:49   ` Heinrich Schuchardt
2021-02-07 21:27 ` [PATCH 3/7] pci: swap_case: Allow compilation on 32-bit machines Simon Glass
2021-02-07 21:34   ` Heinrich Schuchardt
2021-02-07 21:27 ` [PATCH 4/7] tpm: Correct warning on 32-bit build Simon Glass
2021-02-07 21:31   ` Heinrich Schuchardt
2021-03-15 15:52   ` Tom Rini
2021-02-07 21:27 ` [PATCH 5/7] test: acpi: Fix warnings " Simon Glass
2021-03-15 15:52   ` Tom Rini
2021-02-07 21:27 ` [PATCH 6/7] doc: sandbox: Fix up dependencies Simon Glass
2021-02-07 21:30   ` Heinrich Schuchardt
2021-02-07 21:27 ` [PATCH 7/7] doc: sandbox: Update instructions on quitting Simon Glass
2021-03-15 15:52   ` Tom Rini
2021-03-15 17:06 ` [PATCH 0/7] Fix compiler warnings for 32-bit ARM Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox