linker-scripts

When is .ARM.exidx is used

╄→гoц情女王★ 提交于 2019-11-28 13:24:11
I am working on Contiki 2.7 with the mbxxx target. While building my code the linker complained about an overlap of .ARM.exidx and .data sections . After some tinkering around with the linker script contiki-2.7/cpu/stm32w108/gnu-stm32w108.ld I fixed the problem by replacing: __exidx_start = .; __exidx_end = .; with: .ARM.exidx : { __exidx_start = .; *(.ARM.exidx* .gnu.linkonce.armexidx.*) __exidx_end = .; } >ROM_region Later when I tried to see the header listing of some other example applications by using objdump -h I did not find this particular .ARM.exidx section, while it is present in my

Understanding the Location Counter of GNU Linker Scripts

时光总嘲笑我的痴心妄想 提交于 2019-11-28 05:04:59
I'm working on a university project where I'm writing software for an Atmel SAM7S256 microcontroller from the ground up. This is more in depth than other MCUs I've worked with before, as a knowledge of linker scripts and assembly language is necessary this time around. I've been really scrutinizing example projects for the SAM7S chips in order to fully understand how to start a SAM7/ARM project from scratch. A notable example is Miro Samek's "Building Bare-Metal ARM Systems with GNU" tutorial found here (where the code in this question is from). I've also spent a lot of time reading the linker

gcc/ld - create a new libc.so with __isoc99_sscanf@@GLIBC_2.7 symbol from glibc.2.6

不问归期 提交于 2019-11-27 15:18:44
问题 I have an application, which does a error when I try to run it: /lib/libc.so.6: version `GLIBC_2.7' not found But the only symbol it needs from glibc 2.7 is __isoc99_sscanf@@GLIBC_2.7 I want to write a small single function "library" with this symbol as alias to __sscanf() How can I do this with gcc/ld? My variant is not accepted because "@@" symbols int __isoc99_sscanf@@GLIBC_2.7(const char *, const char *, ...) __attribute__((alias("__sscanf"))); second my variant is #include <stdarg.h> int

What does KEEP mean in a linker script?

我们两清 提交于 2019-11-27 14:16:15
The LD manual does not explain what the KEEP command does. Below is a snippet from a third-party linker script that features KEEP . What does the KEEP command do in ld ? SECTIONS { .text : { . = ALIGN(4); _text = .; PROVIDE(stext = .); KEEP(*(.isr_vector)) KEEP(*(.init)) *(.text .text.*) *(.rodata .rodata.*) *(.gnu.linkonce.t.*) *(.glue_7) *(.glue_7t) *(.gcc_except_table) *(.gnu.linkonce.r.*) . = ALIGN(4); _etext = .; _sidata = _etext; PROVIDE(etext = .); _fini = . ; *(.fini) } >flash Afaik LD keeps the symbols in the section even if symbols are not referenced. (--gc-sections). Usually used

When is .ARM.exidx is used

故事扮演 提交于 2019-11-27 07:38:27
问题 I am working on Contiki 2.7 with the mbxxx target. While building my code the linker complained about an overlap of .ARM.exidx and .data sections . After some tinkering around with the linker script contiki-2.7/cpu/stm32w108/gnu-stm32w108.ld I fixed the problem by replacing: __exidx_start = .; __exidx_end = .; with: .ARM.exidx : { __exidx_start = .; *(.ARM.exidx* .gnu.linkonce.armexidx.*) __exidx_end = .; } >ROM_region Later when I tried to see the header listing of some other example

Is accessing the “value” of a linker script variable undefined behavior in C?

一个人想着一个人 提交于 2019-11-27 07:33:35
问题 The GNU ld (linker script) manual Section 3.5.5 Source Code Reference has some really important information on how to access linker script "variables" (which are actually just integer addresses) in C source code. I used this info. to extensively use linker script variables, and I wrote this answer here: How to get value of variable defined in ld linker script from C. However, it is easy to do it wrong and make the mistake of trying to access a linker script variable's value (mistakenly)

Understanding the Location Counter of GNU Linker Scripts

雨燕双飞 提交于 2019-11-27 00:47:11
问题 I'm working on a university project where I'm writing software for an Atmel SAM7S256 microcontroller from the ground up. This is more in depth than other MCUs I've worked with before, as a knowledge of linker scripts and assembly language is necessary this time around. I've been really scrutinizing example projects for the SAM7S chips in order to fully understand how to start a SAM7/ARM project from scratch. A notable example is Miro Samek's "Building Bare-Metal ARM Systems with GNU" tutorial

Limiting visibility of symbols when linking shared libraries

不问归期 提交于 2019-11-26 03:28:16
问题 Some platforms mandate that you provide a list of a shared library\'s external symbols to the linker. However, on most unixish systems that\'s not necessary: all non-static symbols will be available by default. My understanding is that the GNU toolchain can optionally restrict visibility just to symbols explicitly declared. How can that be achieved using GNU ld? 回答1: GNU ld can do that on ELF platforms. Here is how to do it with a linker version script: /* foo.c */ int foo() { return 42; }