Difference between *(.data), *(.data*) and *(.data.*) in linker script

六眼飞鱼酱① 提交于 2020-01-24 19:11:13

问题


Just curious to know what is the difference between such constructions (for text, data, rodata, bss etc) in linker script:

.data :
{
    *(.data)
}


.data :
{
    *(.data*)
}


.data :
{
    *(.data.*)
}

In all cases we gather data sections from all object files, but the devil is in the detail.

Fast test showed that addresses in map file differ and in turn it influences the size of executable file.

I tried to find the information in ld documentation but found nothing (or just missed it).

I guess that it should be something very simple (so called obvious).

Any ideas will be highly appreciated.


回答1:


In any place where you may use a specific file or section name, you may also use a wildcard pattern.

It works like a regular pattern

  • *(.data) - .data sections, Example: .data
  • *(.data*)- .data* section, Example: .dataTEST
  • *(.data.*) - .data.* section, Example: .data.TEST

Find more info here



来源:https://stackoverflow.com/questions/40786942/difference-between-data-data-and-data-in-linker-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!