This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: ld includes entire archive (.a) when compiling .elf file
- From: "Josh Keller" <jkeller at keytechinc dot com>
- To: "Daniel Jacobowitz" <drow at false dot org>
- Cc: <binutils at sourceware dot org>, "Reuben Johnston" <rjohnston at keytechinc dot com>
- Date: Fri, 10 Mar 2006 18:19:34 -0500
- Subject: RE: ld includes entire archive (.a) when compiling .elf file
I think this link may help:
http://m68hc11.serveftp.org/faq.php?file=faq/link/gc-1.txt
I will let you know how it works out.
-Josh
Joshua Keller
Key Technologies, Inc.
40 East Cross Street
Baltimore, MD 21230
Phone: 410-385-0200
Fax: 410-385-1114
jkeller@keytechinc.com
www.keytechinc.com
Visit Key Tech at the MD&M East in NYC June 6-8, 2006 - - Booth# 1680
Save $55 on your admission...go to Key Tech at MDM East
-----Original Message-----
From: Daniel Jacobowitz [mailto:drow@false.org]
Sent: Friday, March 10, 2006 6:02 PM
To: Josh Keller
Cc: binutils@sourceware.org; Reuben Johnston
Subject: 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