【发布时间】:2020-07-05 09:54:36
【问题描述】:
大家好。
我有一个 STM32H747XI 的大型项目,并且有许多代码文件无法放入主 FLASH 存储器区域,因此我试图将其放置在外部 QSPI 闪存上。所以我为这些文件创建了额外的 .qtext 会话并将其放在主要的 .text 部分之上。
.qtext :
{
. = ALIGN(4);
ioquake3/* (.text) /* .text sections (code) */
ioquake3/* (.text*) /* .text* sections (code) */
_eqtext = .; /* define a global symbols at end of code */
. = ALIGN(4);
} >QSPI
原来的 .text 部分也放在那里。
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
但是当我试图编译它时,Linker 会抛出一系列错误。
12:48:31 **** Incremental Build of configuration Debug for project ioquake3test_CM7 ****
make all
arm-none-eabi-g++ -o "ioquake3test_CM7.elf" @"objects.list" -mcpu=cortex-m7 -T"E:\STM32CubeIDE\ioquake3test\CM7\STM32H747XIHX_FLASH.ld" --specs=nosys.specs -Wl,-Map="ioquake3test_CM7.map" -Wl,--gc-sections -static -u_printf_float --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
ioquake3/swGL/CommandDrawTriangle.o:(.ARM.exidx.text._ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE0EE10_M_releaseEv[_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE0EE10_M_releaseEv]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE0EE10_M_releaseEv'
ioquake3/swGL/CommandDrawTriangle.o:(.ARM.exidx.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE0EED2Ev[_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE0EED5Ev]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE0EED2Ev'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSt15_Rb_tree_headerC2Ev[_ZNSt15_Rb_tree_headerC5Ev]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt15_Rb_tree_headerC2Ev'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSt15_Rb_tree_header8_M_resetEv[_ZNSt15_Rb_tree_header8_M_resetEv]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt15_Rb_tree_header8_M_resetEv'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EE13_Rb_tree_implISA_Lb1EEC2Ev[_ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EE13_Rb_tree_implISA_Lb1EEC5Ev]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EE13_Rb_tree_implISA_Lb1EEC2Ev'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EE13_Rb_tree_implISA_Lb1EED2Ev[_ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EE13_Rb_tree_implISA_Lb1EED5Ev]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EE13_Rb_tree_implISA_Lb1EED2Ev'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EEC2Ev[_ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EEC5Ev]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt8_Rb_treeIiSt4pairIKiSt10shared_ptrIN4SWGL7ContextEEESt10_Select1stIS6_ESt4lessIiESaIS6_EEC2Ev'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSt3mapIiSt10shared_ptrIN4SWGL7ContextEESt4lessIiESaISt4pairIKiS3_EEEC2Ev[_ZNSt3mapIiSt10shared_ptrIN4SWGL7ContextEESt4lessIiESaISt4pairIKiS3_EEEC5Ev]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt3mapIiSt10shared_ptrIN4SWGL7ContextEESt4lessIiESaISt4pairIKiS3_EEEC2Ev'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSt12__shared_ptrIN4SWGL7ContextELN9__gnu_cxx12_Lock_policyE0EED2Ev[_ZNSt12__shared_ptrIN4SWGL7ContextELN9__gnu_cxx12_Lock_policyE0EED5Ev]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt12__shared_ptrIN4SWGL7ContextELN9__gnu_cxx12_Lock_policyE0EED2Ev'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSt10shared_ptrIN4SWGL7ContextEED2Ev[_ZNSt10shared_ptrIN4SWGL7ContextEED5Ev]+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text._ZNSt10shared_ptrIN4SWGL7ContextEED2Ev'
ioquake3/swGL/Context.o:(.ARM.exidx.text._ZNSaISt13_Rb_tree_nodeISt4pairIKiSt10shared_ptrIN4SWGL7ContextEEEEEC2Ev[_ZNSaISt13_Rb_tree_nodeISt4pairIKiSt10shared_ptrIN4SWGL7ContextEEEEEC5Ev]+0x0): additional relocation overflows omitted from the output
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:122: ioquake3test_CM7.elf] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
12:48:40 Build Failed. 1 errors, 0 warnings. (took 9s.177ms)
出于相同目的,我还有更多用于 .qrodata、.qdata 和 .qbss 的部分,但只有在我尝试创建单独的 .qtext 部分时才会引发错误。
我做错了什么?
【问题讨论】:
标签: gcc linker arm ld cortex-m