loadable module: don't define PHDR twice

Loadable modules are linked, using a linked script, built by a cmake
script. That linker script includes multiple existing linker script
fragments. Each of those fragments defines 1 or more sections and
respective PHDRs. However, some of those scripts, e.g.
common_rodata_linker_script.txt and data_linker_script.txt add
sections to the same rodata_phdr PHDR. This makes the linker
allocate sections in that PHDR twice in the resulting output file:
one copy is real and the other one is filled with zeros. Removing
one of the PHDR definitions solves the problem and removes about
60KiB of empty space from the output file.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2023-08-16 14:42:37 +02:00 committed by Liam Girdwood
parent c0a8881729
commit 2c450e69fa
2 changed files with 2 additions and 8 deletions

View File

@ -1,7 +1,4 @@
PHDRS {
rodata_phdr PT_LOAD;
}
/* The .rodata PHDR is already defined in data_linker_script.txt */
SECTIONS {
.common.rodata : ALIGN(4096) {

View File

@ -1,7 +1,4 @@
PHDRS {
text_phdr PT_LOAD;
}
/* The .text PHDR is already defined in text_linker_script.txt */
SECTIONS {
.common.text : ALIGN(4096){