'Gold: reorder sections using a linker script?

I'm trying to write a linker script that will put the .tdata and .tbss sections beside each other. I'm trying to do this by passing a ld file with the following contents:

SECTIONS
{
    .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
    .tbss  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
}

This linker script doesn't appear to have the desired effect. The .tdata and .tbss sections aren't beside each other in the outputted shared library.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source