Good to know. Thanks for testing.

Alexei


From: raghu.ncstate@icloud.com <raghu.ncstate@icloud.com>
Sent: 31 July 2020 16:40
To: Alexei Fedorov <Alexei.Fedorov@arm.com>; Olivier Deprez <Olivier.Deprez@arm.com>; Lauren Wehrmeister <Lauren.Wehrmeister@arm.com>
Cc: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: RE: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE
 

.quad works for me(even with SPD=tspd). Thanks for the fix.

 

From: Alexei Fedorov <Alexei.Fedorov@arm.com>
Sent: Friday, July 31, 2020 7:38 AM
To: raghu.ncstate@icloud.com; Olivier Deprez <Olivier.Deprez@arm.com>; Lauren Wehrmeister <Lauren.Wehrmeister@arm.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: tf-a@lists.trustedfirmware.org
Subject: Re: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

I've created

https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/5153

which should fix the issue. Please review and test.

 

Regards.

Alexei


From: TF-A <tf-a-bounces@lists.trustedfirmware.org> on behalf of Alexei Fedorov via TF-A <tf-a@lists.trustedfirmware.org>
Sent: 31 July 2020 10:22
To: raghu.ncstate@icloud.com <raghu.ncstate@icloud.com>; Olivier Deprez <Olivier.Deprez@arm.com>; Lauren Wehrmeister <Lauren.Wehrmeister@arm.com>
Cc: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: Re: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Hi,

 

Could you replace

 

.word platform_normal_stacks
with

.quad platform_normal_stacks

 

in plat\common\aarch64\platform_mp_stack.S

 

and check if it fixes the issue?

 

Regards.

Alexei


From: raghu.ncstate@icloud.com <raghu.ncstate@icloud.com>
Sent: 30 July 2020 23:55
To: Alexei Fedorov <Alexei.Fedorov@arm.com>; Olivier Deprez <Olivier.Deprez@arm.com>
Cc: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: RE: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

+tf-a mailing list. Merging Lauren’s email.

 

Hi Lauren,

 

What command did you use to build TSP? I used the same command line from my original email and added SPD=tspd and I was able to get it to compile with Alexei’s fix.

 

Thanks
Raghu

 


Hi,

 

I also came across this issue as I'm trying to create test configurations for compiling BL31/TSP/BL2_AT_EL3 as PIEs, the fix suggested by Alexei worked for BL2_AT_EL3, but it did not work for TSP.  I am getting the same error message as Raghu: "./build/fvp/debug/bl31/platform_mp_stack.o: relocation R_AARCH64_ABS32 against `a local symbol' can not be used when making a shared object". Any suggestions?

 

Thanks,

Lauren

 

 

From: raghu.ncstate@icloud.com <raghu.ncstate@icloud.com>
Sent: Thursday, July 30, 2020 9:15 AM
To: 'Alexei Fedorov' <Alexei.Fedorov@arm.com>; 'Olivier Deprez' <Olivier.Deprez@arm.com>
Subject: RE: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Thanks I’ll try with GCC 11.0. What happens when you run a build without platform_normal_stacks? Does it even boot for you or does it crash in linux?? Trying to understand how you figured this was an issue and what prompted you to fix this by adding the adrp/.word.

 

-Raghu

 

From: Alexei Fedorov <Alexei.Fedorov@arm.com>
Sent: Thursday, July 30, 2020 9:02 AM
To: raghu.ncstate@icloud.com; Olivier Deprez <Olivier.Deprez@arm.com>
Subject: Re: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Yes. I'm using ENABLE_PIE=1, but the same behaviour will be observed with ENABLE_PIE=0 (except that the linker error won't be reported).

I'm isning GCC 11.0.0.

 

Regards.

Alexei


From: raghu.ncstate@icloud.com <raghu.ncstate@icloud.com>
Sent: 30 July 2020 16:50
To: Alexei Fedorov <
Alexei.Fedorov@arm.com>; Olivier Deprez <Olivier.Deprez@arm.com>
Subject: RE: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Thanks. Are you using ENABLE_PIE=1? I’m using ENABLE_PIE=1 and I don’t see it in bl31.dump file with or without the “.word platform_normal_stacks” statement. However, when I do run FVP to linux without the statement, I see secondary a crash in EL3 with unhandled exception. So it is definitely required. Just trying to pin point what exactly is causing the crash.

 

Thanks

Raghu

 

From: Alexei Fedorov <Alexei.Fedorov@arm.com>
Sent: Thursday, July 30, 2020 8:43 AM
To: raghu.ncstate@icloud.com; Olivier Deprez <Olivier.Deprez@arm.com>
Subject: Re: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

With "platform_normal_stacks":

 

bl31.dump

0000000004015280 l       stacks 0000000000000000 platform_normal_stacks

 

bl31.map:

stacks          0x0000000004015280     0x4000

*(tzfw_normal_stacks)

 tzfw_normal_stacks

                0x0000000004015280     0x4000 ./build/fvp/debug/bl31/platform_mp_stack.o

                0x0000000004019280                __STACKS_END__ = .

Without:

platform_normal_stacks is missing from bl31.dump,

 

bl31.map:

stacks          0x0000000004015270     0x2d90

                0x0000000004015270                __STACKS_START__ = .

 *(tzfw_normal_stacks)

                0x0000000004018000                __STACKS_END__ = .

