Reviewed-by: Liming Gao <[email protected]>

> -----Original Message-----
> From: edk2-devel [mailto:[email protected]] On Behalf Of Zhu, 
> Yonghong
> Sent: Wednesday, August 8, 2018 6:26 PM
> To: [email protected]
> Cc: Gao, Liming <[email protected]>
> Subject: [edk2] [Patch] 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 <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu <[email protected]>
> ---
>  BaseTools/Conf/build_rule.template | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index b2667c2..ed54a55 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -1,7 +1,7 @@
>  #
> -#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
>  #  Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions of the BSD 
> License
>  #  which accompanies this distribution.  The full text of the license may be 
> found at
>  #  http://opensource.org/licenses/bsd-license.php
> @@ -267,10 +267,11 @@
> 
>      <Command.MSFT, Command.INTEL>
>          "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)
> 
>      <Command.GCC, Command.GCCLD>
> +        $(RM) ${dst}
>          "$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
> 
>      <Command.RVCT>
>          "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
> 
> --
> 2.6.1.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to