EmulatorPkg Linux: Improve detection of libraries for host executable

build.sh will detect the locations of the libraries required by
the host executable, and sets the HOST_DLINK_PATHS environment
variable.

In EmulatorPkg/Unix/Host/Host.inf, this environment variable is
used in the linking build step.

Signed-off-by: jljusten
Reviewed-by: andrewfish

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12612 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jljusten 2011-10-31 15:56:28 +00:00
parent ca3ba72cba
commit d142bb6337
2 changed files with 19 additions and 9 deletions

View File

@ -113,19 +113,21 @@
[BuildOptions] [BuildOptions]
GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_i386 -dynamic-linker /lib$(LIB_ARCH_SFX)/ld-linux.so.2 /usr/lib$(LIB_ARCH_SFX)/crt1.o /usr/lib$(LIB_ARCH_SFX)/crti.o -L/usr/X11R6/lib -lXext -lX11 /usr/lib$(LIB_ARCH_SFX)/crtn.o GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_i386 -dynamic-linker $(HOST_DLINK_PATHS) -L/usr/X11R6/lib -lXext -lX11
GCC:*_*_*_DLINK2_FLAGS == -lpthread -lc
GCC:*_*_IA32_CC_FLAGS == -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings GCC:*_*_IA32_CC_FLAGS == -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_IA32_ASM_FLAGS == -m32 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h GCC:*_*_IA32_ASM_FLAGS == -m32 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_x86_64 -dynamic-linker /lib$(LIB_ARCH_SFX)/ld-linux-x86-64.so.2 /usr/lib$(LIB_ARCH_SFX)/crt1.o /usr/lib$(LIB_ARCH_SFX)/crti.o -L/usr/X11R6/lib -lXext -lX11 /usr/lib$(LIB_ARCH_SFX)/crtn.o GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_x86_64 -dynamic-linker $(HOST_DLINK_PATHS) -L/usr/X11R6/lib -lXext -lX11
GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
GCC:*_GCC44_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))" GCC:*_GCC44_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
GCC:*_GCC45_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))" GCC:*_GCC45_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
GCC:*_GCC46_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_*_DLINK2_FLAGS == -lpthread -lc
# #
# Need to do this link via gcc and not ld as the pathing to libraries changes from OS version to OS version # Need to do this link via gcc and not ld as the pathing to libraries changes from OS version to OS version
# #

View File

@ -159,19 +159,27 @@ case $PROCESSOR in
IA32) IA32)
ARCH_SIZE=32 ARCH_SIZE=32
BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator32 BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator32
if [ -d /lib32 ]; then LIB_NAMES="ld-linux.so.2 crt1.o crti.o crtn.o"
export LIB_ARCH_SFX=32 LIB_SEARCH_PATHS="/usr/lib/i386-linux-gnu /usr/lib32 /lib32 /usr/lib /lib"
fi
;; ;;
X64) X64)
ARCH_SIZE=64 ARCH_SIZE=64
BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator BUILD_OUTPUT_DIR=$WORKSPACE/Build/Emulator
if [ -d /lib64 ]; then LIB_NAMES="ld-linux-x86-64.so.2 crt1.o crti.o crtn.o"
export LIB_ARCH_SFX=64 LIB_SEARCH_PATHS="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64 /usr/lib /lib"
fi
;; ;;
esac esac
for libname in $LIB_NAMES
do
for dirname in $LIB_SEARCH_PATHS
do
if [ -e $dirname/$libname ]; then
export HOST_DLINK_PATHS="$HOST_DLINK_PATHS $dirname/$libname"
break
fi
done
done
PLATFORMFILE=$WORKSPACE/EmulatorPkg/EmulatorPkg.dsc PLATFORMFILE=$WORKSPACE/EmulatorPkg/EmulatorPkg.dsc
BUILD_ROOT_ARCH=$BUILD_OUTPUT_DIR/DEBUG_"$TARGET_TOOLS"/$PROCESSOR BUILD_ROOT_ARCH=$BUILD_OUTPUT_DIR/DEBUG_"$TARGET_TOOLS"/$PROCESSOR