Skip to content

soc: intel_adsp/cavs_v20: correct linker syntax for ancient binutils#40319

Merged
cfriedt merged 2 commits intozephyrproject-rtos:mainfrom
dcpleung:cavs_v20_linker_script
Nov 16, 2021
Merged

soc: intel_adsp/cavs_v20: correct linker syntax for ancient binutils#40319
cfriedt merged 2 commits intozephyrproject-rtos:mainfrom
dcpleung:cavs_v20_linker_script

Conversation

@dcpleung
Copy link
Member

@dcpleung dcpleung commented Nov 12, 2021

This reverts commit 3cc14b2.

Revert this due to the same reason as commit
a29b66b:

Unfortunately this mechanism doesn't seem to actually work on the SDK
linker.  The emitted sections, when passed a symbol name as the "start
address" just appear wherever the "." variable was pointing (in this
case, into the cached region).  That breaks the kernel coherence
layer, obviously.

and, applying similar changes to cavs_v20 as in commit
8bc4539:

Older binutils, like the (nine-year-old!) 2.23 version that powers
many Cadence XCC toolchains, happen not to support the "~" operator to
perform bitwise negation.  And they generate an absolutely hilarious
series of inscrutable error messages when they try to tell you this
fairly simple fact.

Just fold it into the constant.

This reverts commit 3cc14b2.

Revert this due to the same reason as commit
a29b66b:

  Unfortunately this mechanism doesn't seem to actually work on the SDK
  linker.  The emitted sections, when passed a symbol name as the "start
  address" just appear wherever the "." variable was pointing (in this
  case, into the cached region).  That breaks the kernel coherence
  layer, obviously.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Applying similar changes to cavs_v20 as in commit
8bc4539:

  Older binutils, like the (nine-year-old!) 2.23 version that powers
  many Cadence XCC toolchains, happen not to support the "~" operator to
  perform bitwise negation.  And they generate an absolutely hilarious
  series of inscrutable error messages when they try to tell you this
  fairly simple fact.

  Just fold it into the constant.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
@zephyrbot zephyrbot added the platform: Intel ADSP Intel Audio platforms label Nov 15, 2021
@andyross
Copy link
Contributor

FWIW: this is going to collide with #39603 , which does the same thing by making all the cAVS variants use the same linker script. Will be an easy rebase though, so no big deal to merge it first if there's need.

@cfriedt cfriedt merged commit 566c466 into zephyrproject-rtos:main Nov 16, 2021
@dcpleung dcpleung deleted the cavs_v20_linker_script branch November 16, 2021 17:27
@marc-hb
Copy link
Contributor

marc-hb commented Nov 18, 2021

This revert broke sof/scripts/xtensa-build-zephyr.sh for ICL with crosstool-ng: section overlap between .noinit and .cached

Signing with tool build-rimage/rimage
build-rimage/rimage -k modules/audio/sof/keys/otc_private_key.pem -o build-icl/zephyr/zephyr.ri -c modules/audio/sof/rimage/config/icl.toml -i 3 -e build-icl/zephyr/bootloader.elf.mod build-icl/zephyr/zephyr.elf.mod

Module Reading build-icl/zephyr/bootloader.elf.mod
info: ignore .bss section for bootloader module
  Found 21 sections, listing valid sections......
	No	LMA		VMA		End		Size	Type	Name
	0	0x00000000	0x00000000	0x00000000	0x0
	1	0xb0038000	0xb0038000	0xb00380fb	0xfb	TEXT	.boot_entry.text
	2	0xb0038220	0xb0038220	0xb0038512	0x2f2	TEXT	.text
	3	0xb0039000	0xb0039000	0xb0039008	0x8	DATA	.rodata

 module: input size 1013 (0x3f5) bytes 4 sections
 module: text 1005 (0x3ed) bytes
    data 8 (0x8) bytes
    bss  0 (0x0) bytes


