0007-Make-vboot_version-extern-in-header.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From df4d2000a22db673a788b8e57e8e7c0cc3cee777 Mon Sep 17 00:00:00 2001
  2. From: Leonard Chan <leonardchan@google.com>
  3. Date: Thu, 3 Oct 2019 18:53:04 -0700
  4. Subject: [PATCH] Make vboot_version extern in header
  5. When enabling `-fno-common` in Fuchsia, we get a bunch of linker errors
  6. when linking futility:
  7. ```
  8. ld.lld: error: duplicate symbol: vboot_version
  9. >>> defined at futility.h:43 (../../third_party/vboot_reference/futility/futility.h:43)
  10. >>> host_x63-asan_no_detect_leaks/obj/third_party/vboot_reference/futility/futility.cmd_bdb.c.o:(vboot_version)
  11. >>> defined at futility.h:43 (../../third_party/vboot_reference/futility/futility.h:43)
  12. >>> host_x64-asan_no_detect_leaks/obj/third_party/vboot_reference/futility/futility.cmd_create.c.o:(.bss.vboot_version+0x0)
  13. ```
  14. and think this is because -fno-common places vboot_version for
  15. unitialized global variables in the BSS section of each object file.
  16. Making it extern instead resolves each reference to its definition in
  17. futility/misc.c.
  18. Change-Id: I591f07abd1f975a8a9d078bb4366e2e0861390b4
  19. Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1839207
  20. Reviewed-by: Julius Werner <jwerner@chromium.org>
  21. Reviewed-by: Joel Kitching <kitching@chromium.org>
  22. Commit-Queue: Julius Werner <jwerner@chromium.org>
  23. Tested-by: Julius Werner <jwerner@chromium.org>
  24. Patch taken from upstream: https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/df4d2000a22db673a788b8e57e8e7c0cc3cee777
  25. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
  26. ---
  27. futility/futility.h | 2 +-
  28. 1 file changed, 1 insertion(+), 1 deletion(-)
  29. diff --git a/futility/futility.h b/futility/futility.h
  30. index 3bce1106..5dc426dd 100644
  31. --- a/futility/futility.h
  32. +++ b/futility/futility.h
  33. @@ -41,7 +41,7 @@ enum vboot_version {
  34. };
  35. /* What's our preferred API & data format? */
  36. -enum vboot_version vboot_version;
  37. +extern enum vboot_version vboot_version;
  38. /* Here's a structure to define the commands that futility implements. */
  39. struct futil_cmd_t {
  40. --
  41. 2.20.1