Any feedback on this change? Or is everyone happy by this CROSS_COMPILE
ELFGCC support?
Again, this change should avoid duplication and bring flexibility for the
GCC toolchain in tools_def file.
From: Olivier Martin [mailto:[email protected]]
Sent: 10 May 2013 19:01
To: [email protected]
Cc: '[email protected]'
Subject: [PATCH] BaseTools: Add support for a CROSS_COMPILE ELFGCC
Dear BaseTools Maintainers,
Please find the attached path that converts the current ELFGCC toolchain
into a toolchain that support cross toolchain (using the environment
variable CROSS_COMPILE).
The way to call the toolchain for IA32 and X64 has not changed.
For ARM, you would do something similar to (similar to build a Linux
kernel):
CROSS_COMPILE=arm-linux-gnueabi- build -a ARM -p
MdeModulePkg/MdeModulePkg.dsc -t ELFGCC
My plan after this patch is approved is to remove ARMGCC and ARMLINUXGCC
support from tools_def to only keep ELFGCC.
Another benefit of this patch is that it cleans the IA32 and X64 and IPF
support in ELFGCC to share common flags.
I also built MdeModulePkg/MdeModulePkg.dsc for IA32, X64 and ARM to confirm
these changes did not break the builds. MdeModulePkg.dsc build was broken
for X64 and this change does not fix it neither:
----
"/usr/bin/ld" -o
/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_ELFGCC/X64/MdeModulePkg/Applicat
ion/HelloWorld/HelloWorld/DEBUG/HelloWorld.dll -nostdlib --shared --entry
_ModuleEntryPoint -u _ModuleEntryPoint -Map
/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_ELFGCC/X64/MdeModulePkg/Applicat
ion/HelloWorld/HelloWorld/DEBUG/HelloWorld.map -\(
@/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_ELFGCC/X64/MdeModulePkg/Applica
tion/HelloWorld/HelloWorld/OUTPUT/static_library_files.lst -\)
/usr/bin/ld:
/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_ELFGCC/X64/MdeModulePkg/Applicat
ion/HelloWorld/HelloWorld/OUTPUT/HelloWorld.lib(AutoGen.obj): relocation
R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared
object; recompile with -fPIC
/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_ELFGCC/X64/MdeModulePkg/Applicat
ion/HelloWorld/HelloWorld/OUTPUT/HelloWorld.lib: could not read symbols: Bad
value
----
I also made an analysis of the compilation flags before and after applying
the patch. Additional cleaning can be made.
# C Compiler
Common arguments:
-o
/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_$(TOOLCHAIN)/$(ARHC)/MdePkg/Libr
ary/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib/OUTPUT/./BaseDeb
ugPrintErrorLevelLib.obj
-I/tmp/tianocore-elfgcc/MdePkg/Library/BaseDebugPrintErrorLevelLib
-I/tmp/tianocore-elfgcc/MdePkg/Include/$(ARCH)
-I/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_ELFGCC/$(ARCH)/MdePkg/Library/
BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib/DEBUG
-I/tmp/tianocore-elfgcc/MdePkg/Include -I/tmp/tianocore-elfgcc/MdePkg
/tmp/tianocore-elfgcc/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPr
intErrorLevelLib.c
-c -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces
-Wno-array-bounds
IA32:
before: '-Werror -Wno-missing-braces -Wno-array-bounds' were not present
before/after common: -m32 -malign-double -include
/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_ELFGCC/IA32/MdePkg/Library/BaseD
ebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib/DEBUG/AutoGen.h
-DSTRING_ARRAY_NAME=BaseDebugPrintErrorLevelLibStrings
after adds "-Os -include AutoGen.h -freorder-blocks
-freorder-blocks-and-partition -O2 -mno-stack-arg-probe -O0"
X64:
before/after common: -Os -Wno-address -include AutoGen.h -D_EFI_P64
before: '-g' was not present
after adds: -mno-red-zone -mno-stack-arg-probe -O0
ARM
before/after common: -mthumb -march=armv7-a -Wno-address -Os -include
AutoGen.h -mword-relocations -mlittle-endian -mabi=aapcs -mapcs
-fno-short-enums -save-temps -fsigned-char -ffunction-sections
-fdata-sections -fomit-frame-pointer -O0
after adds '-fno-stack-protector'
# ASM Compiler
Common arguments:
-c -x assembler -imacros
/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_ELFGCC/IA32/MdePkg/Library/BaseL
ib/BaseLib/DEBUG/AutoGen.h
-I/tmp/tianocore-elfgcc/MdePkg/Library/BaseLib/$(ARCH)
-I/tmp/tianocore-elfgcc/MdePkg/Library/BaseLib
-I/tmp/tianocore-elfgcc/Build/MdeModule/DEBUG_$(TOOLCHAIN)/$(ARCH)/MdePkg/Li
brary/BaseLib/BaseLib/DEBUG -I/tmp/tianocore-elfgcc/MdePkg/Include/$(ARCH)
after: add '-g' (Generate debugging information for each assembler source
line using whichever debug format is preferred by the target)
IA32: before/after: Same command line
X64: before/after: Same command line
ARM
- before: '-I/tmp/tianocore-elfgcc/MdePkg/Include
-I/tmp/tianocore-elfgcc/MdePkg ' was not present
- before/after: Similar command line expect 'before' was using
"arm-linux-gnueabi-as" while 'after' uses "arm-linux-gnueabi-gcc -c -x
assembler"
# SLINK
IA32: before/after: Same command line
X64: before/after: Same command line
ARM: before/after: Same command line
# DLINK:
IA32: before/after: Same command line
X64: before/after: Same command line
ARM: before/after: Same command line
Thanks,
Olivier
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
edk2-buildtools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-buildtools-devel