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 script help




Lighbringer wrote:
> 
> I am using binutils 2.18 and am having problems with the linker script. I
> am somewhat new to linker scripting and the problem is that the binary
> file being created by ld is too big. My linker script is as follows:
> 
> OUTPUT_FORMAT("binary")
> ENTRY(_start)
> SECTIONS
> {
>   .text 0x100000 : {
>     code = .; _code = .; __code = .;
>     *(.text)
>     . = ALIGN(4096);
>   }
>   .data  : {
>     data = .; _data = .; __data = .;
>     *(.data)
>     . = ALIGN(4096);
>   }
>   .bss  :
>   {
>     bss = .; _bss = .; __bss = .;
>     *(.bss)
>     . = ALIGN(4096);
>   }
>   end = .; _end = .; __end = .;
> }
> 
> It seems that the binary file does put everything in "proper" place, like
> the code at 0x100000, but with previous ld versions the binary was getting
> around 50k and this version is building a 1mb+ binary. I don't know what I
> am missing here, can someone help me? Is there some kind of compression
> the ld should do?
> 

One other thing, my calling linker line is
ld  -T script.ld -o foo.o <input files>

There's a working workaround, that creates the file I was expecting like
this
ld --oformat binary -o foo.o <input files> -Ttext 0x100000

But I would really like to put things in the script.
-- 
View this message in context: http://www.nabble.com/ld-script-help-tf4697727.html#a13428696
Sent from the Sourceware - binutils list mailing list archive at Nabble.com.


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