Alexei


From: raghu.ncstate@icloud.com <raghu.ncstate@icloud.com>
Sent: 30 July 2020 15:58
To: Alexei Fedorov <
Alexei.Fedorov@arm.com>; Olivier Deprez <Olivier.Deprez@arm.com>
Subject: RE: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Makes sense. Thanks. I just tried both debug and release builds, but I don’t see it being _removed_ by the linker. In either case I don’t see symbol information for platform_normal_stacks and only see symbol information for __STACK_START__.

So what exactly are you referring to when the linker removes “declare_stack …” ? Also what build configuration?

 

-Raghu

 

From: Alexei Fedorov <Alexei.Fedorov@arm.com>
Sent: Thursday, July 30, 2020 7:43 AM
To: raghu.ncstate@icloud.com; Olivier Deprez <Olivier.Deprez@arm.com>
Subject: Re: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Having

platform_normal_stacks

referenced prevents linker from removal of

 

declare_stack platform_normal_stacks, tzfw_normal_stacks, \

PLATFORM_STACK_SIZE, PLATFORM_CORE_COUNT, \

CACHE_WRITEBACK_GRANULE

 

Regards.

Alexei


From: raghu.ncstate@icloud.com <raghu.ncstate@icloud.com>
Sent: 30 July 2020 15:31
To: Alexei Fedorov <
Alexei.Fedorov@arm.com>; Olivier Deprez <Olivier.Deprez@arm.com>
Subject: RE: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Thanks Olivier, Alexei.

 

>> Is it a copy/paste typo?

[RK]Yes.

 

>> Replace .word platform_normal_stacks with adrp x0, platform_normal_stacks

[RK]Sure. I can do that. But why does “.word platform_normal_stacks” exist there in the first place? Not sure I understand that line’s purpose. What does replacing it with adrp x0, platform_normal_stacks do? The instruction is after a ret and looks like it will not be executed.

 

I am using aarch64-non-elf- as the toolchain.

 

Thanks

Raghu

 

From: TF-A <tf-a-bounces@lists.trustedfirmware.org> On Behalf Of Alexei Fedorov via TF-A
Sent: Thursday, July 30, 2020 6:58 AM
To: Olivier Deprez <Olivier.Deprez@arm.com>; tf-a@lists.trustedfirmware.org
Subject: Re: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Replace

.word platform_normal_stacks

with

adrp x0, platform_normal_stacks

 

Regards.

Alexei.

 


From: Olivier Deprez <Olivier.Deprez@arm.com>
Sent: 30 July 2020 14:17
To:
tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>; Alexei Fedorov <Alexei.Fedorov@arm.com>
Subject: Re: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

 

Hi Raghu,

On the toolchain question you would normally use CROSS_COMPILE=aarch64-none-elf- as recommended here:
https://trustedfirmware-a.readthedocs.io/en/latest/getting_started/initial-build.html#performing-an-initial-build
However this does not seem to be the root cause of the problem you report.

I reproduce the build issue, however it's not yet clear to me if this platform_normal_stacks variable should be rather placed in a specific section (.data?), rather than embedded in the code. Tbc.

Regards,
Olivier.


________________________________________
From: TF-A <
tf-a-bounces@lists.trustedfirmware.org> on behalf of Alexei Fedorov via TF-A <tf-a@lists.trustedfirmware.org>
Sent: 30 July 2020 14:53
To:
tf-a@lists.trustedfirmware.org
Subject: Re: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE

Is it a copy/paste typo?
CTX_INCLUDE_EL2)REGS

Regards.
Alexei
________________________________
From: TF-A <
tf-a-bounces@lists.trustedfirmware.org> on behalf of Raghu Krishnamurthy via TF-A <tf-a@lists.trustedfirmware.org>
Sent: 30 July 2020 02:44
To:
tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: [TF-A] Linker error on integration branch for FVP with ENABLE_PIE


When I compile TF-A code on the integration branch with the ENABLE_PIE=1 option for FVP, I get a linker error “./build/fvp/debug/bl31/platform_mp_stack.o: relocation R_AARCH64_ABS32 against `a local symbol' can not be used when making a shared object". It appears to be related to line 62(.word platform_normal_stack) of plat/common/aarch64/platform_mp_stack.S that was introduced by
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/4301 . It looks like the linker is having trouble resolving this symbol for which I cant find a use for.

If I remove line 62 or set ENABLE_PIE=0, the below command line to compile succeeds. What is the use of line 62 in the file? Seems like it may have some use in other configurations that are not obvious. Or is the issue due to the toolchain I’m using? See gcc version below.



Command line I’m using:

make CROSS_COMPILE=aarch64-none-linux-gnu- TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 DEBUG=1 LOG_LEVEL=40 MBEDTLS_DIR=../mbed-tls PLAT=fvp ARM_ROTPK_LOCATION=regs CTX_INCLUDE_PAUTH_REGS=1 CTX_INCLUDE_EL2)REGS=1 ARM_ARCH_MINOR=5 ENABLE_PIE=1 BRANCH_PROTECTION=1 FVP_HW_CONFIG_DTS=fdts/fvp-base-gicv3-psci-1t.dts BL33=<path_to_bl33> all fip



Compiler version: aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025



Thanks

Raghu

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.