bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objcopy -O binary (on cygwin)


From: lode . leroy
Subject: Re: objcopy -O binary (on cygwin)
Date: Tue, 10 Feb 2004 09:22:12 +0100 (CET)
User-agent: SquirrelMail/1.4.1

> Hi lode.leroy,
>
>> While compiling GRUB on cygwin,
>>     objcopy -O binary
>> does not seem to do what it's supposed to do.
>
> Please could you provide some more information about what you are
> expecting objcopy to do in this case.  ie what is going wrong ?
>
>> gcc -c   -g  conftest.c
>> gcc   -g -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 conftest.o -o \
>> conftest.exec
>> objcopy -O binary conftest.exec conftest
>> cmp -l conftest conftest.old
>> gcc   -g -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 conftest.o -o \
>> conftest.exec
>> objcopy -O binary conftest.exec conftest
>> cmp -l conftest.old conftest
>
> How does this configure test fail ?
>
> Cheers
>         Nick
>
>
>

on linux, the test succeeds.
on cygwin, the files are different.

I guess that the GRUB expects to have the bare code from the object file,
to create a bootable image.

I'm not familiar with objcopy, but having looked somewhat deeper into
this, it looks as though on cygwin, the compiler inserts symbols
that the GRUB does not like.

It might be related to the fact that compiling on cygwin is either for
subsystem windows or console or posix.... and not for 'no OS'

on linux, the compiler object (conftest.o) includes:
00007c00 A __bss_start
00007c00 A _edata
00007c00 A _end
00007c00 T _cmain

and objcopy is supposed to copy the bytes that make up _cmain

on cygwin, the compiled object (conftest.o) includes:

00007c00 t .bss
00007c00 t .data
00009000 N .stab
00007c00 t .text
00007c10 T __CTOR_LIST__
00007c18 T __DTOR_LIST__
00007c00 T __RUNTIME_PSEUDO_RELOC_LIST_END__
00007c00 T __RUNTIME_PSEUDO_RELOC_LIST__
00007c10 T ___CTOR_LIST__
00007c18 T ___DTOR_LIST__
00007c00 T ___RUNTIME_PSEUDO_RELOC_LIST_END__
00007c00 T ___RUNTIME_PSEUDO_RELOC_LIST__
00007c00 T __bss_end__
00007c00 T __bss_start__
00007c00 T __data_end__
00007c00 T __data_start__
00000000 A __dll__
00007c00 T __end__
00000200 A __file_alignment__
00400000 A __image_base__
00000000 A __loader_flags__
00000001 A __major_image_version__
00000004 A __major_os_version__
00000004 A __major_subsystem_version__
00000000 A __minor_image_version__
00000000 A __minor_os_version__
00000000 A __minor_subsystem_version__
00001000 A __section_alignment__
00001000 A __size_of_heap_commit__
00100000 A __size_of_heap_reserve__
00001000 A __size_of_stack_commit__
00200000 A __size_of_stack_reserve__
00000003 A __subsystem__
00007c00 T _cmain
         U _mainCRTStartup

So in the end, it might be related to providing the correct flags to the
compiler. I was just confused by "configure" stating that
"GRUB requires a working absolute objcopy; upgrade your binutils"

thanks for following this up.
If you know what flags I need to add, I'd be interested...

-- lode



----------------------------------------------------------------------------------
Plaats je zoekertjes GRATIS op AdValvas
Placez votre petite annonce GRATUITEMENT sur AdValvas
http://www.advalvas.be




reply via email to

[Prev in Thread] Current Thread [Next in Thread]