From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) by mx.groups.io with SMTP id smtpd.web11.3111.1660962881737556489 for ; Fri, 19 Aug 2022 19:34:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=X8oxFpdU; spf=pass (domain: gmail.com, ip: 209.85.217.45, mailfrom: pedro.falcato@gmail.com) Received: by mail-vs1-f45.google.com with SMTP id d126so6126625vsd.13 for ; Fri, 19 Aug 2022 19:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=EPZ13yLSD0mN4QKx83KZ19pPzZS5hH/PwvlE+gtnlDo=; b=X8oxFpdUXP8qraeQemCtVJbb7+r6pJzYDeGaEl+NeaTJouG1BXycp5551BSXY3cnxc EeXRgz/Nar/n04apzVA4mS3DLvs1SVwVaz3bNwHb7V90Ghnu/1mnxaFOaE5pwT5EvMcH NcfqJtlklrInFpTQKROcvAiJrEcDAireU48tN0reo2XqsowINZWyyWl4jyK4lgwxbeoM 8EMkxsFQzXxpiPSZlnvxogMQXE8+UAQRWvnNr/2Ixu3nIIYsCxUuDQ9IWELzSMM6JMCT WiJQ5LV2pks9xTf7tM6++QujAsBjmZstB+Cu6GiKAgaBOZFoGb9UsK7MULyvUgBETyKS ZvUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=EPZ13yLSD0mN4QKx83KZ19pPzZS5hH/PwvlE+gtnlDo=; b=SGQIU1kP+6Rt7slCB6m0Q+aGDS3ydj6ksOb839Sb96FWFeUdFMI/TPKPpovqmrm/0f nRQOlb9wWe4p7jwkARr71bsLtiMoVG4cAXWtTurXD0Hy4832Apb3nF4m7f5z/KdYXWGY 0c4RwPuzM5H3osZpgH6OfO/30NKcjsoq4bdreYZkk5/phUNli8EMTk9JRjLc2IF3BLVD CFTNsdE/wmojAL3CBH/udrvpomT/FEEWWGmbqxTngzudF7tFNHUfJAWfD4DINVBxprWC YnJX5IOAHo8FwQBJsD0CSbWXfF/So++8g29smWw+153NKUMCK9eJJC74uRfjhj9SNhLy v8vw== X-Gm-Message-State: ACgBeo0ZYmdHuSMISXkVisRIxugONTd9DUn7d67TPEPAe9YKpUgKoW4A QILm62doPQFItMp8FrzJSLkR0byCGZn08/H6DHE= X-Google-Smtp-Source: AA6agR5s5ilduo/vLvKv0CgEoqLaIF4uVWqB7TWMsQ04ODT8UlSVO/N4Zne1avhNA+9IDiKQ+RU56CtHcz38GZKU+cs= X-Received: by 2002:a67:d194:0:b0:388:94b1:7178 with SMTP id w20-20020a67d194000000b0038894b17178mr4272887vsi.75.1660962880687; Fri, 19 Aug 2022 19:34:40 -0700 (PDT) MIME-Version: 1.0 References: <170CE325F85990DA.4359@groups.io> <5cd26f56-65c2-7994-04fa-1721fe9b1514@bsdio.com> <7c9dad7d-a229-cfb2-6a19-e63178713f72@bsdio.com> In-Reply-To: <7c9dad7d-a229-cfb2-6a19-e63178713f72@bsdio.com> From: "Pedro Falcato" Date: Sat, 20 Aug 2022 03:34:29 +0100 Message-ID: Subject: Re: [edk2-devel] Problems building some Arm platforms (__stack_chk_guard/__stack_chk_fail, _GLOBAL_OFFSET_TABLE_) To: Rebecca Cran Cc: edk2-devel-groups-io , "Kinney, Michael D" , Leif Lindholm , Ard Biesheuvel , =?UTF-8?Q?Marvin_H=C3=A4user?= Content-Type: multipart/alternative; boundary="0000000000007d143a05e6a30e56" --0000000000007d143a05e6a30e56 Content-Type: text/plain; charset="UTF-8" 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=$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-osi > export WORKSPACE=$PWD > export GCC5_AARCH64_PREFIX=aarch64-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/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe/DEBUG/Ext4Dxe.dll > -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u _ModuleEntryPoint > -Wl,-e,_ModuleEntryPoint,-Map,/home/bcran/src/beaglebone/Build/Ext4Pkg/RELEASE_GCC5/AARCH64/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe/DEBUG/Ext4Dxe.map > -z common-page-size=0x20 -z common-page-size=0x1000 -flto -Os > -L/home/bcran/src/beaglebone/edk2/ArmPkg/Library/GccLto -llto-aarch64 > -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch > -Wl,--start-group,@/home/bcran/src/beaglebone/Build/Ext4Pkg/RELEASE_GCC5/AARCH64/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe/OUTPUT/static_library_files.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=Ext4DxeStrings -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=small -flto -Wno-unused-but-set-variable > -Wno-unused-const-variable -D DISABLE_NEW_DEPRECATED_INTERFACES > -Wl,--script=/home/bcran/src/beaglebone/edk2/BaseTools/Scripts/GccBase.lds > -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 -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/UefiMemoryAllocationLib/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/UefiMemoryAllocationLib/MemoryAllocationLib.c:368:(.text.InternalAllocatePool.constprop.0+0xc): > dangerous relocation: unsupported relocation > /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: > /home/bcran/src/beaglebone/edk2/MdePkg/Library/UefiMemoryAllocationLib/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/UefiMemoryAllocationLib/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/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c:584: > undefined reference to `__stack_chk_guard' > > -- > 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." >> >> >> -- >> 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/PlatformStandaloneMmRpmb.dsc >> (fails with bad definition for symbol '_GLOBAL_OFFSET_TABLE_'@0x72d8 or >> unsupported symbol type. For example, absolute and undefined symbols are >> not supported.) >> >> >> -- >> Rebecca Cran >> >> >> -- Pedro Falcato --0000000000007d143a05e6a30e56 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I see the issue: We're not passing -fno-stack-protecto= r to AARCH64 GCC toolchains (although arguably we should just enable suppor= t for it...). Can you try hacking up your tools_def to add -fno-stack-prote= ctor to GCC_AARCH64_CC_FLAGS? It should fix your build issues.
On Sat, A= ug 20, 2022 at 2:51 AM Rebecca Cran <rebecca@bsdio.com> wrote:
=20 =20 =20

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/Features/Ext4= Pkg/Ext4Dxe/Ext4Dxe/DEBUG/Ext4Dxe.dll -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u _ModuleEntryPoint -Wl,-e,_ModuleEntryPoint,-Map,/home/bcran/src/beaglebone/Build/Ext4Pkg/RELE= ASE_GCC5/AARCH64/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe/DEBUG/Ext4Dxe.map -z common-page-size=3D0x20 -z common-page-size=3D0x1000 -flto -Os -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/RELEASE_GCC5/AA= RCH64/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe/OUTPUT/static_library_files.lst,--en= d-group=C2=A0=C2=A0 -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.ld= s -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/UefiMemoryAllocationLib/Memo= ryAllocationLib.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/UefiMemoryAllocationLib/Memo= ryAllocationLib.c:368:(.text.InternalAllocatePool.constprop.0+0xc): dangerous relocation: unsupported relocation
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld= : /home/bcran/src/beaglebone/edk2/MdePkg/Library/UefiMemoryAllocationLib/Memo= ryAllocationLib.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/UefiMemoryAllocationLib/Memo= ryAllocationLib.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/BaseOrderedCollectionRedBlac= kTreeLib/BaseOrderedCollectionRedBlackTreeLib.c:584: undefined reference to `__stack_chk_guard'

