This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ld includes entire archive (.a) when compiling .elf file


On Fri, Mar 10, 2006 at 05:59:32PM -0500, Josh Keller wrote:
> Building with --gc-sections ends up giving me a 0-byte binary.  It seems
> to think all my code is garbage (See below) ;)  I'm guessing that I have
> to subdivide my code somehow to tell it what to remove, etc.
> 
> I turned on the -f options and got the following error:
> /usr/local/gnu/lib/gcc-lib/arm-elf/3.3/../../../../arm-elf/bin/ld: -f
> may not be used without -shared.

Then obviously you've passed it the wrong options... ah,
-ffunction-sections is not a linker option, it's a compiler option, so
no -Wl.

> Output from my compiler...
> 
> arm-elf-gcc  Cstartup.o   main.o Cstartup_SAM7.o irq.o pio.o
> interrupt_pit.o interrupt_Usart.o --output main.elf -nostartfiles
> -Wl,-Map=main.map,--cref,--gc-sections -Iucos_ii -Lucos_ii -lucos_ii
> -TAT91SAM7S64-ROM.ld

Try using the linker option -e to specify the function at the start of
execution.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]