From: Yonghong Zhu Date: Thu, 9 Aug 2018 01:25:09 +0000 (+0800) Subject: BaseTools: Update the rule to remove .lib before link it for GCC X-Git-Tag: edk2-stable201903~1215 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=9ddd4f7f9455d9d07e749a2df65a294a1946cd2c;p=mirror_edk2.git BaseTools: Update the rule to remove .lib before link it for GCC We met a case on GCC toolchain for increment build. the case is user build Helloworld first, then rename the source file Helloworld.c to Helloworld_new.c and also update the file name to Helloworld_new.c in .inf file's [sources] section. finally, he rebuild it again. It cause build failure due to multiple definition of `UefiMain' because in the .lib file it both have Helloworld.obj and Helloworld_new.obj. current we use the option 'cr' to create the .lib file while the 'r' cmd means replace existing or insert new files into the archive. so in this patch before we create the .lib file, we delete it first. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index b2667c2bb7..ed54a55842 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -1,5 +1,5 @@ # -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -269,6 +269,7 @@ "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST) + $(RM) ${dst} "$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)