Questions tagged [linker-scripts]

The linker command language used to control the memory layout of computer programs and details of the linking process.

Linker scripts contain a command language processed by the linker to determine how sections in input files are mapped into the output file. Most often used to control the memory layout in computer programs, they can also exercise fine control over details of the linking process.

453 questions
0
votes
0 answers

Understanding linker script values in the context of a simple kernel

I'm following this book with regards to developing a little kernel: https://littleosbook.github.io I've gotten to the point where the binary has to be linked and I want to be sure that I understand the linker script before proceeding: ENTRY(loader) …
Paul
  • 20,883
  • 7
  • 57
  • 74
0
votes
1 answer

Linux - process killed when linking section into lowest 2 MB of memory?

I'm learning about LD linker scripts, and I noticed that if I link the .text section (or any section) at an address lower than than 2 MB, my process gets instantly killed by Linux as soon as I run it. Here's an example script I'm using: SECTIONS { …
Chris Vig
  • 8,552
  • 2
  • 27
  • 35
0
votes
1 answer

Error while linking : linker script

What does this error means? section .data can't be allocated in segment 2 This is for a bare metal GCC cross toolchain for Xtensa. I feel that this has nothing to do with the segment size.
0
votes
1 answer

lpc1768 linker script why ram start address

lpc1768 linker script why ram start address should be given at 0x100000C8, RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = 0x7F38. If I give at 0x10000000 then system is crashing when I enable UART interrupts.
0
votes
1 answer

How to insert data into compiled binary for MCU

I am trying to insert a md5 hash of part of my binary into the binary, for keeping track of MCU FW version. I have approached it like this: in the link script I have split the flash in two sections MEMORY …
evading
  • 3,032
  • 6
  • 37
  • 57
0
votes
1 answer

does the starting address of the section in linker script is applicable to only virtual memory

I have read the linker script. i have got one confusion regarding allocating memory. when we define section with starting where we want to load the file. 1) does the memory locations what we have specified are applicable to virtual memory like ( . =…
david
  • 11
  • 1
0
votes
1 answer

Update linker variables after --gc-sections

I wrote a small binary in cortex-a9 board, and defined a linker script like this: SECTIONS { .text : { __text = . ; *(.vector) *(.text) *(.text.*) } .rodata : { *(.rodata) …
akewart
  • 3
  • 2
0
votes
1 answer

Why using __attribute__ (section) for some memory allocation?

I have foo[NUMBYTES] __attribute__((section(".bar"))); Why using this attribute .bar section? Because foo[] provides already some memory space. Is this for easy memory management?
0
votes
1 answer

Cause link to fail if certain symbol is referenced

Is there a way to make linking fail if the code references a certain symbol from a library? I seem to remember dimly that there was such a directive in the linker script language, but apparently it was not GNU LD (maybe it's a false memory). I need…
atzz
  • 17,507
  • 3
  • 35
  • 35
0
votes
1 answer

How do I set the alignment for the whole project in CCSv5?

I need to set the linker alignment for a whole project in TI Code Composer Studio 5.5 (TI ARM compiler 5.1.1). This is my linker .cmd file: MEMORY { BOOTROM: o = 0x40020000 l = 0x0000C000 /* 48kB public boot ROM */ SRAM: o =…
0
votes
2 answers

Linker script not working?

I have a very simple program (simple.c): #include int main(){ int a = 4; return 0; } I am trying to use a the following linker script (MEMORY): MEMORY { m_text : ORIGIN = 0x0000000000400000, LENGTH = 0x0001FBF0 m_data : ORIGIN =…
G Gill
  • 1,087
  • 1
  • 12
  • 24
0
votes
1 answer

Compile and link two files using cmake?

I have two files in my project. One is a ".c" file, one is a ".asm" file. First, I compile both the files into two ".o" object files and then link together using a custom linker script. Currently, I am using a simple bash script with manual commands…
Pratik Singhal
  • 6,283
  • 10
  • 55
  • 97
0
votes
1 answer

linking error when using sprintf()

on my cortex-m3, i am trying to output a float variable to my UART port.. so i need to convert the float DATA into a char outputstr[]. For this purpose, i used sprintf from the libc.a if i comment out the sprintf(), i can compile and link. if i use…
foob
  • 293
  • 1
  • 4
  • 12
0
votes
1 answer

Unknown linking error

I'm developing my own OS, but for this I need to touch on linking, then I've done this linking script to build it: ENTRY (loader) SECTIONS{ . = 0x00100000 .text : { *(.text) } .bss : { sbss = .; *(COMMON) …
Nathan Campos
  • 28,769
  • 59
  • 194
  • 300
0
votes
1 answer

Huge output binary file produced

I am developing small hello world app for Freescale iMX6 board, that will run from On-chip RAM. I am able to run the complete code from OCRAM but if I modify the linker script to generate a data section in external DDR ram's memory space, the output…
Hamzahfrq
  • 696
  • 1
  • 6
  • 25