Hello, I'm working on enabling the standard clang3.7 build for MinnowMax open source firmware. I meet an warning when use GNU ld linker to generate X64 image: "ld: warning: section `.data' type changed to PROGBITS" as below. This warning only appears on X64 binaries linking, and not on the i32 binaries linking.
"ld" -o /mnt/disk3/mnw2opensrc/Build/Vlv2TbltDevicePkg/DEBUG_CLANG37/X64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll -nostdlib -n -q --gc-sections --script=/mnt/disk3/mnw2opensrc/BaseTools/Scripts/gcc4.4-ld-script --entry _ModuleEntryPoint -u _ModuleEntryPoint -Map /mnt/disk3/mnw2opensrc/Build/Vlv2TbltDevicePkg/DEBUG_CLANG37/X64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.map -melf_x86_64 --oformat=elf64-x86-64 -pie --start-group @/mnt/disk3/mnw2opensrc/Build/Vlv2TbltDevicePkg/DEBUG_CLANG37/X64/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/static_library_files.lst --end-group ld: warning: section `.data' type changed to PROGBITS Then, I find all the static global variables (e.g. Protocol Guids) in the .data section of X64 binary become zero or random values during runtime, and the firmware fail to boot in DXE, but the ia32 PEI works well. How could I let ld don't change the .data section of X64 binary? Has anyone tried the EDK2 build with standard clang compiler? I appreciate if someone could let me know the workable clang build options. Thanks in advance. Below is my current build tools version and related build options: clang version 3.7.0 (tags/RELEASE_370/final) GNU ld (GNU Binutils for Ubuntu) 2.25.1 GNU ar (GNU Binutils for Ubuntu) 2.25.1 gcc-4.8 (Ubuntu 4.8.5-1ubuntu1) 4.8.5 *_CLANG37_X64_OBJCOPY_PATH = DEF(GCC48_X64_PREFIX)objcopy *_CLANG37_X64_CC_PATH = DEF(CLANG37_X64_PREFIX)clang-3.7 *_CLANG37_X64_SLINK_PATH = DEF(GCC48_X64_PREFIX)ar *_CLANG37_X64_DLINK_PATH = DEF(GCC48_X64_PREFIX)ld *_CLANG37_X64_ASLDLINK_PATH = DEF(GCC48_X64_PREFIX)ld *_CLANG37_X64_ASM_PATH = DEF(GCC48_X64_PREFIX)gcc-4.8 *_CLANG37_X64_PP_PATH = DEF(CLANG37_X64_PREFIX)clang-3.7 *_CLANG37_X64_VFRPP_PATH = DEF(CLANG37_X64_PREFIX)clang-3.7 *_CLANG37_X64_ASLCC_PATH = DEF(CLANG37_X64_PREFIX)clang-3.7 *_CLANG37_X64_ASLPP_PATH = DEF(CLANG37_X64_PREFIX)clang-3.7 *_CLANG37_X64_RC_PATH = DEF(GCC48_X64_PREFIX)objcopy DEFINE CLANG37_ALL_CC_FLAGS = -c -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -Wno-address -Wno-shift-negative-value -Wno-empty-body -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-enum-conversion -nostdlib -fno-builtin -ffreestanding -nostdinc -Wno-tautological-constant-out-of-range-compare -ffunction-sections -fdata-sections -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -fno-stack-protector DEFINE CLANG37_X64_CC_FLAGS = DEF(CLANG37_ALL_CC_FLAGS) -m64 -O0 -v --target=x86_64 "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS -mno-red-zone -Wno-address -mcmodel=large -fno-asynchronous-unwind-tables -D EFI32 -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -fasm-blocks -mms-bitfields -msoft-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang *_CLANG37_X64_CC_FLAGS = DEF(CLANG37_X64_CC_FLAGS) *_CLANG37_X64_DLINK_FLAGS = DEF(GCC48_X64_DLINK_FLAGS) -pie Steven Shi SSG\STO\UEFI Firmware Tel: +86 021-61166522 iNet: 821-6522 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