Module Reading build-icl/zephyr/zephyr.elf.mod
  Found 46 sections, listing valid sections......
	No	LMA		VMA		End		Size	Type	Name
	1	0xbe010000	0xbe010000	0xbe01016a	0x16a	TEXT	.WindowVectors.text
	2	0xbe010180	0xbe010180	0xbe0101a9	0x29	TEXT	.Level2InterruptVector.text
	3	0xbe0101c0	0xbe0101c0	0xbe0101e9	0x29	TEXT	.Level3InterruptVector.text
	4	0xbe010200	0xbe010200	0xbe010229	0x29	TEXT	.Level4InterruptVector.text
	5	0xbe010240	0xbe010240	0xbe010269	0x29	TEXT	.Level5InterruptVector.text
	6	0xbe010280	0xbe010280	0xbe0102a9	0x29	TEXT	.DebugExceptionVector.text
	7	0xbe0102c0	0xbe0102c0	0xbe0102e9	0x29	TEXT	.NMIExceptionVector.text
	8	0xbe010300	0xbe010300	0xbe010303	0x3	TEXT	.KernelExceptionVector.text
	9	0xbe010340	0xbe010340	0xbe010352	0x12	TEXT	.UserExceptionVector.text
	10	0xbe0103c0	0xbe0103c0	0xbe0103c6	0x6	TEXT	.DoubleExceptionVector.text
	11	0xbe010400	0xbe010400	0xbe03a000	0x29c00	TEXT	.text
	12	0xbe03a000	0xbe03a000	0xbe04b3e0	0x113e0	DATA	.rodata
	13	0xbe04b3e0	0xbe04b3e0	0xbe04b448	0x68	DATA	initlevel
	14	0xbe04b448	0xbe04b448	0xbe04b4d8	0x90	DATA	devices
	15	0xbe04b4d8	0xbe04b4d8	0xbe04b4f0	0x18	DATA	k_p4wq_initparam_area
	16	0xbe04b4f0	0xbe04b4f0	0xbe04b528	0x38	DATA	log_const_sections
	17	0xbe04b528	0xbe04b528	0xbe04b538	0x10	DATA	log_backends_sections
	18	0xbe04b538	0xbe04b538	0xbe04b546	0xe	DATA	device_handles
	19	0xbe04b548	0xbe04b548	0xbe04b5b4	0x6c	DATA	.fw_ready
	20	0xbe04b5c0	0xbe04b5c0	0xbe04ba60	0x4a0	DATA	.noinit
	21	0xbe04ba80	0xbe04ba80	0xbe04d000	0x1580	DATA	.data
	22	0xbe04b5c0	0xbe04b5c0	0xbe055dc0	0xa800	DATA	.cached
	23	0xbe04d000	0xbe04d000	0xbe04d4a8	0x4a8	DATA	sw_isr_table
	24	0xbe04d4a8	0xbe04d4a8	0xbe04d4c0	0x18	DATA	device_states
	25	0xbe04d4c0	0xbe04d4c0	0xbe04d4d0	0x10	DATA	k_sem_area
	26	0xbe04e000	0xbe04e000	0xbe04f950	0x1950	BSS	.bss

 module: input size 293661 (0x47b1d) bytes 26 sections
 module: text 171643 (0x29e7b) bytes
    data 122018 (0x1dca2) bytes
    bss  6480 (0x1950) bytes

error: section overlap between build-icl/zephyr/zephyr.elf.mod:20 and build-icl/zephyr/zephyr.elf.mod:22
     [0xbe04b5c0 : 0xbe04ba60] overlaps with [0xbe04b5c0 :0xbe055dc0]

marc-hb added a commit to marc-hb/sof that referenced this pull request Nov 18, 2021
Because ICL fails to build, .noinit/.cached section overlap since
revert zephyrproject-rtos/zephyr#40319

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
lgirdwood pushed a commit to thesofproject/sof that referenced this pull request Nov 18, 2021
Because ICL fails to build, .noinit/.cached section overlap since
revert zephyrproject-rtos/zephyr#40319

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb
Copy link
Contributor

marc-hb commented Nov 18, 2021

This revert broke sof/scripts/xtensa-build-zephyr.sh for ICL with crosstool-ng:

This is not toolchain specific, same error with XtensaTools. Also specific to ICL, other platforms are fine

build-rimage/rimage -k modules/audio/sof/keys/otc_private_key.pem -o build-icl/zephyr/zephyr.ri -c modules/audio/sof/rimage/config/icl.toml -i 3 -e build-icl/zephyr/bootloader.elf.mod build-icl/zephyr/zephyr.elf.mod

