Skip to contentSkip to conversation

objcopy fix (for x86_64)

PATCH Robert Millan 4 participants 5 messages Nov 18, 2007 – Nov 27, 2007

lore
Share & tools
lore
#0 lore raw

This prevents objcopy from copying sections other than .text during the ./configure absolute address test. On i386, our conftest only has .text and .comment (which is skipped), but on x86_64 there's an additional .eh_frame section which isn't skipped unless you tell it to.

Just one step further towards x86_64 grub ;-)

Comments?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Pass `--only-section=.text' to objcopy.

aclocal.m4 +1 -1
diff -ur grub2.old/aclocal.m4 grub2/aclocal.m4
@@ -61,7 +61,7 @@
   else
     AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
   fi
-  if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
+  if AC_TRY_COMMAND([${OBJCOPY-objcopy} --only-section=.text -O binary conftest.exec conftest]); then :
   else
     AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
   fi
#1 lore raw
Quoted 5 lines · Robert Millan

This prevents objcopy from copying sections other than .text during the ./configure absolute address test. On i386, our conftest only has .text and .comment (which is skipped), but on x86_64 there's an additional .eh_frame section which isn't skipped unless you tell it to.

Quoted 14 lines

Just one step further towards x86_64 grub ;-)

Comments?

Signature · 9 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)


	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Pass `--only-section=.text'
	to objcopy.

Looks fine to me.

--
Marco

#2 lore raw
Quoted 19 lines · Marco Gerards
Quoted 17 lines · Robert Millan

This prevents objcopy from copying sections other than .text during the ./configure absolute address test. On i386, our conftest only has .text and .comment (which is skipped), but on x86_64 there's an additional .eh_frame section which isn't skipped unless you tell it to.

Just one step further towards x86_64 grub ;-)

Comments?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
Quoted 4 lines
Quoted 2 lines

* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Pass `--only-section=.text' to objcopy.

Looks fine to me.

Uhm actually, I suppose one would need this argument in two separate places (the test, and the real thing), which I missed.

I'll have a look again later.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
#3 lore raw
Quoted 7 lines · Robert Millan
Quoted 4 lines
Quoted 2 lines

* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Pass `--only-section=.text' to objcopy.

Looks fine to me.

Uhm actually, I suppose one would need this argument in two separate places (the test, and the real thing), which I missed.

It won't work "in the real thing". There are more sections than just .text that need to be preserved.

In any case, it will be in the yet to be written conf/x86_64-pc.mk

We need to find the real reason behind grub_PROG_OBJCOPY_ABSOLUTE and relax the test to only find the original problem without impeding new ports.

Signature · 2 lines
Regards,
Pavel Roskin
#4 lore raw
Quoted 11 lines · Pavel Roskin
Quoted 8 lines · Robert Millan
Quoted 5 lines
Quoted 3 lines

* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Pass `--only-section=.text' to objcopy.

Looks fine to me.

Uhm actually, I suppose one would need this argument in two separate places (the test, and the real thing), which I missed.

Quoted 10 lines

It won't work "in the real thing". There are more sections than just .text that need to be preserved.

In any case, it will be in the yet to be written conf/x86_64-pc.mk

We need to find the real reason behind grub_PROG_OBJCOPY_ABSOLUTE and relax the test to only find the original problem without impeding new ports.

The reason for the failing objcopy test may be an unsupported or unsuitable "-N" linker option. The linker possibly adds constant bytes to some section.

Examining the builtin linker script ("ld -N --verbose") may be helpful to track down the problem.

If this script does not work, it can be replaced by a target specific version selected by configure. See "[PATCH] Build on Cygwin" for a working example.

Christian