I have the following linker script:
SECTIONS {
.arora_exec_free_space 4399531 :
{
*(.text)
*(.rodata)
*(.data.rel.ro.local)
}
.arora_data_free_space (ADDR(.arora_exec_free_space) + SIZEOF(.arora_exec_free_space)) : AT (7592352)
{
*(.data)
*(.bss)
*(.got)
}
}
When I compile my program the two section (exec and data) are in different LOAD segments. I want to put the two sections (.arora_data_free_space and .arora_exec_free_space) into one LOAD segment. Is there any way to do it using linker scripts? How can I do it? Thanks.
Sure - you just need to use PHDRS. The example at that link is pretty much exactly what you want to do, I think. Here is an (untested) example I made from your linker script:
PHDRS
{
mysegment PT_LOAD;
}
SECTIONS
{
.arora_exec_free_space 4399531 :
{
*(.text)
*(.rodata)
*(.data.rel.ro.local)
} :mysegment
.arora_data_free_space (ADDR(.arora_exec_free_space) + SIZEOF(.arora_exec_free_space)) : AT (7592352)
{
*(.data)
*(.bss)
*(.got)
} :mysegment
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With