Module Reading build-icl/zephyr/bootloader.elf.mod
info: ignore .bss section for bootloader module
  Found 12 sections, listing valid sections......
	No	LMA		VMA		End		Size	Type	Name
	0	0x00000000	0x00000000	0x00000000	0x0
	1	0xb0038000	0xb0038000	0xb00380fb	0xfb	TEXT	.boot_entry.text
	2	0xb0038220	0xb0038220	0xb0038962	0x742	TEXT	.text
	3	0xb0039000	0xb0039000	0xb0039008	0x8	DATA	.rodata

 module: input size 2117 (0x845) bytes 3 sections
 module: text 2109 (0x83d) bytes
    data 8 (0x8) bytes
    bss  0 (0x0) bytes


Module Reading build-icl/zephyr/zephyr.elf.mod
  Found 44 sections, listing valid sections......
	No	LMA		VMA		End		Size	Type	Name
	1	0xbe010000	0xbe010000	0xbe01016a	0x16a	TEXT	.WindowVectors.text
	2	0xbe010180	0xbe010180	0xbe0101a9	0x29	TEXT	.Level2InterruptVector.text
	3	0xbe0101c0	0xbe0101c0	0xbe0101e9	0x29	TEXT	.Level3InterruptVector.text
	4	0xbe010200	0xbe010200	0xbe010229	0x29	TEXT	.Level4InterruptVector.text
	5	0xbe010240	0xbe010240	0xbe010269	0x29	TEXT	.Level5InterruptVector.text
	6	0xbe010280	0xbe010280	0xbe0102a9	0x29	TEXT	.DebugExceptionVector.text
	7	0xbe0102c0	0xbe0102c0	0xbe0102e9	0x29	TEXT	.NMIExceptionVector.text
	8	0xbe010300	0xbe010300	0xbe010303	0x3	TEXT	.KernelExceptionVector.text
	9	0xbe010340	0xbe010340	0xbe010352	0x12	TEXT	.UserExceptionVector.text
	10	0xbe0103c0	0xbe0103c0	0xbe0103c6	0x6	TEXT	.DoubleExceptionVector.text
	11	0xbe010400	0xbe010400	0xbe043000	0x32c00	TEXT	.text
	12	0xbe043000	0xbe043000	0xbe066f78	0x23f78	DATA	.rodata
	13	0xbe066f78	0xbe066f78	0xbe066fe0	0x68	DATA	initlevel
	14	0xbe066fe0	0xbe066fe0	0xbe067070	0x90	DATA	devices
	15	0xbe067070	0xbe067070	0xbe067088	0x18	DATA	k_p4wq_initparam_area
	16	0xbe067088	0xbe067088	0xbe0670c0	0x38	DATA	log_const_sections
	17	0xbe0670c0	0xbe0670c0	0xbe0670d0	0x10	DATA	log_backends_sections
	18	0xbe0670d0	0xbe0670d0	0xbe0670e0	0x10	DATA	device_handles
	19	0xbe0670e0	0xbe0670e0	0xbe06714c	0x6c	DATA	.fw_ready
	20	0xbe067180	0xbe067180	0xbe067620	0x4a0	DATA	.noinit
	21	0xbe067640	0xbe067640	0xbe069000	0x19c0	DATA	.data
	22	0xbe067180	0xbe067180	0xbe071980	0xa800	DATA	.cached
	23	0xbe069000	0xbe069000	0xbe0694a8	0x4a8	DATA	sw_isr_table
	24	0xbe0694a8	0xbe0694a8	0xbe0694c0	0x18	DATA	device_states
	25	0xbe0694c0	0xbe0694c0	0xbe0694d0	0x10	DATA	k_sem_area
	26	0xbe06a000	0xbe06a000	0xbe06b978	0x1978	BSS	.bss

 module: input size 408311 (0x63af7) bytes 26 sections
 module: text 208507 (0x32e7b) bytes
    data 199804 (0x30c7c) bytes
    bss  6520 (0x1978) bytes

error: section overlap between build-icl/zephyr/zephyr.elf.mod:20 and build-icl/zephyr/zephyr.elf.mod:22
     [0xbe067180 : 0xbe067620] overlaps with [0xbe067180 :0xbe071980]

@dcpleung
Copy link
Member Author

The overlapping issue should be fixed by #40472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: Intel ADSP Intel Audio platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants