linker-scripts

What does KEEP mean in a linker script?

爱⌒轻易说出口 提交于 2019-12-17 10:57:08
问题 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 回答1:

Linker cannot find existing Static Library File

一曲冷凌霜 提交于 2019-12-13 23:31:41
问题 I have a Eclipse project using C programming language. I have been stuck with a problem related to linker error since two days now. I have checked various forums to find a solution. Tried a lot of the suggestions but could not resolve it. So as a last resort, i am asking question here. My main program MotorRun.c has code which calls functions in the static library FtMscLib_Static_LIBCMT_Release.Lib which is in Libs folder in the path C:\FT-Project\Common\Libs . I am using MinGW gcc compiler.

Put gcc libs .data in specific section?

牧云@^-^@ 提交于 2019-12-13 12:31:25
问题 I'm trying to switch to the GNU GCC compiler for our embedded system, but I'm having trouble linking the project as the memory layout of our chip is split: RAM section 1: 0x10000-0x12FFF RAM section 2: 0x18000-0x1BFFF The data from our project can fit in section 1, but the data linked from the gcc libs doesn't. Map file extract: .data 0x00012974 0x3c4 c:/tools/gnucr16_v1.1.3-elf/cr16-elf/bin/../lib/gcc/cr16-elf/4.5.1-GNUCR16_v1.1.3/../../../../cr16-elf/lib\libc.a(lib_a-impure.o) 0x00012974

Linker Script - Placing a section at the end of a memory region

烈酒焚心 提交于 2019-12-12 07:09:27
问题 I have searched far and wide for how to do this and have failed to come up with an answer. My memory layout is as follows: Fake Address | Section 0 | text 7 | relocate 15 | bss 23 | stack At the end of the Stack I place the Heap. Which grows up and the stack is a full descending stack for the ARM chip I am using. Now, what I want to do is place a single section, let's call it .persist , into my ram memory. I want it to reside at the very end of RAM and I want to program this into my linker

Cause link to fail if certain symbol is referenced

爱⌒轻易说出口 提交于 2019-12-11 16:46:32
问题 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 it to prevent some part of a third-party library from accidentally linking into the application. If it does link, it adds some static initializers which wreak havoc at runtime (it's an embedded project so the environment is a bit quirky). I cannot

How can I get two page aligned(0x1000) and separated program headers?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 11:21:12
问题 I am trying to implement custom loader and want to locate two program headers(segment) for data and code with 0x1000 aligned. I fixed some part of the default linker script and get weird results. **Default linker script.** . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT(MAXPAGESIZE),CONSTANT (COMMONPAGESIZE)); **Modified linker script** . = ALIGN (0x1000); . = DATA_SEGMENT_ALIGN(0x1000, 0x1000); when I

c - send .data to a different section

二次信任 提交于 2019-12-11 09:09:09
问题 I want to take the symbols in the .data section generated for a particular C file and place them in a different section (e.g. .mydata ) in the final executable. For example, normaldata.c: char * my_str = "this should appear in .data"; specialdata.c: char * my_special_str = "this should appear in .mydata"; By default, both my_str and my_special_str appear in the .data section. However, when I generate specialdata.o , I want to send anything that would have appeared in .data instead to .mydata

load script to load a section at the top of a memory region

房东的猫 提交于 2019-12-11 03:38:51
问题 I'm working on a project for an embedded system, using an ARM M0. A ROM application has to be created, whose sole purpose is to store stuff in rom, and initialize the data and bss sections whenever needed. The loadscript so far is this: MEMORY { rom (rx): ORIGIN = 0, LENGTH = 32K ; ram (!rx): ORIGIN = 0x10000, LENGTH = 8K ; } SECTION { . = ORIGIN(rom) ; .text: { KEEP(*(.text)) ; } >. .data: { KEEP(*(.data)) ; } >ram AT>. .bss: { KEEP(*(.bss)) ; } > ram = 0x00 } I want to change the loadscript

Linker file vector table for bootloader setup

北战南征 提交于 2019-12-08 04:43:21
问题 I am currently trying to use a bootloader application created using MCUXPresso that requires that my application start address is located at 0x80000. According to the following documentation: However, the .bin I generate is created with Kinetis Design Studio (an earlier version of MCUXpresso) and does not have the option to modify the vector table in such an easy way as in MCUXPresso. What I've been trying is modifying the linker file manually doing the following: ENTRY(Reset_Handler) /*

Difference between map file and linker file

若如初见. 提交于 2019-12-07 22:19:00
问题 What is the difference between the map file generated by the linker and the linker file that contains the memory segments itself ? 回答1: the 'linker' file is a set of commands to the linker as to how everything is to be laid out in memory and is created by the programmer. The 'map' file is a listing of where everything is located in memory and is created by the linker. 来源: https://stackoverflow.com/questions/48614377/difference-between-map-file-and-linker-file