ld

Loader scripts for ARM STR7xx

I'm trying to program ARM using Eclipse + CDT + yagarto (gnu toolchain) + OpenOCD. In several sample projects (from yagarto site for example) I found linker scripts (*.ld) where a lot of linking information specified (along with sections definitions). Actually I haven't faced this files before (IAR doesn't need them), and I find them som...

Strange ld error

I have a project consisting of two files, main.c and logoff.c. When I try to compile them I get this error: gcc -c -g -Wall main.c gcc -c -g -Wall logoff.c gcc -o main -g -Wall main.o logoff.o ld: duplicate symbol _logoff in logoff.o and main.o I have a function named logoff in logoff.c, but I have searched main.c for the text "logoff...

Include binary file with GNU ld linker script

I have a working linker script. I want to add another data section whose contents is pulled directly from a file (ld shouldn't parse it and extract the sections and so on). How can I do that? OUTPUT_FORMAT("elf32-i386") ENTRY(start) SECTIONS { .text 0x100000 : { *(.multiboot) *(.text) *(.code) *(.rodata*) } .data :...

GCC/ELF - from where comes my symbol ?

There is an executable that is dynamically linked to number of shared objects. How can I determine, to which of them some symbol (imported into executable) belongs ? If there are more than one possibility, could I silmulate ld and see from where it is being taken ? ...

Hide symbol(s) in Shared Object from LD

I have two third-party libraries occasionally having the same symbol name exported. When the executable is loaded, ld usually picks the wrong one and I getting crash as a result. I cannot do too much about the content of these libraries, so may be there is a way to instruct ld how to find the proper imlementation ? OS - Solaris 10, my p...

How would you list the available functions etc contained within a compiled library?

How do I determine whether a function exists within a library, or list out the functions in a compiled library? ...

profile linking times with gcc/g++ and ld

I'm using g++ to compile and link a project consisting of about 15 c++ source files and 4 shared object files. Recently the linking time more than doubled, but I don't have the history of the makefile available to me. Is there any way to profile g++ to see what part of the linking is taking a long time? Edit: After I noticed that the ...

Linking symbols to fixed addresses on Linux

How would one go about linking (some) symbols to specific fixed addresses using GNU ld so that the binary could still be executed as normal in Linux (x86)? There will not be any accesses to those symbols, but their addresses are important. For example, I'd have the following structure: struct FooBar { Register32 field_1; Regist...

What is the difference between -I and -L in makefile?

Where can I find the usage of these stuff? Is there some books that cover them? ...

Solaris linker equivalent to the GNU LD --export-dynamic flag

Like the question says: We are building on Linux using the GNU linker, and on Solaris using the solaris ld. GNU ld supports the --export-dynamic flag, which: When creating a dynamically linked executable, add all symbols to the dynamic symbol table. The dynamic symbol table is the set of symbols which are visible from dynam...

Why do I have to define LD_LIBRARY_PATH with an export every time I run my application?

I have some code that uses some shared libraries (c code on gcc). When compiling I have to explicitly define the include and library directories using -I and -L, since they aren't in the standard places. When I try to run the code, I get the following error: ./sync_test ./sync_test: error while loading shared libraries: libsync.so: can...

What are the negative consequences of including and/or linking things that aren't used by your binary?

Let's say that I have a binary that I am building, and I include a bunch of files that are never actually used, and do the subsequent linking to the libraries described by those include files? (again, these libraries are never used) What are the negative consequences of this, beyond increased compile time? ...

ld can't find c file

I have a assembly file and a c file compiled to .o files (start.o and main.o) and is trying to link them with ld. I'm using this command: ld -T link.ld -o kernel.bin start.o main.o where link.ld is a linker script, but when I run it, i get this error: start.o:start.o:(.text+0x2d): undefined reference to `_main' in the assembly file...

linking *.o files in Windows

When I'm linking .o files with the LD linker using MinGW on Windows, it gives me the error "file.o: File not recognized: file format not recognized". I've tried to do it with cygwin instread, but the same thing happens. Any suggestions? ...

What causes linker only giving "ld returned 1 exit status" message?

I am using "--verbose" for ld in an attempt to get something useful for finding the problem, but it prints the error message amidst printing normal "--verbose" output: [...blah - dump of linker script...] attempt to open blah1.o succeeded blah1.o attempt to open blah2.o succeeded blah2.o [...blah - more opens that succeeded...] attempt ...

How to get GCC linker command?

How can I get the command line GCC uses to invoke ld? I have a problem for an AVR target where GCC apparently adds a linker option which I am trying to override, so I would like to look at the exact options GCC uses for ld. ...

shared library file size

On creating a shared library the ./sl file size is coming out to be greater than 60KB. There are 2 .o files whose total size is over 20KB. Checked the utlities : ldd and elfdump to determine libraries being referenced. Apart from the original files used I see references of :/usr/ccs/lib/pa20_64/lddstub and SOURCE FILE INFO: movelr1 PA...

Using LD to link intermediate files

If I have a.o, b.o, and c.o, how do I make ld link them into d.o, which is then linked into my main object file? All that I want to have happen is that all the symbols in the input files get combined into one big output file. ...

QtCreator build returns collect2: ld returned exit status 1

While building several different projects in QtCreator, I have run across the following build error: collect2: ld returned 1 exit status After only changing a few things (that should not change anything significant in the build), it will go away if it has already appeared, or it will appear if it's not there. In my current program fo...

ld cannot find library that is installed

I'm sitting on an OpenSuse 11.1 x64 Box and I have a module that uses sigc++. When linking like this: g++ [a lot of o's, L's and l's] -lsigc-2.0 I get /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lsigc-2.0 However the library is there. In the filesystem: $ sudo find / -name "libsigc-2.0*"...