From 0ebbab579769b7e21e2007147e840755d349a2ac Mon Sep 17 00:00:00 2001 From: Sophon Date: Sun, 23 Jan 2022 15:56:50 +0800 Subject: [PATCH] Add notes about GCC 11 --- README.md | 18 ++++++++++++++++++ README.zh.md | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/README.md b/README.md index f289499..8dbe101 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,24 @@ sudo apt upgrade sudo apt install build-essential uuid-dev iasl git nasm gcc-aarch64-linux-gnu abootimg python3-distutils python3-pil python3-git gettext ``` +If you are using GCC 11+, modify `edk2/BaseTools/Source/C/Makefiles/header.makefile` + +```diff +diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile +index 0df728f..247c917 100644 +--- a/BaseTools/Source/C/Makefiles/header.makefile ++++ b/BaseTools/Source/C/Makefiles/header.makefile +@@ -92,7 +92,7 @@ BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ + -Wno-unused-result -nostdlib -g + else + BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ +--fno-delete-null-pointer-checks -Wall -Werror \ ++-fno-delete-null-pointer-checks -Wall \^M + -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \ + -Wno-unused-result -nostdlib -g + endif +``` + ## Building 1.Clone this project diff --git a/README.zh.md b/README.zh.md index 7b0b78a..a0fffca 100644 --- a/README.zh.md +++ b/README.zh.md @@ -55,6 +55,24 @@ sudo apt upgrade sudo apt install build-essential uuid-dev iasl git nasm gcc-aarch64-linux-gnu abootimg python3-distutils python3-pil python3-git gettext ``` +如果你的编译器为 GCC 11+, 请手动修改 `edk2/BaseTools/Source/C/Makefiles/header.makefile` + +```diff +diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile +index 0df728f..247c917 100644 +--- a/BaseTools/Source/C/Makefiles/header.makefile ++++ b/BaseTools/Source/C/Makefiles/header.makefile +@@ -92,7 +92,7 @@ BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ + -Wno-unused-result -nostdlib -g + else + BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ +--fno-delete-null-pointer-checks -Wall -Werror \ ++-fno-delete-null-pointer-checks -Wall \^M + -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \ + -Wno-unused-result -nostdlib -g + endif +``` + ## 构建 **不建议使用Ubuntu 18.04版本,请使用Ubuntu 20.04** -- 2.45.2