From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.web09.11231.1661349815277089488 for ; Wed, 24 Aug 2022 07:03:35 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@quicinc.com header.s=qcppdkim1 header.b=I2vfM/sX; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: quicinc.com, ip: 205.220.180.131, mailfrom: quic_rcran@quicinc.com) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27ODeLhu016210; Wed, 24 Aug 2022 14:03:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=/IOHf919sK5FpU7te340DeiACNbV8s5uN0UBQzAHVwM=; b=I2vfM/sXeHlPG0J2j2pGyIgh44329mF9ZLTztPacx1o077Be5lslmLynEJGHzjHgpccC 6Os7wZrphasitRrlkWR/IATzhWpbxQ0MhGA4MU2/R/7UWQKklJSHBLQL6BgJSwzjJWv/ LPnB+N2P5U9oK+JV8J1AEl4rTIxmn7MlaDF1kI/X3ThqrqV9BHRjySf0hqxilvtEZGCf 6QspbOjv2HoxdD9njR4jLAwmv4RN/92d9o8YaHCFOLZeFChorwc6nwFG6b/vaXnSn6ZB z3hLMPKriz7ydASmNl2w3wTQq5EpY45AuVGVct5XdtvjpC7aoV9DUmsXg04LbW2Q52BW zg== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3j52pnbgy5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Aug 2022 14:03:31 +0000 Received: from nasanex01b.na.qualcomm.com (corens_vlan604_snip.qualcomm.com [10.53.140.1]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 27OE3UuI003710 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Aug 2022 14:03:30 GMT Received: from [10.110.70.39] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 24 Aug 2022 07:03:29 -0700 Message-ID: <7146c032-9943-07f8-7246-b11517c26c14@quicinc.com> Date: Wed, 24 Aug 2022 08:03:28 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [edk2-devel] Problems building some Arm platforms (__stack_chk_guard/__stack_chk_fail, _GLOBAL_OFFSET_TABLE_) To: , , Rebecca Cran CC: "Kinney, Michael D" , Leif Lindholm , Ard Biesheuvel , =?UTF-8?Q?Marvin_H=c3=a4user?= References: <170CE325F85990DA.4359@groups.io> <5cd26f56-65c2-7994-04fa-1721fe9b1514@bsdio.com> <7c9dad7d-a229-cfb2-6a19-e63178713f72@bsdio.com> <16f27ae8-5553-1cf3-e6c9-79c0d03a868f@bsdio.com> From: "Rebecca Cran" In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: njgfIOGxi2UO0yRDzibqty3NMb3DTPdm X-Proofpoint-ORIG-GUID: njgfIOGxi2UO0yRDzibqty3NMb3DTPdm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-24_07,2022-08-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 clxscore=1011 malwarescore=0 phishscore=0 impostorscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208240053 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0031df01.pphosted.com id 27ODeLhu016210 Content-Language: en-US Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable I really don't have much knowledge about the EDK2 build system, and was=20 hoping that Ard would reply - which he has! --=20 Rebecca Cran On 8/24/22 05:05, Pedro Falcato wrote: > Hi, > > So, what's your suggestion? Do you want me to add that to my package=20 > as well? > > There is obviously a huge problem with EDK2 build tools not knowing=20 > what a damn runtime library is. I personally don't think it's=20 > appropriate for me to say "I want my package built with the stack=20 > protector", particularly because my package shouldn't know what a damn=20 > stack protector is, and whoever is building it knows best, and because=20 > of that this should be dealt with by the build system itself (and no,=20 > setting it up in a platform dsc isn't a correct approach, since my=20 > package should be buildable standalone). And what if someone doesn't=20 > want the stack protector? Do they just create a new AARCH64_GCC5_NOSSP=20 > toolchain and build it with that? Do they just sed AARCH64_GCC5 to use=20 > -fno-stack-protector? Do they just limit themselves to toolchains=20 > without default SSP? IMO the correct way to go about things is to have=20 > the build tools automatically insert dependencies on runtime libraries=20 > and have a way to tag a toolchain such that you can easily selectively=20 > enable instrumentation (such as the SSP, UBSAN, ASAN, etc) and build=20 > them in any combination. > > Anyway, . I'll defer to your experience with the EDK2 build=20 > system for a solution. > > All the best, > Pedro > > On Sat, Aug 20, 2022 at 4:06 AM Rebecca Cran wrote: > > Other platform such as Platform/Qemu/SbsaQemu/SbsaQemu.dsc have: > > > =C2=A0 # Add support for GCC stack protector > NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf > > > --=20 > > Rebecca Cran > > > On 8/19/22 20:34, Pedro Falcato wrote: >> I see the issue: We're not passing -fno-stack-protector to >> AARCH64 GCC toolchains (although arguably we should just enable >> support for it...). Can you try hacking up your tools_def to add >> -fno-stack-protector to GCC_AARCH64_CC_FLAGS? It should fix your >> build issues. >> >> On Sat, Aug 20, 2022 at 2:51 AM Rebecca Cran >> wrote: >> >> I'm using gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) >> on Ubuntu 20.04.4, from the Ubuntu repo. >> >> I'm building it with: >> >> >> export >> PACKAGES_PATH=3D$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-osi >> export WORKSPACE=3D$PWD >> export GCC5_AARCH64_PREFIX=3Daarch64-linux-gnu- >> >> . ./edk2/edksetup.sh >> build -p ./Features/Ext4Pkg/Ext4Pkg.dsc -a AARCH64 -b RELEASE >> -t GCC5 >> >> >> Some of the messages are: >> >> >> "aarch64-linux-gnu-gcc" -o >> /home/bcran/src/beaglebone/Build/Ext4Pkg/RELEASE_GCC5/AARCH64/Fe= atures/Ext4Pkg/Ext4Dxe/Ext4Dxe/DEBUG/Ext4Dxe.dll >> -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u >> _ModuleEntryPoint >> -Wl,-e,_ModuleEntryPoint,-Map,/home/bcran/src/beaglebone/Build/E= xt4Pkg/RELEASE_GCC5/AARCH64/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe/DEBUG/Ext4Dxe.= map >> -z common-page-size=3D0x20 -z common-page-size=3D0x1000 -flto -O= s >> -L/home/bcran/src/beaglebone/edk2/ArmPkg/Library/GccLto >> -llto-aarch64 -Wl,-plugin-opt=3D-pass-through=3D-llto-aarch64 >> -Wno-lto-type-mismatch >> -Wl,--start-group,@/home/bcran/src/beaglebone/Build/Ext4Pkg/RELE= ASE_GCC5/AARCH64/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe/OUTPUT/static_library_fil= es.lst,--end-group >> -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall >> -Werror -Wno-array-bounds -include AutoGen.h -fno-common >> -ffunction-sections -fdata-sections >> -DSTRING_ARRAY_NAME=3DExt4DxeStrings -g -Os -fshort-wchar >> -fno-builtin -fno-strict-aliasing -Wall -Werror >> -Wno-array-bounds -include AutoGen.h -fno-common >> -mlittle-endian -fno-short-enums -fverbose-asm >> -funsigned-char -ffunction-sections -fdata-sections >> -Wno-address -fno-asynchronous-unwind-tables >> -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18 >> -mcmodel=3Dsmall -flto -Wno-unused-but-set-variable >> -Wno-unused-const-variable -D >> DISABLE_NEW_DEPRECATED_INTERFACES >> -Wl,--script=3D/home/bcran/src/beaglebone/edk2/BaseTools/Scripts= /GccBase.lds >> -Wl,--defsym=3DPECOFF_HEADER_SIZE=3D0x228 -Wno-error >> /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux= -gnu/bin/ld: >> /tmp/Ext4Dxe.dll.sETaOX.ltrans0.ltrans.o: in function >> `InternalAllocatePool.constprop.0': >> /home/bcran/src/beaglebone/edk2/MdePkg/Library/UefiMemoryAllocat= ionLib/MemoryAllocationLib.c:368: >> undefined reference to `__stack_chk_guard' >> /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux= -gnu/bin/ld: >> /tmp/Ext4Dxe.dll.sETaOX.ltrans0.ltrans.o: relocation >> R_AARCH64_ADR_PREL_PG_HI21 against symbol `__stack_chk_guard' >> which may bind externally can not be used when making a >> shared object; recompile with -fPIC >> /home/bcran/src/beaglebone/edk2/MdePkg/Library/UefiMemoryAllocat= ionLib/MemoryAllocationLib.c:368:(.text.InternalAllocatePool.constprop.0+0x= c): >> dangerous relocation: unsupported relocation >> /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux= -gnu/bin/ld: >> /home/bcran/src/beaglebone/edk2/MdePkg/Library/UefiMemoryAllocat= ionLib/MemoryAllocationLib.c:368: >> undefined reference to `__stack_chk_guard' >> /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux= -gnu/bin/ld: >> /home/bcran/src/beaglebone/edk2/MdePkg/Library/UefiMemoryAllocat= ionLib/MemoryAllocationLib.c:382: >> undefined reference to `__stack_chk_fail' >> /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux= -gnu/bin/ld: >> /tmp/Ext4Dxe.dll.sETaOX.ltrans0.ltrans.o: in function >> `OrderedCollectionInsert.constprop.0': >> /home/bcran/src/beaglebone/edk2/MdePkg/Library/BaseOrderedCollec= tionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c:584: >> undefined reference to `__stack_chk_guard' >> >> --=20 >> Rebecca Cran >> >> >> On 8/19/22 18:46, Pedro Falcato wrote: >>> Hi Rebecca, >>> >>> What EDK2 toolchain are you using? And how is your toolchain >>> configured (or where did you get it from?)? It seems that >>> it's trying to use the stack protector automatically... >>> >>> Thanks, >>> Pedro >>> >>> >>> On Sat, 20 Aug 2022, 00:40 Rebecca Cran, >>> wrote: >>> >>> ./Features/Ext4Pkg/Ext4Pkg.dsc is also failing - with >>> errors about __stack_chk_guard and __stack_chk_fail. >>> >>> >>> And I get an error from Andy Hayes' email: "Your message >>> couldn't be delivered to the recipient because you don't >>> have permission to send to it." >>> >>> >>> --=20 >>> Rebecca Cran >>> >>> >>> On 8/19/22 17:35, Rebecca Cran wrote: >>>> >>>> I have an armplatbld.sh script that goes through and >>>> tries to build as many of the Arm (AARCH64 and ARM) >>>> platforms in edk2-platforms as possible. >>>> >>>> I'm think this used to work for these, but I'm getting >>>> some errors now. >>>> >>>> I'm using edk2-platforms >>>> 46686eeb7e78efe603badd86f13777d9fb070fb8 and edk2 >>>> e2ac68a23b4954d5c0399913a1df3dd9fd90315d. >>>> >>>> >>>> Drivers/ASIX/Asix.dsc (fails with undefined references >>>> to __stack_chk_guard and __stack_chk_fail) >>>> >>>> Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkPkg.dsc >>>> (fails with undefined references to __stack_chk_guard >>>> and __stack_chk_fail) >>>> Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc >>>> (fails with bad definition for symbol >>>> '_GLOBAL_OFFSET_TABLE_'@0x72d8 or unsupported symbol >>>> type. For example, absolute and undefined symbols are >>>> not supported.) >>>> >>>> Drivers/StandaloneMmCpu/StandaloneMmCpu (fails with >>>> undefined references to __stack_chk_guard and >>>> __stack_chk_fail) >>>> Platform/StandaloneMm/PlatformStandaloneMmPkg/PlatformStan= daloneMmRpmb.dsc(fails >>>> with bad definition for symbol >>>> '_GLOBAL_OFFSET_TABLE_'@0x72d8 or unsupported symbol >>>> type.=C2=A0 For example, absolute and undefined symbols ar= e >>>> not supported.) >>>> >>>> >>>> --=20 >>>> Rebecca Cran >>>> >> >> >> --=20 >> Pedro Falcato > > > > --=20 > Pedro Falcato >=20