Skip to contentSkip to conversation

Fix compiler warnings for 32-bit ARM

PATCH Superseded Simon Glass 3 participants 14 messages Jan 22, 2022 – Jan 29, 2022

Subsystems (5)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Fix compiler warnings for 32-bit ARM

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

So this series adds that.

It also fixes the unicode warnings 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

as suggested by Heinrich.

Changes in v4:
- Rebase to master
- Use $(HOSTCC) instead of gcc
- Add proper Kconfig help

Changes in v3:
- Mention the link to the new upstream patch
- Change some things EFI things missed (or new since) last time
- Use 'bitness' instead of 'bit'
- Add a new patch to change non-EFI occurences

Changes in v2:
- Add new patch to reduce checkpatch unicode-string spam
- Drop patches previously applied
- Put all the packages in gcc.rst

Joe Perches (1):
checkpatch: Support wide strings

Simon Glass (3):
efi: Use 16-bit unicode strings
sandbox: Detect the host bit size automatically
treewide: Use 16-bit unicode strings

 Makefile                                      |  11 +-
 arch/sandbox/Kconfig                          |  33 +++++-
 cmd/efidebug.c                                |  28 ++---
 include/efi_loader.h                          |   2 +-
 include/efi_selftest.h                        |   4 +-
 lib/efi_loader/efi_bootmgr.c                  |  12 +-
 lib/efi_loader/efi_boottime.c                 |   2 +-
 lib/efi_loader/efi_capsule.c                  |  22 ++--
 lib/efi_loader/efi_helper.c                   |   2 +-
 lib/efi_loader/efi_image_loader.c             |   8 +-
 lib/efi_loader/efi_setup.c                    |  14 +--
 lib/efi_loader/efi_string.c                   |   2 +-
 lib/efi_loader/efi_tcg2.c                     |   4 +-
 lib/efi_loader/efi_var_common.c               |  12 +-
 lib/efi_loader/efi_variable.c                 |   6 +-
 lib/efi_loader/efi_variable_tee.c             |   2 +-
 lib/efi_loader/helloworld.c                   |  40 +++----
 lib/efi_selftest/dtbdump.c                    |  82 +++++++-------
 lib/efi_selftest/efi_selftest.c               |   2 +-
 lib/efi_selftest/efi_selftest_block_device.c  |   6 +-
 lib/efi_selftest/efi_selftest_devicepath.c    |   2 +-
 lib/efi_selftest/efi_selftest_exception.c     |   2 +-
 lib/efi_selftest/efi_selftest_fdt.c           |   6 +-
 lib/efi_selftest/efi_selftest_hii.c           |   8 +-
 lib/efi_selftest/efi_selftest_load_file.c     |   4 +-
 lib/efi_selftest/efi_selftest_loadimage.c     |   4 +-
 .../efi_selftest_miniapp_exception.c          |   4 +-
 lib/efi_selftest/efi_selftest_miniapp_exit.c  |   8 +-
 .../efi_selftest_miniapp_return.c             |   2 +-
 lib/efi_selftest/efi_selftest_reset.c         |   2 +-
 lib/efi_selftest/efi_selftest_textoutput.c    |  12 +-
 .../efi_selftest_unicode_collation.c          |  38 +++----
 lib/efi_selftest/efi_selftest_util.c          | 106 +++++++++---------
 lib/efi_selftest/efi_selftest_variables.c     |  22 ++--
 .../efi_selftest_variables_runtime.c          |   4 +-
 lib/efi_selftest/initrddump.c                 |  60 +++++-----
 lib/lzma/Types.h                              |   4 +-
 lib/vsprintf.c                                |   2 +-
 scripts/checkpatch.pl                         |   7 +-
 scripts/kconfig/Makefile                      |  14 ++-
 test/print_ut.c                               |   2 +-
 test/unicode_ut.c                             |  22 ++--
 42 files changed, 337 insertions(+), 292 deletions(-)
Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog
#1 lore raw

PATCH v4 1/4 checkpatch: Support wide strings

From: Joe Perches <[email protected]>

Allow prefixing typical strings with L for wide strings and u for unicode strings.

---
This was found on LKML:

https://lore.kernel.org/lkml/[email protected]/T/

It likely wasn't applied because it did not show up in patchwork correctly, due to the patch being inline:

https://lore.kernel.org/patchwork/patch/842121/

In any case, it needed rebasing and updating to support 'u'.

I sent this upstream:

https://lore.kernel.org/patchwork/patch/1470668/

(no changes since v3)

Changes in v3:
- Mention the link to the new upstream patch

Changes in v2:
- Add new patch to reduce checkpatch unicode-string spam

 scripts/checkpatch.pl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +4 -3
index cf59e2bb705..c1307f4361c 100755
@@ -504,7 +504,7 @@ our $Binary	= qr{(?i)0b[01]+$Int_type?};
 our $Hex	= qr{(?i)0x[0-9a-f]+$Int_type?};
 our $Int	= qr{[0-9]+$Int_type?};
 our $Octal	= qr{0[0-7]+$Int_type?};
-our $String	= qr{"[X\t]*"};
+our $String	= qr{(?:\b[Lu])?"[X\t]*"};
 our $Float_hex	= qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?};
 our $Float_dec	= qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?};
 our $Float_int	= qr{(?i)[0-9]+e-?[0-9]+[fl]?};
@@ -6242,7 +6242,8 @@ sub process {
 		}
 
 # concatenated string without spaces between elements
