Skip to contentSkip to conversation

[2290] 2009-06-10 Pavel Roskin <[email protected]>

DISCUSSION Christian Franke 3 participants 10 messages Jun 11, 2009 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 16 lines · Pavel Roskin

Revision: 2290

          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2290
Author:   proski
Date:     2009-06-10 18:32:13 +0000 (Wed, 10 Jun 2009)

Log Message:
-----------
2009-06-10 Pavel Roskin <[email protected]>

* configure.ac: Use -nostdlib when probing for the target. It should not be required to have libc for the target.
...
# Set them to their new values for the tests below. CC="$TARGET_CC"

Review

Quoted 4 lines
(quoted diff) +1 -1
-CFLAGS="$TARGET_CFLAGS"
+CFLAGS="$TARGET_CFLAGS -nostdlib"
 CPPFLAGS="$TARGET_CPPFLAGS"
 LDFLAGS="$TARGET_LDFLAGS"

This change breaks build at least on Cygwin, ./configure fails with:

checking whether target compiler is working... no
configure: error: cannot compile for the target

The link test in grub_PROG_TARGET_CC fails due to missing '__main' symbol from libgcc. According to gcc 4.3.2 man page, '-nostdlib' usually requires '-lgcc'.

Signature · 2 lines
Regards,
Christian Franke
#2 lore raw
Quoted 24 lines · Christian Franke
Quoted 16 lines · Pavel Roskin

Revision: 2290
         http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2290
Author:   proski
Date:     2009-06-10 18:32:13 +0000 (Wed, 10 Jun 2009) Log Message:
-----------
2009-06-10  Pavel Roskin  <[email protected]>

       * configure.ac: Use -nostdlib when probing for the target.  It should not be required to have libc for the target.
...
 # Set them to their new values for the tests below. CC="$TARGET_CC"

(quoted diff) +1 -1
-CFLAGS="$TARGET_CFLAGS"
+CFLAGS="$TARGET_CFLAGS -nostdlib"
Quoted 4 lines

 CPPFLAGS="$TARGET_CPPFLAGS"
 LDFLAGS="$TARGET_LDFLAGS"

This change breaks build at least on Cygwin, ./configure fails with:

Quoted 6 lines

checking whether target compiler is working... no
configure: error: cannot compile for the target

The link test in grub_PROG_TARGET_CC fails due to missing '__main' symbol from libgcc. According to gcc 4.3.2 man page, '-nostdlib' usually requires '-lgcc'.

Try compiling but not linking using -c option. If it works you can commit it since we never do complete linking for target

Quoted 12 lines

--
Regards,
Christian Franke

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#3 lore raw
Quoted 8 lines · Vladimir 'phcoder' Serbinenko
Quoted 5 lines

The link test in grub_PROG_TARGET_CC fails due to missing '__main' symbol from libgcc. According to gcc 4.3.2 man page, '-nostdlib' usually requires '-lgcc'.

Try compiling but not linking using -c option. If it works you can commit it since we never do complete linking for target

Complete linking is not used during build but during configure. The following tests rely on it:

grub_PROG_LD_BUILD_ID_NONE
grub_CHECK_BSS_START_SYMBOL
grub_CHECK_END_SYMBOL

I would suggest to undo commit 2290 for now.

Signature · 2 lines
Regards,
Christian Franke
#4 lore raw
Quoted 15 lines · Christian Franke
Quoted 10 lines · Vladimir 'phcoder' Serbinenko
Quoted 6 lines

The link test in grub_PROG_TARGET_CC fails due to missing '__main' symbol from libgcc. According to gcc 4.3.2 man page, '-nostdlib' usually requires
'-lgcc'.

Try compiling but not linking using -c option. If it works you can commit it since we never do complete linking for target

Complete linking is not used during build but during configure. The following tests rely on it:

Quoted 6 lines

grub_PROG_LD_BUILD_ID_NONE
grub_CHECK_BSS_START_SYMBOL
grub_CHECK_END_SYMBOL

I would suggest to undo commit 2290 for now.

I think we should commit Pavel's patch on using same ld everywhere.

Quoted 12 lines

--
Regards,
Christian Franke

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#10 lore raw
In reply to Christian Franke
Quoted 8 lines · Christian Franke

Complete linking is not used during build but during configure. The following tests rely on it:

grub_PROG_LD_BUILD_ID_NONE
grub_CHECK_BSS_START_SYMBOL
grub_CHECK_END_SYMBOL

I would suggest to undo commit 2290 for now.

OK, I'll undo it unless I find an easy fix today.

Signature · 2 lines
Regards,
Pavel Roskin
#5 lore raw
In reply to Vladimir 'phcoder' Serbinenko
Quoted 2 lines · Vladimir 'phcoder' Serbinenko
Quoted 1 line

I would suggest to undo commit 2290 for now.

I think we should commit Pavel's patch on using same ld everywhere.

You mean the ld script? I'll try to resurrect it, but now I'll need to have a special case for the Apple build system. That should take care of the BSS clearing. As for grub_PROG_LD_BUILD_ID_NONE, perhaps we need to look for another approach.

Signature · 2 lines
Regards,
Pavel Roskin
#6 lore raw
Quoted 7 lines · Pavel Roskin
Quoted 2 lines · Vladimir 'phcoder' Serbinenko
Quoted 1 line

I would suggest to undo commit 2290 for now.

I think we should commit Pavel's patch on using same ld everywhere.

You mean the ld script?  I'll try to resurrect it, but now I'll need to have a special case for the Apple build system.

Just let the Apple's build system as it is. Unfortunately it doesn't support ld scripts

Quoted 3 lines

 That should take care
of the BSS clearing.  As for grub_PROG_LD_BUILD_ID_NONE, perhaps we need to look for another approach.

Possibilities
1) to test both with and without -nostdlib and check that at least one works. I don't like this one
2) rename main to main,start,_start,__start,_main or __main. Just find one that works by bruteforce in script

Quoted 11 lines

--
Regards,
Pavel Roskin

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#7 lore raw
Quoted 3 lines · Vladimir 'phcoder' Serbinenko

Possibilities
1) to test both with and without -nostdlib and check that at least one works. I don't like this one

Me neither.

Quoted 2 lines

2) rename main to main,start,_start,__start,_main or __main. Just find one that works by bruteforce in script

We can use -Wl,--defsym,___main=0x8100 as it's done elsewhere in configure.ac. Let me just check it doesn't break anything.

Signature · 2 lines
Regards,
Pavel Roskin
#8 lore raw
Quoted 6 lines · Pavel Roskin
Quoted 2 lines · Vladimir 'phcoder' Serbinenko

2) rename main to main,start,_start,__start,_main or __main. Just find one that works by bruteforce in script

We can use -Wl,--defsym,___main=0x8100 as it's done elsewhere in configure.ac.  Let me just check it doesn't break anything.

I'm ok with this one. I have no access to Apple's toolchain right now but it was reported to me it has a similar problem. There -Wl,--defsym,start=0x8100 -Wl,--defsym,_start=0x8100 should help. I'll tell tomorrow exactly

Quoted 11 lines

--
Regards,
Pavel Roskin

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#9 lore raw
In reply to Pavel Roskin
Quoted 4 lines · Pavel Roskin

We can use -Wl,--defsym,___main=0x8100 as it's done elsewhere in configure.ac. Let me just check it doesn't break anything.

This (r2310) works on Cygwin, thanks.

Signature · 2 lines
Regards,
Christian Franke