--
Rebecca Cran


On 8/19/22 18:46, Pedro Falcato wrote:
=20
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:4= 0 Rebecca Cran, <rebecca@bsdio.com> 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."


--
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 46686eeb7e78efe603badd86f13777d= 9fb070fb8 and edk2 e2ac68a23b4954d5c0399913a1df3dd9fd90315d.


Drivers/ASIX/Asix.dsc (fails with undefined references to <= span style=3D"font-family:monospace">__stack_chk_guard and __stack_chk_fail)

Drivers/DisplayLink/Disp= layLinkPkg/DisplayLinkPkg.dsc <= span style=3D"color:rgb(0,0,0);background-color:rgb(255,255,255)">(fails with undefined references to __stack_chk_guard and __stack_chk_fail)
Platform/Socionext/Develo= perBox/DeveloperBoxMm.dsc (fails with bad definition for symbol '_GLOBAL_OFFSET_TABLE_'@0x72d8 or unsupported symbol type.=C2=A0 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/PlatformSt= andaloneMmPkg/PlatformStandaloneMmRpmb.dsc (fails with bad definition for symbol '_GLOBAL_OFFSET_TABLE_'@0x72d= 8 or unsupported symbol type.=C2=A0 For example, absolute and undefined symbols are not supported.)


--
Rebecca Cran

=20


--
Pedro Falcato
--0000000000007d143a05e6a30e56--