-		if ($line =~ /$String[A-Za-z0-9_]/ || $line =~ /[A-Za-z0-9_]$String/) {
+		if ($line =~ /$String[A-Z_]/ ||
+		    ($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) {
 			if (CHK("CONCATENATED_STRING",
 				"Concatenated strings should use spaces between elements\n" . $herecurr) &&
 			    $fix) {
@@ -6255,7 +6256,7 @@ sub process {
 		}
 
 # uncoalesced string fragments
-		if ($line =~ /$String\s*"/) {
+		if ($line =~ /$String\s*[Lu]?"/) {
 			if (WARN("STRING_FRAGMENTS",
 				 "Consecutive strings are generally better as a single string\n" . $herecurr) &&
 			    $fix) {
Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog
#2 lore raw

Re: [PATCH v4 1/4] checkpatch: Support wide strings

Quoted 15 lines · Simon Glass

From: Joe Perches <[email protected]>

Allow prefixing typical strings with L for wide strings and u for unicode strings.

---
This was found on LKML:

https://lore.kernel.org/lkml/[email protected]/T/

It likely wasn't applied because it did not show up in patchwork correctly, due to the patch being inline:

Quoted 7 lines

https://lore.kernel.org/patchwork/patch/842121/

In any case, it needed rebasing and updating to support 'u'.

I sent this upstream:

https://lore.kernel.org/patchwork/patch/1470668/

And this is now:
commit d2af5aa6c036d3fd2c1ff3379ffe3e6805929952

Author: Joe Perches <[email protected]>
Date:   Tue Sep 7 19:59:51 2021 -0700

checkpatch: support wide strings

Allow prefixing typical strings with L for wide strings and u for unicode strings.

upstream and in v5.16. Time for a direct resync again?

Signature · 1 line
Tom
#3 lore raw

Re: [PATCH v4 1/4] checkpatch: Support wide strings

Hi Tom,

Quoted 31 lines · Tom Rini
Quoted 15 lines · Simon Glass

From: Joe Perches <[email protected]>

Allow prefixing typical strings with L for wide strings and u for unicode strings.

---
This was found on LKML:

https://lore.kernel.org/lkml/[email protected]/T/

It likely wasn't applied because it did not show up in patchwork correctly, due to the patch being inline:

Quoted 7 lines

https://lore.kernel.org/patchwork/patch/842121/

In any case, it needed rebasing and updating to support 'u'.

I sent this upstream:

https://lore.kernel.org/patchwork/patch/1470668/

And this is now:
commit d2af5aa6c036d3fd2c1ff3379ffe3e6805929952

Author: Joe Perches <[email protected]>
Date:   Tue Sep 7 19:59:51 2021 -0700
Quoted 6 lines

checkpatch: support wide strings

Allow prefixing typical strings with L for wide strings and u for unicode strings.

upstream and in v5.16. Time for a direct resync again?

How about taking this patch so this long-standing series can go in and I can forget about it?

If you like I can do a patch to resync checkpatch. Do you think we should try to send the U-Boot things upstream?

Regards,
Simon

#4 lore raw

Re: [PATCH v4 1/4] checkpatch: Support wide strings

Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 36 lines · Tom Rini
Quoted 15 lines · Simon Glass

From: Joe Perches <[email protected]>

Allow prefixing typical strings with L for wide strings and u for unicode strings.

---
This was found on LKML:

https://lore.kernel.org/lkml/[email protected]/T/

It likely wasn't applied because it did not show up in patchwork correctly, due to the patch being inline:

Quoted 7 lines

https://lore.kernel.org/patchwork/patch/842121/

In any case, it needed rebasing and updating to support 'u'.

I sent this upstream:

https://lore.kernel.org/patchwork/patch/1470668/

And this is now:
commit d2af5aa6c036d3fd2c1ff3379ffe3e6805929952

Author: Joe Perches <[email protected]>
Date:   Tue Sep 7 19:59:51 2021 -0700

checkpatch: support wide strings

Allow prefixing typical strings with L for wide strings and u for unicode strings.

Quoted 7 lines
Quoted 1 line

upstream and in v5.16. Time for a direct resync again?

How about taking this patch so this long-standing series can go in and I can forget about it?

If you like I can do a patch to resync checkpatch. Do you think we should try to send the U-Boot things upstream?

A re-sync should be easy now that (almost?) all of the U-Boot stuff is in one hunk and I would rather see a re-sync than backporting individual changes.

Signature · 1 line
Tom
#6 lore raw

Re: [PATCH v4 1/4] checkpatch: Support wide strings

Quoted 8 lines · Joe Perches
Quoted 2 lines · Simon Glass

Do you think we
should try to send the U-Boot things upstream?

No idea. What are the U-Boot things that could or should be generic ?

https://source.denx.de/u-boot/u-boot/-/commits/master/scripts/checkpatch.pl

Honestly? I think we got everything that was generic pushed upstream first these days and it's just U-Boot centric checks in the u_boot_* functions.

Signature · 1 line
Tom
maintainer
#7 lore raw

Re: [PATCH v4 1/4] checkpatch: Support wide strings

Quoted 11 lines · Tom Rini
Quoted 8 lines · Joe Perches
Quoted 2 lines · Simon Glass

Do you think we
should try to send the U-Boot things upstream?

No idea. What are the U-Boot things that could or should be generic ?

https://source.denx.de/u-boot/u-boot/-/commits/master/scripts/checkpatch.pl

Honestly?

Do you honestly think I normally look at or care about u-boot ?

Quoted 3 lines

I think we got everything that was generic pushed upstream first these days and it's just U-Boot centric checks in the u_boot_* functions.

Fine by me.

#8 lore raw

Re: [PATCH v4 1/4] checkpatch: Support wide strings

Hi Joe,

Quoted 14 lines · Joe Perches
Quoted 11 lines · Tom Rini
Quoted 8 lines · Joe Perches
Quoted 2 lines · Simon Glass

Do you think we
should try to send the U-Boot things upstream?

No idea. What are the U-Boot things that could or should be generic ?

https://source.denx.de/u-boot/u-boot/-/commits/master/scripts/checkpatch.pl

Honestly?

Quoted 8 lines

Do you honestly think I normally look at or care about u-boot ?

Quoted 3 lines

I think we got everything that was generic pushed upstream first these days and it's just U-Boot centric checks in the u_boot_* functions.

Fine by me.

It is just one perl function enabled by a --u-boot flag, so if you don't mind, it would be convenient to upstream it.

Regards,
Simon

maintainer
#9 lore raw

Re: [PATCH v4 1/4] checkpatch: Support wide strings

Quoted 23 lines · Simon Glass

Hi Joe,

Quoted 20 lines · Joe Perches
Quoted 11 lines · Tom Rini
Quoted 8 lines · Joe Perches
Quoted 2 lines · Simon Glass

Do you think we
should try to send the U-Boot things upstream?

No idea. What are the U-Boot things that could or should be generic ?

https://source.denx.de/u-boot/u-boot/-/commits/master/scripts/checkpatch.pl

Honestly?

Do you honestly think I normally look at or care about u-boot ?

Quoted 3 lines

I think we got everything that was generic pushed upstream first these days and it's just U-Boot centric checks in the u_boot_* functions.

Quoted 5 lines
Quoted 2 lines

Fine by me.

It is just one perl function enabled by a --u-boot flag, so if you don't mind, it would be convenient to upstream it.

You could send a patch for review.

#10 lore raw

Re: [PATCH v4 1/4] checkpatch: Support wide strings

Hi Joe,

Quoted 25 lines · Joe Perches
Quoted 23 lines · Simon Glass

Hi Joe,

Quoted 20 lines · Joe Perches
Quoted 11 lines · Tom Rini
Quoted 8 lines · Joe Perches
Quoted 2 lines · Simon Glass

Do you think we
should try to send the U-Boot things upstream?

No idea. What are the U-Boot things that could or should be generic ?

https://source.denx.de/u-boot/u-boot/-/commits/master/scripts/checkpatch.pl

Honestly?

Do you honestly think I normally look at or care about u-boot ?

Quoted 3 lines

I think we got everything that was generic pushed upstream first these days and it's just U-Boot centric checks in the u_boot_* functions.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Fine by me.

It is just one perl function enabled by a --u-boot flag, so if you don't mind, it would be convenient to upstream it.

You could send a patch for review.

OK I sent it to lkml and cc'd you. I cannot find where it appears on patchwork though.

Regards,
Simon

#11 lore raw

PATCH v4 2/4 efi: Use 16-bit unicode strings

In reply to Simon Glass

At present we use wide characters for unicode but this is not necessary. Change the code to use the 'u' literal instead. This helps to fix build warnings for sandbox on rpi.

---

Changes in v4:
- Rebase to master

Changes in v3:
- Change some things EFI things missed (or new since) last time

 cmd/efidebug.c                                |  28 ++---
 include/efi_loader.h                          |   2 +-
 include/efi_selftest.h                        |   4 +-
 lib/efi_loader/efi_bootmgr.c                  |  12 +-
 lib/efi_loader/efi_boottime.c                 |   2 +-
 lib/efi_loader/efi_capsule.c                  |  22 ++--
 lib/efi_loader/efi_helper.c                   |   2 +-
 lib/efi_loader/efi_image_loader.c             |   8 +-
 lib/efi_loader/efi_setup.c                    |  14 +--
 lib/efi_loader/efi_string.c                   |   2 +-
 lib/efi_loader/efi_tcg2.c                     |   4 +-
 lib/efi_loader/efi_var_common.c               |  12 +-
 lib/efi_loader/efi_variable.c                 |   6 +-
 lib/efi_loader/efi_variable_tee.c             |   2 +-
 lib/efi_loader/helloworld.c                   |  40 +++----
 lib/efi_selftest/dtbdump.c                    |  82 +++++++-------
 lib/efi_selftest/efi_selftest.c               |   2 +-
 lib/efi_selftest/efi_selftest_block_device.c  |   6 +-
 lib/efi_selftest/efi_selftest_devicepath.c    |   2 +-
 lib/efi_selftest/efi_selftest_exception.c     |   2 +-
 lib/efi_selftest/efi_selftest_fdt.c           |   6 +-
 lib/efi_selftest/efi_selftest_hii.c           |   8 +-
 lib/efi_selftest/efi_selftest_load_file.c     |   4 +-
 lib/efi_selftest/efi_selftest_loadimage.c     |   4 +-
 .../efi_selftest_miniapp_exception.c          |   4 +-
 lib/efi_selftest/efi_selftest_miniapp_exit.c  |   8 +-
 .../efi_selftest_miniapp_return.c             |   2 +-
 lib/efi_selftest/efi_selftest_reset.c         |   2 +-
 lib/efi_selftest/efi_selftest_textoutput.c    |  12 +-
 .../efi_selftest_unicode_collation.c          |  38 +++----
 lib/efi_selftest/efi_selftest_util.c          | 106 +++++++++---------
 lib/efi_selftest/efi_selftest_variables.c     |  22 ++--
 .../efi_selftest_variables_runtime.c          |   4 +-
 lib/efi_selftest/initrddump.c                 |  60 +++++-----
 34 files changed, 267 insertions(+), 267 deletions(-)
cmd/efidebug.c +14 -14
index a977ca9c72f..049794cf3ca 100644
@@ -240,7 +240,7 @@ static int do_efi_capsule_res(struct cmd_tbl *cmdtp, int flag,
 	guid = efi_guid_capsule_report;
 	if (argc == 1) {
 		size = sizeof(var_name16);
-		ret = efi_get_variable_int(L"CapsuleLast", &guid, NULL,
+		ret = efi_get_variable_int(u"CapsuleLast", &guid, NULL,
 					   &size, var_name16, NULL);
 
 		if (ret != EFI_SUCCESS) {
@@ -1272,7 +1272,7 @@ static int do_efi_boot_dump(struct cmd_tbl *cmdtp, int flag,
 			return CMD_RET_FAILURE;
 		}
 
-		if (memcmp(var_name16, L"Boot", 8))
+		if (memcmp(var_name16, u"Boot", 8))
 			continue;
 
 		for (id = 0, i = 0; i < 4; i++) {
@@ -1308,7 +1308,7 @@ static int show_efi_boot_order(void)
 	efi_status_t ret;
 
 	size = 0;
-	ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
+	ret = EFI_CALL(efi_get_variable(u"BootOrder", &efi_global_variable_guid,
 					NULL, &size, NULL));
 	if (ret != EFI_BUFFER_TOO_SMALL) {
 		if (ret == EFI_NOT_FOUND) {
@@ -1323,7 +1323,7 @@ static int show_efi_boot_order(void)
 		printf("ERROR: Out of memory\n");
 		return CMD_RET_FAILURE;
 	}
-	ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
+	ret = EFI_CALL(efi_get_variable(u"BootOrder", &efi_global_variable_guid,
 					NULL, &size, bootorder));
 	if (ret != EFI_SUCCESS) {
 		ret = CMD_RET_FAILURE;
@@ -1412,11 +1412,11 @@ static int do_efi_boot_next(struct cmd_tbl *cmdtp, int flag,
 
 	guid = efi_global_variable_guid;
 	size = sizeof(u16);
-	ret = efi_set_variable_int(L"BootNext", &guid,
-					EFI_VARIABLE_NON_VOLATILE |
-					EFI_VARIABLE_BOOTSERVICE_ACCESS |
-					EFI_VARIABLE_RUNTIME_ACCESS,
-					size, &bootnext, false);
+	ret = efi_set_variable_int(u"BootNext", &guid,
+				   EFI_VARIABLE_NON_VOLATILE |
+				   EFI_VARIABLE_BOOTSERVICE_ACCESS |
+				   EFI_VARIABLE_RUNTIME_ACCESS,
+				   size, &bootnext, false);
 	if (ret != EFI_SUCCESS) {
 		printf("Cannot set BootNext\n");
 		r = CMD_RET_FAILURE;
@@ -1473,11 +1473,11 @@ static int do_efi_boot_order(struct cmd_tbl *cmdtp, int flag,
 	}
 
 	guid = efi_global_variable_guid;
-	ret = efi_set_variable_int(L"BootOrder", &guid,
-					EFI_VARIABLE_NON_VOLATILE |
-					EFI_VARIABLE_BOOTSERVICE_ACCESS |
-					EFI_VARIABLE_RUNTIME_ACCESS,
-					size, bootorder, true);
+	ret = efi_set_variable_int(u"BootOrder", &guid,
+				   EFI_VARIABLE_NON_VOLATILE |
+				   EFI_VARIABLE_BOOTSERVICE_ACCESS |
+				   EFI_VARIABLE_RUNTIME_ACCESS,
+				   size, bootorder, true);
 	if (ret != EFI_SUCCESS) {
 		printf("Cannot set BootOrder\n");
 		r = CMD_RET_FAILURE;
include/efi_loader.h +1 -1
index 701efcd2b62..bcd20ad6657 100644
@@ -971,7 +971,7 @@ efi_status_t efi_capsule_authenticate(const void *capsule,
 				      efi_uintn_t capsule_size,
 				      void **image, efi_uintn_t *image_size);
 
-#define EFI_CAPSULE_DIR L"\\EFI\\UpdateCapsule\\"
+#define EFI_CAPSULE_DIR u"\\EFI\\UpdateCapsule\\"
 
 /**
  * Install the ESRT system table.
include/efi_selftest.h +2 -2
index 94ceb147330..5340cefbb6f 100644
@@ -16,7 +16,7 @@
 
 #define EFI_ST_SUCCESS 0
 #define EFI_ST_FAILURE 1
-#define EFI_ST_SUCCESS_STR L"SUCCESS"
+#define EFI_ST_SUCCESS_STR u"SUCCESS"
 
 /**
  * efi_st_printf() - print a message
@@ -111,7 +111,7 @@ u16 *efi_st_translate_char(u16 code);
  * efi_st_translate_code() - translate a scan code to a human readable string
  *
  * This function translates the scan code returned by the simple text input
- * protocol to a human readable string, e.g. 0x04 is translated to L"Left".
+ * protocol to a human readable string, e.g. 0x04 is translated to u"Left".
  *
  * @code:	scan code
  * Return:	Unicode string
lib/efi_loader/efi_bootmgr.c +6 -6
index 1fe19237f9a..8c04ecbdc83 100644
@@ -46,8 +46,8 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
 				   void **load_options)
 {
 	struct efi_load_option lo;
-	u16 varname[] = L"Boot0000";
-	u16 hexmap[] = L"0123456789ABCDEF";
+	u16 varname[] = u"Boot0000";
+	u16 hexmap[] = u"0123456789ABCDEF";
 	void *load_option;
 	efi_uintn_t size;
 	efi_status_t ret;
@@ -83,7 +83,7 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
 
 		attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
 			     EFI_VARIABLE_RUNTIME_ACCESS;
-		ret = efi_set_variable_int(L"BootCurrent",
+		ret = efi_set_variable_int(u"BootCurrent",
 					   &efi_global_variable_guid,
 					   attributes, sizeof(n), &n, false);
 		if (ret != EFI_SUCCESS)
@@ -149,7 +149,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options)
 
 	/* BootNext */
 	size = sizeof(bootnext);
-	ret = efi_get_variable_int(L"BootNext",
+	ret = efi_get_variable_int(u"BootNext",
 				   &efi_global_variable_guid,
 				   NULL, &size, &bootnext, NULL);
 	if (ret == EFI_SUCCESS || ret == EFI_BUFFER_TOO_SMALL) {
@@ -158,7 +158,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options)
 			log_err("BootNext must be 16-bit integer\n");
 
 		/* delete BootNext */
-		ret = efi_set_variable_int(L"BootNext",
+		ret = efi_set_variable_int(u"BootNext",
 					   &efi_global_variable_guid,
 					   0, 0, NULL, false);
 
@@ -178,7 +178,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options)
 	}
 
 	/* BootOrder */
-	bootorder = efi_get_var(L"BootOrder", &efi_global_variable_guid, &size);
+	bootorder = efi_get_var(u"BootOrder", &efi_global_variable_guid, &size);
 	if (!bootorder) {
 		log_info("BootOrder not defined\n");
 		ret = EFI_NOT_FOUND;
lib/efi_loader/efi_boottime.c +1 -1
index 20b69699fe9..6868d8f52cf 100644
@@ -3778,7 +3778,7 @@ static struct efi_boot_services efi_boot_services = {
 	.create_event_ex = efi_create_event_ex,
 };
 
-static u16 __efi_runtime_data firmware_vendor[] = L"Das U-Boot";
+static u16 __efi_runtime_data firmware_vendor[] = u"Das U-Boot";
 
 struct efi_system_table __efi_runtime_data systab = {
 	.hdr = {
lib/efi_loader/efi_capsule.c +11 -11
index 8301eed6317..627924084da 100644
@@ -56,10 +56,10 @@ static __maybe_unused unsigned int get_last_capsule(void)
 	int i;
 
 	size = sizeof(value16);
-	ret = efi_get_variable_int(L"CapsuleLast", &efi_guid_capsule_report,
+	ret = efi_get_variable_int(u"CapsuleLast", &efi_guid_capsule_report,
 				   NULL, &size, value16, NULL);
 	if (ret != EFI_SUCCESS || size != 22 ||
-	    u16_strncmp(value16, L"Capsule", 7))
+	    u16_strncmp(value16, u"Capsule", 7))
 		goto err;
 	for (i = 0; i < 4; ++i) {
 		u16 c = value16[i + 7];
@@ -113,14 +113,14 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule,
 	}
 
 	/* Variable CapsuleLast must not include terminating 0x0000 */
-	ret = efi_set_variable_int(L"CapsuleLast", &efi_guid_capsule_report,
+	ret = efi_set_variable_int(u"CapsuleLast", &efi_guid_capsule_report,
 				   EFI_VARIABLE_READ_ONLY |
 				   EFI_VARIABLE_NON_VOLATILE |
 				   EFI_VARIABLE_BOOTSERVICE_ACCESS |
 				   EFI_VARIABLE_RUNTIME_ACCESS,
 				   22, variable_name16, false);
 	if (ret != EFI_SUCCESS)
-		log_err("Setting %ls failed\n", L"CapsuleLast");
+		log_err("Setting %ls failed\n", u"CapsuleLast");
 }
 
 #ifdef CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT
@@ -707,7 +707,7 @@ static efi_status_t find_boot_device(void)
 	/* find active boot device in BootNext */
 	bootnext = 0;
 	size = sizeof(bootnext);
-	ret = efi_get_variable_int(L"BootNext",
+	ret = efi_get_variable_int(u"BootNext",
 				   (efi_guid_t *)&efi_global_variable_guid,
 				   NULL, &size, &bootnext, NULL);
 	if (ret == EFI_SUCCESS || ret == EFI_BUFFER_TOO_SMALL) {
@@ -734,7 +734,7 @@ static efi_status_t find_boot_device(void)
 skip:
 	/* find active boot device in BootOrder */
 	size = 0;
-	ret = efi_get_variable_int(L"BootOrder", &efi_global_variable_guid,
+	ret = efi_get_variable_int(u"BootOrder", &efi_global_variable_guid,
 				   NULL, &size, NULL, NULL);
 	if (ret == EFI_BUFFER_TOO_SMALL) {
 		boot_order = malloc(size);
@@ -743,7 +743,7 @@ skip:
 			goto out;
 		}
 
-		ret = efi_get_variable_int(L"BootOrder",
+		ret = efi_get_variable_int(u"BootOrder",
 					   &efi_global_variable_guid,
 					   NULL, &size, boot_order, NULL);
 	}
@@ -875,8 +875,8 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num)
 			break;
 
 		if (!(dirent->attribute & EFI_FILE_DIRECTORY) &&
-		    u16_strcmp(dirent->file_name, L".") &&
-		    u16_strcmp(dirent->file_name, L".."))
+		    u16_strcmp(dirent->file_name, u".") &&
+		    u16_strcmp(dirent->file_name, u".."))
 			tmp_files[count++] = u16_strdup(dirent->file_name);
 	}
 	/* ignore an error */
@@ -1052,7 +1052,7 @@ static efi_status_t check_run_capsules(void)
 	efi_status_t r;
 
 	size = sizeof(os_indications);
-	r = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid,
+	r = efi_get_variable_int(u"OsIndications", &efi_global_variable_guid,
 				 NULL, &size, &os_indications, NULL);
 	if (r != EFI_SUCCESS || size != sizeof(os_indications))
 		return EFI_NOT_FOUND;
@@ -1061,7 +1061,7 @@ static efi_status_t check_run_capsules(void)
 	    EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED) {
 		os_indications &=
 			~EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED;
-		r = efi_set_variable_int(L"OsIndications",
+		r = efi_set_variable_int(u"OsIndications",
 					 &efi_global_variable_guid,
 					 EFI_VARIABLE_NON_VOLATILE |
 					 EFI_VARIABLE_BOOTSERVICE_ACCESS |
lib/efi_loader/efi_helper.c +1 -1
index b80a6e07dff..802d39ed97b 100644
@@ -36,7 +36,7 @@ static efi_status_t efi_create_current_boot_var(u16 var_name[],
 	u16 *pos;
 
 	boot_current_size = sizeof(boot_current);
-	ret = efi_get_variable_int(L"BootCurrent",
+	ret = efi_get_variable_int(u"BootCurrent",
 				   &efi_global_variable_guid, NULL,
 				   &boot_current_size, &boot_current, NULL);
 	if (ret != EFI_SUCCESS)
lib/efi_loader/efi_image_loader.c +4 -4
index 773bd0677c0..3057e990b87 100644
@@ -532,13 +532,13 @@ static bool efi_image_unsigned_authenticate(struct efi_image_regions *regs)
 	struct efi_signature_store *db = NULL, *dbx = NULL;
 	bool ret = false;
 
-	dbx = efi_sigstore_parse_sigdb(L"dbx");
+	dbx = efi_sigstore_parse_sigdb(u"dbx");
 	if (!dbx) {
 		EFI_PRINT("Getting signature database(dbx) failed\n");
 		goto out;
 	}
 
-	db = efi_sigstore_parse_sigdb(L"db");
+	db = efi_sigstore_parse_sigdb(u"db");
 	if (!db) {
 		EFI_PRINT("Getting signature database(db) failed\n");
 		goto out;
@@ -621,13 +621,13 @@ static bool efi_image_authenticate(void *efi, size_t efi_size)
 	/*
 	 * verify signature using db and dbx
 	 */
-	db = efi_sigstore_parse_sigdb(L"db");
+	db = efi_sigstore_parse_sigdb(u"db");
 	if (!db) {
 		EFI_PRINT("Getting signature database(db) failed\n");
 		goto err;
 	}
 
-	dbx = efi_sigstore_parse_sigdb(L"dbx");
+	dbx = efi_sigstore_parse_sigdb(u"dbx");
 	if (!dbx) {
 		EFI_PRINT("Getting signature database(dbx) failed\n");
 		goto err;
lib/efi_loader/efi_setup.c +7 -7
index 49172e35798..e4109b9e849 100644
@@ -43,7 +43,7 @@ static efi_status_t efi_init_platform_lang(void)
 	 * Variable PlatformLangCodes defines the language codes that the
 	 * machine can support.
 	 */
-	ret = efi_set_variable_int(L"PlatformLangCodes",
+	ret = efi_set_variable_int(u"PlatformLangCodes",
 				   &efi_global_variable_guid,
 				   EFI_VARIABLE_BOOTSERVICE_ACCESS |
 				   EFI_VARIABLE_RUNTIME_ACCESS |
@@ -57,7 +57,7 @@ static efi_status_t efi_init_platform_lang(void)
 	 * Variable PlatformLang defines the language that the machine has been
 	 * configured for.
 	 */
-	ret = efi_get_variable_int(L"PlatformLang",
+	ret = efi_get_variable_int(u"PlatformLang",
 				   &efi_global_variable_guid,
 				   NULL, &data_size, &pos, NULL);
 	if (ret == EFI_BUFFER_TOO_SMALL) {
@@ -74,7 +74,7 @@ static efi_status_t efi_init_platform_lang(void)
 	if (pos)
 		*pos = 0;
 
-	ret = efi_set_variable_int(L"PlatformLang",
+	ret = efi_set_variable_int(u"PlatformLang",
 				   &efi_global_variable_guid,
 				   EFI_VARIABLE_NON_VOLATILE |
 				   EFI_VARIABLE_BOOTSERVICE_ACCESS |
@@ -100,7 +100,7 @@ static efi_status_t efi_init_secure_boot(void)
 	};
 	efi_status_t ret;
 
-	ret = efi_set_variable_int(L"SignatureSupport",
+	ret = efi_set_variable_int(u"SignatureSupport",
 				   &efi_global_variable_guid,
 				   EFI_VARIABLE_READ_ONLY |
 				   EFI_VARIABLE_BOOTSERVICE_ACCESS |
@@ -129,12 +129,12 @@ static efi_status_t efi_init_capsule(void)
 	efi_status_t ret = EFI_SUCCESS;
 
 	if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_UPDATE)) {
-		ret = efi_set_variable_int(L"CapsuleMax",
+		ret = efi_set_variable_int(u"CapsuleMax",
 					   &efi_guid_capsule_report,
 					   EFI_VARIABLE_READ_ONLY |
 					   EFI_VARIABLE_BOOTSERVICE_ACCESS |
 					   EFI_VARIABLE_RUNTIME_ACCESS,
-					   22, L"CapsuleFFFF", false);
+					   22, u"CapsuleFFFF", false);
 		if (ret != EFI_SUCCESS)
 			printf("EFI: cannot initialize CapsuleMax variable\n");
 	}
@@ -165,7 +165,7 @@ static efi_status_t efi_init_os_indications(void)
 		os_indications_supported |=
 			EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED;
 
-	return efi_set_variable_int(L"OsIndicationsSupported",
+	return efi_set_variable_int(u"OsIndicationsSupported",
 				    &efi_global_variable_guid,
 				    EFI_VARIABLE_BOOTSERVICE_ACCESS |
 				    EFI_VARIABLE_RUNTIME_ACCESS |
lib/efi_loader/efi_string.c +1 -1
index a3b8edf5a80..8bf1e493b89 100644
@@ -16,7 +16,7 @@
  * @index:	Index
  *
  * Create a utf-16 string with @name, appending @index.
- * For example, L"Capsule0001"
+ * For example, u"Capsule0001"
  *
  * The caller must ensure that the buffer has enough space for the resulting
  * string including the trailing L'\0'.
lib/efi_loader/efi_tcg2.c +2 -2
index 0ae07ef0839..99ec3a54867 100644
@@ -1916,8 +1916,8 @@ static efi_status_t tcg2_measure_boot_variable(struct udevice *dev)
 {
 	u16 *boot_order;
 	u16 *boot_index;
-	u16 var_name[] = L"BootOrder";
-	u16 boot_name[] = L"Boot####";
+	u16 var_name[] = u"BootOrder";
+	u16 boot_name[] = u"Boot####";
 	u8 *bootvar;
 	efi_uintn_t var_data_size;
 	u32 count, i;
lib/efi_loader/efi_var_common.c +6 -6
index 3cbb7c96c2e..562c0a34514 100644
@@ -229,26 +229,26 @@ static efi_status_t efi_set_secure_state(u8 secure_boot, u8 setup_mode,
 
 	efi_secure_boot = secure_boot;
 
-	ret = efi_set_variable_int(L"SecureBoot", &efi_global_variable_guid,
+	ret = efi_set_variable_int(u"SecureBoot", &efi_global_variable_guid,
 				   attributes_ro, sizeof(secure_boot),
 				   &secure_boot, false);
 	if (ret != EFI_SUCCESS)
 		goto err;
 
-	ret = efi_set_variable_int(L"SetupMode", &efi_global_variable_guid,
+	ret = efi_set_variable_int(u"SetupMode", &efi_global_variable_guid,
 				   attributes_ro, sizeof(setup_mode),
 				   &setup_mode, false);
 	if (ret != EFI_SUCCESS)
 		goto err;
 
-	ret = efi_set_variable_int(L"AuditMode", &efi_global_variable_guid,
+	ret = efi_set_variable_int(u"AuditMode", &efi_global_variable_guid,
 				   audit_mode || setup_mode ?
 				   attributes_ro : attributes_rw,
 				   sizeof(audit_mode), &audit_mode, false);
 	if (ret != EFI_SUCCESS)
 		goto err;
 
-	ret = efi_set_variable_int(L"DeployedMode",
+	ret = efi_set_variable_int(u"DeployedMode",
 				   &efi_global_variable_guid,
 				   audit_mode || deployed_mode || setup_mode ?
 				   attributes_ro : attributes_rw,
@@ -280,7 +280,7 @@ static efi_status_t efi_transfer_secure_state(enum efi_secure_mode mode)
 		if (ret != EFI_SUCCESS)
 			goto err;
 	} else if (mode == EFI_MODE_AUDIT) {
-		ret = efi_set_variable_int(L"PK", &efi_global_variable_guid,
+		ret = efi_set_variable_int(u"PK", &efi_global_variable_guid,
 					   EFI_VARIABLE_BOOTSERVICE_ACCESS |
 					   EFI_VARIABLE_RUNTIME_ACCESS,
 					   0, NULL, false);
@@ -354,7 +354,7 @@ efi_status_t efi_init_secure_state(void)
 		return ret;
 
 	/* As we do not provide vendor keys this variable is always 0. */
-	ret = efi_set_variable_int(L"VendorKeys",
+	ret = efi_set_variable_int(u"VendorKeys",
 				   &efi_global_variable_guid,
 				   EFI_VARIABLE_BOOTSERVICE_ACCESS |
 				   EFI_VARIABLE_RUNTIME_ACCESS |
lib/efi_loader/efi_variable.c +3 -3
index 5adc7f821a8..8ca2d85694c 100644
@@ -145,15 +145,15 @@ static efi_status_t efi_variable_authenticate(const u16 *variable,
 	case EFI_AUTH_VAR_PK:
 	case EFI_AUTH_VAR_KEK:
 		/* with PK */
-		truststore = efi_sigstore_parse_sigdb(L"PK");
+		truststore = efi_sigstore_parse_sigdb(u"PK");
 		if (!truststore)
 			goto err;
 		break;
 	case EFI_AUTH_VAR_DB:
 	case EFI_AUTH_VAR_DBX:
 		/* with PK and KEK */
-		truststore = efi_sigstore_parse_sigdb(L"KEK");
-		truststore2 = efi_sigstore_parse_sigdb(L"PK");
+		truststore = efi_sigstore_parse_sigdb(u"KEK");
+		truststore2 = efi_sigstore_parse_sigdb(u"PK");
 		if (!truststore) {
 			if (!truststore2)
 				goto err;
lib/efi_loader/efi_variable_tee.c +1 -1
index a2c65e36947..58931c4efd7 100644
@@ -588,7 +588,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
 	if (alt_ret != EFI_SUCCESS)
 		goto out;
 
-	if (!u16_strcmp(variable_name, L"PK"))
+	if (!u16_strcmp(variable_name, u"PK"))
 		alt_ret = efi_init_secure_state();
 out:
 	free(comm_buf);
lib/efi_loader/helloworld.c +20 -20
index 3f215e2a46e..ec17c73a5e1 100644
@@ -34,7 +34,7 @@ static struct efi_simple_text_output_protocol *con_out;
  */
 static void print_uefi_revision(void)
 {
-	u16 rev[] = L"0.0.0";
+	u16 rev[] = u"0.0.0";
 
 	rev[0] = (systable->hdr.revision >> 16) + '0';
 	rev[4] = systable->hdr.revision & 0xffff;
@@ -48,9 +48,9 @@ static void print_uefi_revision(void)
 	else
 		rev[3] = 0;
 
-	con_out->output_string(con_out, L"Running on UEFI ");
+	con_out->output_string(con_out, u"Running on UEFI ");
 	con_out->output_string(con_out, rev);
-	con_out->output_string(con_out, L"\r\n");
+	con_out->output_string(con_out, u"\r\n");
 }
 
 /**
@@ -65,15 +65,15 @@ static void print_config_tables(void)
 		if (!memcmp(&systable->tables[i].guid, &fdt_guid,
 			    sizeof(efi_guid_t)))
 			con_out->output_string
-					(con_out, L"Have device tree\r\n");
+					(con_out, u"Have device tree\r\n");
 		if (!memcmp(&systable->tables[i].guid, &acpi_guid,
 			    sizeof(efi_guid_t)))
 			con_out->output_string
-					(con_out, L"Have ACPI 2.0 table\r\n");
+					(con_out, u"Have ACPI 2.0 table\r\n");
 		if (!memcmp(&systable->tables[i].guid, &smbios_guid,
 			    sizeof(efi_guid_t)))
 			con_out->output_string
-					(con_out, L"Have SMBIOS table\r\n");
+					(con_out, u"Have SMBIOS table\r\n");
 	}
 }
 
@@ -86,13 +86,13 @@ static void print_config_tables(void)
 void print_load_options(struct efi_loaded_image *loaded_image)
 {
 	/* Output the load options */
-	con_out->output_string(con_out, L"Load options: ");
+	con_out->output_string(con_out, u"Load options: ");
 	if (loaded_image->load_options_size && loaded_image->load_options)
 		con_out->output_string(con_out,
 				       (u16 *)loaded_image->load_options);
 	else
-		con_out->output_string(con_out, L"<none>");
-	con_out->output_string(con_out, L"\r\n");
+		con_out->output_string(con_out, u"<none>");
+	con_out->output_string(con_out, u"\r\n");
 }
 
 /**
@@ -108,21 +108,21 @@ efi_status_t print_device_path(struct efi_device_path *device_path,
 	efi_status_t ret;
 
 	if (!device_path) {
-		con_out->output_string(con_out, L"<none>\r\n");
+		con_out->output_string(con_out, u"<none>\r\n");
 		return EFI_SUCCESS;
 	}
 
 	string = dp2txt->convert_device_path_to_text(device_path, true, false);
 	if (!string) {
 		con_out->output_string
-			(con_out, L"Cannot convert device path to text\r\n");
+			(con_out, u"Cannot convert device path to text\r\n");
 		return EFI_OUT_OF_RESOURCES;
 	}
 	con_out->output_string(con_out, string);
-	con_out->output_string(con_out, L"\r\n");
+	con_out->output_string(con_out, u"\r\n");
 	ret = boottime->free_pool(string);
 	if (ret != EFI_SUCCESS) {
-		con_out->output_string(con_out, L"Cannot free pool memory\r\n");
+		con_out->output_string(con_out, u"Cannot free pool memory\r\n");
 		return ret;
 	}
 	return EFI_SUCCESS;
@@ -148,7 +148,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 	con_out = systable->con_out;
 
 	/* UEFI requires CR LF */
-	con_out->output_string(con_out, L"Hello, world!\r\n");
+	con_out->output_string(con_out, u"Hello, world!\r\n");
 
 	print_uefi_revision();
 	print_config_tables();
@@ -158,7 +158,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 					(void **)&loaded_image);
 	if (ret != EFI_SUCCESS) {
 		con_out->output_string
-			(con_out, L"Cannot open loaded image protocol\r\n");
+			(con_out, u"Cannot open loaded image protocol\r\n");
 		goto out;
 	}
 	print_load_options(loaded_image);
@@ -168,12 +168,12 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 					NULL, (void **)&device_path_to_text);
 	if (ret != EFI_SUCCESS) {
 		con_out->output_string
-			(con_out, L"Cannot open device path to text protocol\r\n");
+			(con_out, u"Cannot open device path to text protocol\r\n");
 		goto out;
 	}
 	if (!loaded_image->device_handle) {
 		con_out->output_string
-			(con_out, L"Missing device handle\r\n");
+			(con_out, u"Missing device handle\r\n");
 		goto out;
 	}
 	ret = boottime->handle_protocol(loaded_image->device_handle,
@@ -181,14 +181,14 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 					(void **)&device_path);
 	if (ret != EFI_SUCCESS) {
 		con_out->output_string
-			(con_out, L"Missing device path for device handle\r\n");
+			(con_out, u"Missing device path for device handle\r\n");
 		goto out;
 	}
-	con_out->output_string(con_out, L"Boot device: ");
+	con_out->output_string(con_out, u"Boot device: ");
 	ret = print_device_path(device_path, device_path_to_text);
 	if (ret != EFI_SUCCESS)
 		goto out;
-	con_out->output_string(con_out, L"File path: ");
+	con_out->output_string(con_out, u"File path: ");
 	ret = print_device_path(loaded_image->file_path, device_path_to_text);
 	if (ret != EFI_SUCCESS)
 		goto out;
lib/efi_selftest/dtbdump.c +41 -41

264 lines not on this page · raw message

lib/efi_selftest/efi_selftest.c +1 -1
index 3da34b1d46d..4a88ec69b53 100644
@@ -18,7 +18,7 @@ static const struct efi_system_table *systable;
 static const struct efi_boot_services *boottime;
 static const struct efi_runtime_services *runtime;
 static efi_handle_t handle;
-static u16 reset_message[] = L"Selftest completed";
+static u16 reset_message[] = u"Selftest completed";
 static int *setup_status;
 
 /*
lib/efi_selftest/efi_selftest_block_device.c +3 -3
index ad53dac796b..5e05d36716d 100644
@@ -407,7 +407,7 @@ static int execute(void)
 	}
 
 	/* Read file */
-	ret = root->open(root, &file, L"hello.txt", EFI_FILE_MODE_READ,
+	ret = root->open(root, &file, u"hello.txt", EFI_FILE_MODE_READ,
 			 0);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("Failed to open file\n");
@@ -451,7 +451,7 @@ static int execute(void)
 
 #ifdef CONFIG_FAT_WRITE
 	/* Write file */
-	ret = root->open(root, &file, L"u-boot.txt", EFI_FILE_MODE_READ |
+	ret = root->open(root, &file, u"u-boot.txt", EFI_FILE_MODE_READ |
 			 EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("Failed to open file\n");
@@ -483,7 +483,7 @@ static int execute(void)
 
 	/* Verify file */
 	boottime->set_mem(buf, sizeof(buf), 0);
-	ret = root->open(root, &file, L"u-boot.txt", EFI_FILE_MODE_READ,
+	ret = root->open(root, &file, u"u-boot.txt", EFI_FILE_MODE_READ,
 			 0);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("Failed to open file\n");
lib/efi_selftest/efi_selftest_devicepath.c +1 -1
index d87b9f7dcd0..8a22a5d4d9c 100644
@@ -319,7 +319,7 @@ static int execute(void)
 			{ DEVICE_PATH_TYPE_MEDIA_DEVICE,
 			  DEVICE_PATH_SUB_TYPE_FILE_PATH,
 			  sizeof(struct efi_device_path) + 12},
-			L"u-boot.bin",
+			u"u-boot.bin",
 		};
 	u16 *string;
 	efi_status_t ret;
lib/efi_selftest/efi_selftest_exception.c +1 -1
index d86228a8926..f3a810429af 100644
@@ -31,7 +31,7 @@ static struct {
 		DEVICE_PATH_SUB_TYPE_FILE_PATH,
 		sizeof(dp.dp) + sizeof(dp.filename),
 	},
-	L"bug.efi",
+	u"bug.efi",
 	{
 		DEVICE_PATH_TYPE_END,
 		DEVICE_PATH_SUB_TYPE_END,
lib/efi_selftest/efi_selftest_fdt.c +3 -3
index 739f029b8c7..4b49b5b8bd0 100644
@@ -199,7 +199,7 @@ static int execute(void)
 	char *str;
 	efi_status_t ret;
 
-	str = get_property(L"compatible", NULL);
+	str = get_property(u"compatible", NULL);
 	if (str) {
 		efi_st_printf("compatible: %s\n", str);
 		ret = boottime->free_pool(str);
@@ -211,7 +211,7 @@ static int execute(void)
 		efi_st_error("Missing property 'compatible'\n");
 		return EFI_ST_FAILURE;
 	}
-	str = get_property(L"serial-number", NULL);
+	str = get_property(u"serial-number", NULL);
 	if (str) {
 		efi_st_printf("serial-number: %s\n", str);
 		ret = boottime->free_pool(str);
@@ -220,7 +220,7 @@ static int execute(void)
 			return EFI_ST_FAILURE;
 		}
 	}
-	str = get_property(L"boot-hartid", L"chosen");
+	str = get_property(u"boot-hartid", u"chosen");
 	if (IS_ENABLED(CONFIG_RISCV)) {
 		if (str) {
 			efi_st_printf("boot-hartid: %u\n",
lib/efi_selftest/efi_selftest_hii.c +4 -4
index f4b70f79508..432b038475b 100644
@@ -699,7 +699,7 @@ static int test_hii_string_new_string(void)
 
 	ret = hii_string_protocol->new_string(hii_string_protocol, handle,
 					      &id, (u8 *)"en-US",
-					      L"Japanese", L"Japanese", NULL);
+					      u"Japanese", u"Japanese", NULL);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("new_string returned %u\n",
 			     (unsigned int)ret);
@@ -752,7 +752,7 @@ static int test_hii_string_get_string(void)
 
 	ret = hii_string_protocol->new_string(hii_string_protocol, handle,
 					      &id, (u8 *)"en-US",
-					      L"Japanese", L"Japanese", NULL);
+					      u"Japanese", u"Japanese", NULL);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("new_string returned %u\n",
 			     (unsigned int)ret);
@@ -831,7 +831,7 @@ static int test_hii_string_set_string(void)
 
 	ret = hii_string_protocol->new_string(hii_string_protocol, handle,
 					      &id, (u8 *)"en-US",
-					      L"Japanese", L"Japanese", NULL);
+					      u"Japanese", u"Japanese", NULL);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("new_string returned %u\n",
 			     (unsigned int)ret);
@@ -840,7 +840,7 @@ static int test_hii_string_set_string(void)
 
 	ret = hii_string_protocol->set_string(hii_string_protocol, handle,
 					      id, (u8 *)"en-US",
-					      L"Nihongo", NULL);
+					      u"Nihongo", NULL);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("set_string returned %u\n",
 			     (unsigned int)ret);
lib/efi_selftest/efi_selftest_load_file.c +2 -2
index bf955cbf663..f8c637791f9 100644
@@ -101,7 +101,7 @@ static struct {
 			FILE_NAME_SIZE * sizeof(u16),
 		}
 	},
-	L"\\lf.efi",
+	u"\\lf.efi",
 	{
 		DEVICE_PATH_TYPE_END,
 		DEVICE_PATH_SUB_TYPE_END,
@@ -152,7 +152,7 @@ static struct {
 			FILE_NAME_SIZE * sizeof(u16),
 		}
 	},
-	L"\\lf2.efi",
+	u"\\lf2.efi",
 	{
 		DEVICE_PATH_TYPE_END,
 		DEVICE_PATH_SUB_TYPE_END,
lib/efi_selftest/efi_selftest_loadimage.c +2 -2
index 4975d80ff1c..522722e01fe 100644
@@ -20,8 +20,8 @@
 /* Binary logarithm of the block size */
 #define LB_BLOCK_SIZE 9
 
-#define FILE_NAME L"app.efi"
-#define VOLUME_NAME L"EfiDisk"
+#define FILE_NAME u"app.efi"
+#define VOLUME_NAME u"EfiDisk"
 
 static struct efi_boot_services *boottime;
 static efi_handle_t handle_image;
lib/efi_selftest/efi_selftest_miniapp_exception.c +2 -2
index 9be0e7e3eb1..79f9a67859b 100644
@@ -23,7 +23,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 	struct efi_simple_text_output_protocol *con_out = systable->con_out;
 
 	con_out->output_string(con_out,
-			       L"EFI application triggers exception.\n");
+			       u"EFI application triggers exception.\n");
 
 #if defined(CONFIG_ARM)
 	/*
@@ -38,6 +38,6 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 #elif defined(CONFIG_X86)
 	asm volatile (".word 0xffff\n");
 #endif
-	con_out->output_string(con_out, L"Exception not triggered.\n");
+	con_out->output_string(con_out, u"Exception not triggered.\n");
 	return EFI_ABORTED;
 }
lib/efi_selftest/efi_selftest_miniapp_exit.c +4 -4
index 6b5cfb01cf7..77a1869e47d 100644
@@ -40,7 +40,7 @@ static efi_status_t EFIAPI check_loaded_image_protocol
 				  NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
 	if (ret != EFI_SUCCESS) {
 		cout->output_string(cout,
-				    L"Could not open loaded image protocol");
+				    u"Could not open loaded image protocol");
 		return ret;
 	}
 	if ((void *)check_loaded_image_protocol <
@@ -49,7 +49,7 @@ static efi_status_t EFIAPI check_loaded_image_protocol
 	    loaded_image_protocol->image_base +
 	    loaded_image_protocol->image_size) {
 		cout->output_string(cout,
-				    L"Incorrect image_base or image_size\n");
+				    u"Incorrect image_base or image_size\n");
 		return EFI_NOT_FOUND;
 	}
 	return EFI_SUCCESS;
@@ -69,11 +69,11 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 	efi_status_t ret;
 	u16 text[] = EFI_ST_SUCCESS_STR;
 
-	con_out->output_string(con_out, L"EFI application calling Exit\n");
+	con_out->output_string(con_out, u"EFI application calling Exit\n");
 
 	if (check_loaded_image_protocol(handle, systable) != EFI_SUCCESS) {
 		con_out->output_string(con_out,
-				       L"Loaded image protocol missing\n");
+				       u"Loaded image protocol missing\n");
 		ret = EFI_NOT_FOUND;
 		goto out;
 	}
lib/efi_selftest/efi_selftest_miniapp_return.c +1 -1
index 25a2bd16373..45366aa9c63 100644
@@ -24,7 +24,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 	struct efi_simple_text_output_protocol *con_out = systable->con_out;
 
 	con_out->output_string(con_out,
-			       L"EFI application returning w/o calling Exit\n");
+			       u"EFI application returning w/o calling Exit\n");
 
 	/* The return value is checked by the calling test */
 	return EFI_INCOMPATIBLE_VERSION;
lib/efi_selftest/efi_selftest_reset.c +1 -1
index 8b6ac24cb15..24e8cc06bd4 100644
@@ -33,7 +33,7 @@ static int setup(const efi_handle_t handle,
  */
 static int execute(void)
 {
-	u16 reset_data[] = L"Reset by selftest";
+	u16 reset_data[] = u"Reset by selftest";
 
 	runtime->reset_system(EFI_RESET_COLD, EFI_SUCCESS,
 			      sizeof(reset_data), reset_data);
lib/efi_selftest/efi_selftest_textoutput.c +6 -6
index a87f65e197f..f6b029df23d 100644
@@ -44,14 +44,14 @@ static int execute(void)
 	}
 	/* TestString */
 	ret = con_out->test_string(con_out,
-			L" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n");
+			u" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n");
 	if (ret != EFI_ST_SUCCESS) {
 		efi_st_error("TestString failed for ANSI characters\n");
 		return EFI_ST_FAILURE;
 	}
 	/* OutputString */
 	ret = con_out->output_string(con_out,
-				     L"Testing cursor column update\n");
+				     u"Testing cursor column update\n");
 	if (ret != EFI_ST_SUCCESS) {
 		efi_st_error("OutputString failed for ANSI characters");
 		return EFI_ST_FAILURE;
@@ -75,7 +75,7 @@ static int execute(void)
 		efi_st_error("Cursor column not 0 at beginning of line\n");
 		return EFI_ST_FAILURE;
 	}
-	ret = con_out->output_string(con_out, L"123");
+	ret = con_out->output_string(con_out, u"123");
 	if (ret != EFI_ST_SUCCESS) {
 		efi_st_error("OutputString failed for ANSI characters\n");
 		return EFI_ST_FAILURE;
@@ -84,7 +84,7 @@ static int execute(void)
 		efi_st_error("Cursor column not incremented properly\n");
 		return EFI_ST_FAILURE;
 	}
-	ret = con_out->output_string(con_out, L"\b");
+	ret = con_out->output_string(con_out, u"\b");
 	if (ret != EFI_ST_SUCCESS) {
 		efi_st_error("OutputString failed for backspace\n");
 		return EFI_ST_FAILURE;
@@ -93,7 +93,7 @@ static int execute(void)
 		efi_st_error("Cursor column not decremented properly\n");
 		return EFI_ST_FAILURE;
 	}
-	ret = con_out->output_string(con_out, L"\b\b");
+	ret = con_out->output_string(con_out, u"\b\b");
 	if (ret != EFI_ST_SUCCESS) {
 		efi_st_error("OutputString failed for backspace\n");
 		return EFI_ST_FAILURE;
@@ -102,7 +102,7 @@ static int execute(void)
 		efi_st_error("Cursor column not decremented properly\n");
 		return EFI_ST_FAILURE;
 	}
-	ret = con_out->output_string(con_out, L"\b\b");
+	ret = con_out->output_string(con_out, u"\b\b");
 	if (ret != EFI_ST_SUCCESS) {
 		efi_st_error("OutputString failed for backspace\n");
 		return EFI_ST_FAILURE;
lib/efi_selftest/efi_selftest_unicode_collation.c +19 -19
index 75294307d9f..c63a1b51e4e 100644
@@ -44,9 +44,9 @@ static int setup(const efi_handle_t handle,
 static int test_stri_coll(void)
 {
 	efi_intn_t ret;
-	u16 c1[] = L"first";
-	u16 c2[] = L"FIRST";
-	u16 c3[] = L"second";
+	u16 c1[] = u"first";
+	u16 c2[] = u"FIRST";
+	u16 c3[] = u"second";
 
 	ret = unicode_collation_protocol->stri_coll(unicode_collation_protocol,
 						    c1, c2);
@@ -78,66 +78,66 @@ static int test_stri_coll(void)
 static int test_metai_match(void)
 {
 	bool ret;
-	const u16 c[] = L"Das U-Boot";
+	const u16 c[] = u"Das U-Boot";
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"*");
+		unicode_collation_protocol, c, u"*");
 	if (!ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
 	}
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"Da[rstu] U-Boot");
+		unicode_collation_protocol, c, u"Da[rstu] U-Boot");
 	if (!ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
 	}
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"Da[q-v] U-Boot");
+		unicode_collation_protocol, c, u"Da[q-v] U-Boot");
 	if (!ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
 	}
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"Da? U-Boot");
+		unicode_collation_protocol, c, u"Da? U-Boot");
 	if (!ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
 	}
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"D*Bo*t");
+		unicode_collation_protocol, c, u"D*Bo*t");
 	if (!ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
 	}
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"Da[xyz] U-Boot");
+		unicode_collation_protocol, c, u"Da[xyz] U-Boot");
 	if (ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
 	}
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"Da[a-d] U-Boot");
+		unicode_collation_protocol, c, u"Da[a-d] U-Boot");
 	if (ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
 	}
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"Da?? U-Boot");
+		unicode_collation_protocol, c, u"Da?? U-Boot");
 	if (ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
 	}
 
 	ret = unicode_collation_protocol->metai_match(
-		unicode_collation_protocol, c, L"D*Bo*tt");
+		unicode_collation_protocol, c, u"D*Bo*tt");
 	if (ret) {
 		efi_st_error("metai_match returned %u\n", ret);
 		return EFI_ST_FAILURE;
@@ -148,7 +148,7 @@ static int test_metai_match(void)
 
 static int test_str_lwr(void)
 {
-	u16 c[] = L"U-Boot";
+	u16 c[] = u"U-Boot";
 
 	unicode_collation_protocol->str_lwr(unicode_collation_protocol, c);
 	if (efi_st_strcmp_16_8(c, "u-boot")) {
@@ -161,7 +161,7 @@ static int test_str_lwr(void)
 
 static int test_str_upr(void)
 {
-	u16 c[] = L"U-Boot";
+	u16 c[] = u"U-Boot";
 
 	unicode_collation_protocol->str_upr(unicode_collation_protocol, c);
 	if (efi_st_strcmp_16_8(c, "U-BOOT")) {
@@ -194,16 +194,16 @@ static int test_str_to_fat(void)
 
 	boottime->set_mem(fat, sizeof(fat), 0);
 	ret = unicode_collation_protocol->str_to_fat(unicode_collation_protocol,
-						     L"U -Boo.t", 6, fat);
-	if (ret || efi_st_strcmp_16_8(L"U-BOOT", fat)) {
+						     u"U -Boo.t", 6, fat);
+	if (ret || efi_st_strcmp_16_8(u"U-BOOT", fat)) {
 		efi_st_error("str_to_fat returned %u, \"%s\"\n", ret, fat);
 		return EFI_ST_FAILURE;
 	}
 
 	boottime->set_mem(fat, 16, 0);
 	ret = unicode_collation_protocol->str_to_fat(unicode_collation_protocol,
-						     L"U\\Boot", 6, fat);
-	if (!ret || efi_st_strcmp_16_8(L"U_BOOT", fat)) {
+						     u"U\\Boot", 6, fat);
+	if (!ret || efi_st_strcmp_16_8(u"U_BOOT", fat)) {
 		efi_st_error("str_to_fat returned %u, \"%s\"\n", ret, fat);
 		return EFI_ST_FAILURE;
 	}
lib/efi_selftest/efi_selftest_util.c +53 -53

117 lines not on this page · raw message

lib/efi_selftest/efi_selftest_variables.c +11 -11
index 2c16f3db6cc..dc1d5c8f43e 100644
@@ -63,7 +63,7 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 	/* Set variable 0 */
-	ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0,
+	ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0,
 				    EFI_VARIABLE_BOOTSERVICE_ACCESS,
 				    3, v + 4);
 	if (ret != EFI_SUCCESS) {
@@ -72,7 +72,7 @@ static int execute(void)
 	}
 	data[3] = 0xff;
 	len = 3;
-	ret = runtime->get_variable(L"efi_st_var0", &guid_vendor0,
+	ret = runtime->get_variable(u"efi_st_var0", &guid_vendor0,
 				    &attr, &len, data);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("GetVariable failed\n");
@@ -87,7 +87,7 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 	/* Set variable 1 */
-	ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1,
+	ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1,
 				    EFI_VARIABLE_BOOTSERVICE_ACCESS,
 				    8, v);
 	if (ret != EFI_SUCCESS) {
@@ -95,7 +95,7 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 	len = EFI_ST_MAX_DATA_SIZE;
-	ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1,
+	ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1,
 				    &attr, &len, data);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("GetVariable failed\n");
@@ -111,7 +111,7 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 	/* Append variable 1 */
-	ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1,
+	ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1,
 				    EFI_VARIABLE_BOOTSERVICE_ACCESS |
 				    EFI_VARIABLE_APPEND_WRITE,
 				    7, v + 8);
@@ -120,7 +120,7 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 	len = EFI_ST_MAX_DATA_SIZE;
-	ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1,
+	ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1,
 				    &attr, &len, data);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("GetVariable failed\n");
@@ -132,7 +132,7 @@ static int execute(void)
 	if (memcmp(data, v, len))
 		efi_st_todo("GetVariable returned wrong value\n");
 	/* Append variable 2 */
-	ret = runtime->set_variable(L"efi_none", &guid_vendor1,
+	ret = runtime->set_variable(u"efi_none", &guid_vendor1,
 				    EFI_VARIABLE_BOOTSERVICE_ACCESS |
 				    EFI_VARIABLE_APPEND_WRITE,
 				    15, v);
@@ -173,28 +173,28 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 	/* Delete variable 1 */
-	ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1,
+	ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1,
 				    0, 0, NULL);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("SetVariable failed\n");
 		return EFI_ST_FAILURE;
 	}
 	len = EFI_ST_MAX_DATA_SIZE;
-	ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1,
+	ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1,
 				    &attr, &len, data);
 	if (ret != EFI_NOT_FOUND) {
 		efi_st_error("Variable was not deleted\n");
 		return EFI_ST_FAILURE;
 	}
 	/* Delete variable 0 */
-	ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0,
+	ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0,
 				    0, 0, NULL);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("SetVariable failed\n");
 		return EFI_ST_FAILURE;
 	}
 	len = EFI_ST_MAX_DATA_SIZE;
-	ret = runtime->get_variable(L"efi_st_var0", &guid_vendor0,
+	ret = runtime->get_variable(u"efi_st_var0", &guid_vendor0,
 				    &attr, &len, data);
 	if (ret != EFI_NOT_FOUND) {
 		efi_st_error("Variable was not deleted\n");
lib/efi_selftest/efi_selftest_variables_runtime.c +2 -2
index 3226069c0b2..4700d942410 100644
@@ -58,7 +58,7 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 
-	ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0,
+	ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0,
 				    EFI_VARIABLE_BOOTSERVICE_ACCESS |
 				    EFI_VARIABLE_RUNTIME_ACCESS,
 				    3, v + 4);
@@ -67,7 +67,7 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 	len = EFI_ST_MAX_DATA_SIZE;
-	ret = runtime->get_variable(L"PlatformLangCodes", &guid_vendor0,
+	ret = runtime->get_variable(u"PlatformLangCodes", &guid_vendor0,
 				    &attr, &len, data);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("GetVariable failed\n");
lib/efi_selftest/initrddump.c +30 -30

180 lines not on this page · raw message

Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog
#12 lore raw

PATCH v4 3/4 sandbox: Detect the host bit size automatically

In reply to Simon Glass

At present if you build sandbox on a 32-bit host a lot of errors are produced. This is because CONFIG_HOST_64BIT is enabled by default.

It is quite annoying to have to change that manually before building sandbox. It is also quite confusing for new users.

Add a way to detect the setting and add the appropriate CONFIG_HOST_64BIT=y or CONFIG_HOST_32BIT=y to the defconfig, to avoid this issue.

Tidy up the Kconfig help for the above two options while we are here.

---

Changes in v4:
- Use $(HOSTCC) instead of gcc
- Add proper Kconfig help

Changes in v3:
- Use 'bitness' instead of 'bit'

Changes in v2:
- Drop patches previously applied
- Put all the packages in gcc.rst

 Makefile                 | 11 ++++++++++-
 arch/sandbox/Kconfig     | 33 ++++++++++++++++++++++++++++-----
 scripts/kconfig/Makefile | 14 +++++++++++++-
 3 files changed, 51 insertions(+), 7 deletions(-)
Makefile +10 -1
index b08bad48738..da9b5e494f8 100644
@@ -570,8 +570,17 @@ export KBUILD_DEFCONFIG KBUILD_KCONFIG
 config: scripts_basic outputmakefile FORCE
 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
 
+# If nothing is specified explicitly, detect the bit size for sandbox,
+# referred to from arch/sandbox/Kconfig
+# Add it to the end of the defconfig file
 %config: scripts_basic outputmakefile FORCE
-	$(Q)$(MAKE) $(build)=scripts/kconfig $@
+	$(Q)if test -f $(srctree)/configs/$@ && \
+		! grep -Eq "CONFIG_HOST_(32|64)BIT=y" $(srctree)/configs/$@; then \
+		echo '#include <stdio.h>\nint main(void) { printf("CONFIG_HOST_%dBIT=y\\n", __WORDSIZE); return 0; }' \
+			 | $(HOSTCC) -x c - -o get_word_size; \
+		extra=$$(./get_word_size); \
+	fi; \
+	$(MAKE) $(build)=scripts/kconfig EXTRA_DEFCONFIG=$$extra $@
 
 else
 # ===========================================================================
arch/sandbox/Kconfig +28 -5
index 477c51960da..08d7f3bded6 100644
@@ -35,19 +35,42 @@ config SYS_CONFIG_NAME
 
 choice
 	prompt "Run sandbox on 32/64-bit host"
-	default HOST_64BIT
+	default HOST_DETECT_BITNESS
 	help
-	  Sandbox can be built on 32-bit and 64-bit hosts.
-	  The default is to build on a 64-bit host and run
-	  on a 64-bit host. If you want to run sandbox on
-	  a 32-bit host, change it here.
+	  Sandbox can be built on 32-bit and 64-bit hosts. This is generally
+	  auto-detected but you can force a particular word size here. If you
+	  see strange warnings about SANDBOX_BITS_PER_LONG then you may have
+	  selected the wrong value.
 
 config HOST_32BIT
 	bool "32-bit host"
 	depends on !PHYS_64BIT
+	help
+	  Select this if the host is a 32-bit machine. This adjusts various
+	  tests and other features to work correctly in this environment. If
+	  this option is enabled on 64-bit machines you may get build warnings
+	  and/or errors.
 
 config HOST_64BIT
 	bool "64-bit host"
+	help
+	  Select this if the host is a 64-bit machine. This adjusts various
+	  tests and other features to work correctly in this environment. If
+	  this option is enabled on 32-bit machines you may get build warnings
+	  and/or errors.
+
+config HOST_DETECT_BITNESS
+	bool "Auto-detect host bitness"
+	help
+	  Select this if you want the build system to determine the bitness
+	  automatically. This compiles a small program during the build, then
+	  runs it to determine the bitness using __WORDSIZE (32 or 64 bits).
+	  Then it adds one of the above options (CONFIG_HOST_32 or
+	  CONFIG_HOST_64) to the configuration when creating it.
+
+	  In rare situations this may fail, e.g. on an unsupported Operating
+	  System or toolchain, in which case you will likely get build warnings
+	  and errors.
 
 endchoice
 
scripts/kconfig/Makefile +13 -1
index 12e525ee31f..4e28a7e5973 100644
@@ -12,6 +12,9 @@ PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \
 #  Set SRCARCH to .. fake this Makefile.
 SRCARCH := ..
 
+# For U-Boot, EXTRA_DEFCONFIG contains a line to be added to the defconfig
+# before processing. If empty, no line is added.
+
 ifdef KBUILD_KCONFIG
 Kconfig := $(KBUILD_KCONFIG)
 else
@@ -92,8 +95,17 @@ else
 endif
 endif
 
+# If EXTRA_DEFCONFIG is defined, add it to the end of the defconfig, before
+# processing. This allows the caller to change a setting on the fly
 %_defconfig: $(obj)/conf
-	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
+	$(Q)defconfig="$(srctree)/arch/$(SRCARCH)/configs/$@"; \
+	if [ -n "$(EXTRA_DEFCONFIG)" ]; then \
+		cat $$defconfig >defconfig_tmp; \
+		echo $(EXTRA_DEFCONFIG) >>defconfig_tmp; \
+		$< $(silent) --defconfig=defconfig_tmp $(Kconfig); \
+	else \
+		$< $(silent) --defconfig=$$defconfig $(Kconfig); \
+	fi
 
 # Added for U-Boot (backward compatibility)
 %_config: %_defconfig
Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog
#13 lore raw

PATCH v4 4/4 treewide: Use 16-bit unicode strings

In reply to Simon Glass

At present we use wide characters for unicode but this is not necessary. Change the code to use the 'u' literal instead. This helps to fix build warnings for sandbox on rpi.

Note: This applies tree-wide

---

(no changes since v3)

Changes in v3:
- Add a new patch to change non-EFI occurences

 lib/lzma/Types.h  |  4 ++--
 lib/vsprintf.c    |  2 +-
 test/print_ut.c   |  2 +-
 test/unicode_ut.c | 22 +++++++++++-----------
 4 files changed, 15 insertions(+), 15 deletions(-)
lib/lzma/Types.h +2 -2
index 8afcba556eb..04f894a8ca9 100644
@@ -225,9 +225,9 @@ typedef struct
 #else
 
 #define CHAR_PATH_SEPARATOR '/'
-#define WCHAR_PATH_SEPARATOR L'/'
+#define WCHAR_PATH_SEPARATOR u'/'
 #define STRING_PATH_SEPARATOR "/"
-#define WSTRING_PATH_SEPARATOR L"/"
+#define WSTRING_PATH_SEPARATOR u"/"
 
 #endif
 
lib/vsprintf.c +1 -1
index de9f236b908..861923c703a 100644
@@ -279,7 +279,7 @@ static char *string(char *buf, char *end, char *s, int field_width,
 static __maybe_unused char *string16(char *buf, char *end, u16 *s,
 				     int field_width, int precision, int flags)
 {
-	const u16 *str = s ? s : L"<NULL>";
+	const u16 *str = s ? s : u"<NULL>";
 	ssize_t i, len = utf16_strnlen(str, precision);
 
 	if (!(flags & LEFT))
test/print_ut.c +1 -1
index 7b2e7bb152c..dd2d4620f7d 100644
@@ -106,7 +106,7 @@ static int print_printf(struct unit_test_state *uts)
 	snprintf(str, 0, "testing none");
 	ut_asserteq('x', *str);
 
-	sprintf(big_str, "_%ls_", L"foo");
+	sprintf(big_str, "_%ls_", u"foo");
 	ut_assertok(strcmp("_foo_", big_str));
 
 	/* Test the banner function */
test/unicode_ut.c +11 -11
index 617eed8cfa0..f821e5a6be8 100644
@@ -299,17 +299,17 @@ static int unicode_test_utf8_utf16_strcpy(struct unit_test_state *uts)
 	pos = buf;
 	utf8_utf16_strcpy(&pos, j1);
 	ut_asserteq(4, pos - buf);
-	ut_assert(!unicode_test_u16_strcmp(buf, L"j1?l", SIZE_MAX));
+	ut_assert(!unicode_test_u16_strcmp(buf, u"j1?l", SIZE_MAX));
 
 	pos = buf;
 	utf8_utf16_strcpy(&pos, j2);
 	ut_asserteq(4, pos - buf);
-	ut_assert(!unicode_test_u16_strcmp(buf, L"j2?l", SIZE_MAX));
+	ut_assert(!unicode_test_u16_strcmp(buf, u"j2?l", SIZE_MAX));
 
 	pos = buf;
 	utf8_utf16_strcpy(&pos, j3);
 	ut_asserteq(3, pos - buf);
-	ut_assert(!unicode_test_u16_strcmp(buf, L"j3?", SIZE_MAX));
+	ut_assert(!unicode_test_u16_strcmp(buf, u"j3?", SIZE_MAX));
 
 	return 0;
 }
@@ -584,13 +584,13 @@ UNICODE_TEST(unicode_test_utf_to_upper);
 
 static int unicode_test_u16_strncmp(struct unit_test_state *uts)
 {
-	ut_assert(u16_strncmp(L"abc", L"abc", 3) == 0);
-	ut_assert(u16_strncmp(L"abcdef", L"abcghi", 3) == 0);
-	ut_assert(u16_strncmp(L"abcdef", L"abcghi", 6) < 0);
-	ut_assert(u16_strncmp(L"abcghi", L"abcdef", 6) > 0);
-	ut_assert(u16_strcmp(L"abc", L"abc") == 0);
-	ut_assert(u16_strcmp(L"abcdef", L"deghi") < 0);
-	ut_assert(u16_strcmp(L"deghi", L"abcdef") > 0);
+	ut_assert(u16_strncmp(u"abc", u"abc", 3) == 0);
+	ut_assert(u16_strncmp(u"abcdef", u"abcghi", 3) == 0);
+	ut_assert(u16_strncmp(u"abcdef", u"abcghi", 6) < 0);
+	ut_assert(u16_strncmp(u"abcghi", u"abcdef", 6) > 0);
+	ut_assert(u16_strcmp(u"abc", u"abc") == 0);
+	ut_assert(u16_strcmp(u"abcdef", u"deghi") < 0);
+	ut_assert(u16_strcmp(u"deghi", u"abcdef") > 0);
 	return 0;
 }
 UNICODE_TEST(unicode_test_u16_strncmp);
@@ -713,7 +713,7 @@ UNICODE_TEST(unicode_test_utf8_to_utf32_stream);
 static int unicode_test_efi_create_indexed_name(struct unit_test_state *uts)
 {
 	u16 buf[16];
-	u16 const expected[] = L"Capsule0AF9";
+	u16 const expected[] = u"Capsule0AF9";
 	u16 *pos;
 
 	memset(buf, 0xeb, sizeof(buf));
Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog