Skip to contentSkip to conversation

configure check for ld's --no-relax flag

RFC PATCH In review Stanislav Kholmanskikh 3 participants 8 messages Aug 1, 2014 – Sep 21, 2014

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 configure check for ld's --no-relax flag

Early versions of binutils doesn't support --no-relax flag, so commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building with such versions.

---
 conf/Makefile.common |    8 ++++++++
 configure.ac         |   10 ++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
conf/Makefile.common +8 -0
index e4c301f..5bda66f 100644
@@ -8,11 +8,19 @@ unexport LC_ALL
 # Platform specific options
 if COND_sparc64_ieee1275
   CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
   LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif
 endif
 if COND_sparc64_emu
   CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
   LDFLAGS_PLATFORM = -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -mno-relax
+endif
 endif
 if COND_arm
 if !COND_emu
configure.ac +10 -0
index 8888c2f..282fded 100644
@@ -516,6 +516,14 @@ fi
 
 TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
 
+AC_CACHE_CHECK([if the target C compiler supports -Wl,--no-relax], [grub_cv_target_cc_wl_no_relax_flag], [
+  LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
+
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+int main(void) { return 0; }
+]])], [grub_cv_target_cc_wl_no_relax_flag=yes], [grub_cv_target_cc_wl_no_relax_flag=no])
+])
+
 AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
   LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
 
@@ -1708,6 +1716,8 @@ AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
 
 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
 
+AM_CONDITIONAL([COND_LD_SUPPORTS_NO_RELAX], [test x$grub_cv_target_cc_wl_no_relax_flag = xyes])
+
 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
 AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
Signature · 1 line
1.7.1
#1 lore raw

В Fri, 1 Aug 2014 16:15:56 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 15 lines

Early versions of binutils doesn't support --no-relax flag, so commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building with such versions.

---
 conf/Makefile.common |    8 ++++++++
 configure.ac         |   10 ++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
conf/Makefile.common +0 -0
index e4c301f..5bda66f 100644

conf/Makefile.common unexport LC_ALL · line 15

Quoted 8 lines
conf/Makefile.common +4 -0
@@ -8,11 +8,19 @@ unexport LC_ALL
 # Platform specific options
 if COND_sparc64_ieee1275
   CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
   LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif

TBO I think commit should simply be reverted. "Uniformity" is rather poor excuse for breaking existing systems.

Quoted 39 lines
conf/Makefile.common +4 -0
 endif
 if COND_sparc64_emu
   CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
   LDFLAGS_PLATFORM = -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -mno-relax
+endif
 endif
 if COND_arm
 if !COND_emu
configure.ac +10 -0
index 8888c2f..282fded 100644
@@ -516,6 +516,14 @@ fi
 
 TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
 
+AC_CACHE_CHECK([if the target C compiler supports -Wl,--no-relax], [grub_cv_target_cc_wl_no_relax_flag], [
+  LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
+
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+int main(void) { return 0; }
+]])], [grub_cv_target_cc_wl_no_relax_flag=yes], [grub_cv_target_cc_wl_no_relax_flag=no])
+])
+
 AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
   LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
 
@@ -1708,6 +1716,8 @@ AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
 
 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
 
+AM_CONDITIONAL([COND_LD_SUPPORTS_NO_RELAX], [test x$grub_cv_target_cc_wl_no_relax_flag = xyes])
+
 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
 AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
#2 lore raw
Quoted 13 lines · Andrey Borzenkov

В Fri, 1 Aug 2014 16:15:56 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 10 lines

Early versions of binutils doesn't support --no-relax flag, so commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building with such versions.

---
 conf/Makefile.common |    8 ++++++++
 configure.ac         |   10 ++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
Quoted 17 lines

conf/Makefile.common unexport LC_ALL · line 15

Quoted 13 lines
conf/Makefile.common +4 -0
index e4c301f..5bda66f 100644
@@ -8,11 +8,19 @@ unexport LC_ALL
 # Platform specific options
 if COND_sparc64_ieee1275
   CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
   LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif

TBO I think commit should simply be reverted. "Uniformity" is rather poor excuse for breaking existing systems.

This commit is needed for clang to compile for sparc64. Given that sparc64 clang still doesn't really work I'm ok with reverting, at least for now.

Quoted 46 lines
Quoted 31 lines
conf/Makefile.common +4 -0
 endif
 if COND_sparc64_emu
   CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
   LDFLAGS_PLATFORM = -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -mno-relax
+endif
 endif
 if COND_arm
 if !COND_emu
configure.ac +8 -0
index 8888c2f..282fded 100644
@@ -516,6 +516,14 @@ fi
 
 TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
 
+AC_CACHE_CHECK([if the target C compiler supports -Wl,--no-relax], [grub_cv_target_cc_wl_no_relax_flag], [
+  LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
+
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+int main(void) { return 0; }
+]])], [grub_cv_target_cc_wl_no_relax_flag=yes], [grub_cv_target_cc_wl_no_relax_flag=no])
+])
+
 AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
   LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
 

configure.ac AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) · line 1723

Quoted 8 lines
configure.ac +2 -0
@@ -1708,6 +1716,8 @@ AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
 
 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
 
+AM_CONDITIONAL([COND_LD_SUPPORTS_NO_RELAX], [test x$grub_cv_target_cc_wl_no_relax_flag = xyes])
+
 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
 AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])

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

#3 lore raw

Hi!

Quoted 31 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 13 lines · Andrey Borzenkov

В Fri, 1 Aug 2014 16:15:56 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 10 lines

Early versions of binutils doesn't support --no-relax flag, so commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building with such versions.

---
  conf/Makefile.common |    8 ++++++++
  configure.ac         |   10 ++++++++++
  2 files changed, 18 insertions(+), 0 deletions(-)
Quoted 17 lines

conf/Makefile.common unexport LC_ALL · line 15

Quoted 13 lines
conf/Makefile.common +4 -0
index e4c301f..5bda66f 100644
@@ -8,11 +8,19 @@ unexport LC_ALL
  # Platform specific options
  if COND_sparc64_ieee1275
    CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
    LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif

TBO I think commit should simply be reverted. "Uniformity" is rather poor excuse for breaking existing systems.

Quoted 3 lines

This commit is needed for clang to compile for sparc64. Given that sparc64 clang still doesn't really work I'm ok with reverting, at least for now.

But, it this case, maybe it would be better to consider reviewing/applying this patch? Just to not return to this issue after some time?

Andrey, Vladimir, what do you think?

Thanks.

Quoted 55 lines
Quoted 34 lines
Quoted 34 lines
conf/Makefile.common +4 -0
  endif
  if COND_sparc64_emu
    CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
    LDFLAGS_PLATFORM = -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -mno-relax
+endif
  endif
  if COND_arm
  if !COND_emu
configure.ac +8 -0
index 8888c2f..282fded 100644
@@ -516,6 +516,14 @@ fi
 
  TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
 
+AC_CACHE_CHECK([if the target C compiler supports -Wl,--no-relax], [grub_cv_target_cc_wl_no_relax_flag], [
+  LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
+
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+int main(void) { return 0; }
+]])], [grub_cv_target_cc_wl_no_relax_flag=yes], [grub_cv_target_cc_wl_no_relax_flag=no])
+])
+
  AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
    LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
 
@@ -1708,6 +1716,8 @@ AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
 
  AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
 
Quoted 12 lines

configure.ac AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) · line 1723

Quoted 5 lines
configure.ac +2 -0
+AM_CONDITIONAL([COND_LD_SUPPORTS_NO_RELAX], [test x$grub_cv_target_cc_wl_no_relax_flag = xyes])
+
  AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
  AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
  AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])

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

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

#4 lore raw

В Mon, 04 Aug 2014 10:45:22 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 38 lines

Hi!

Quoted 31 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 13 lines · Andrey Borzenkov

В Fri, 1 Aug 2014 16:15:56 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 10 lines

Early versions of binutils doesn't support --no-relax flag, so commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building with such versions.

---
  conf/Makefile.common |    8 ++++++++
  configure.ac         |   10 ++++++++++
  2 files changed, 18 insertions(+), 0 deletions(-)
Quoted 17 lines

conf/Makefile.common unexport LC_ALL · line 15

Quoted 13 lines
conf/Makefile.common +4 -0
index e4c301f..5bda66f 100644
@@ -8,11 +8,19 @@ unexport LC_ALL
  # Platform specific options
  if COND_sparc64_ieee1275
    CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
    LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif

TBO I think commit should simply be reverted. "Uniformity" is rather poor excuse for breaking existing systems.

Quoted 3 lines

This commit is needed for clang to compile for sparc64. Given that sparc64 clang still doesn't really work I'm ok with reverting, at least for now.

Quoted 6 lines

But, it this case, maybe it would be better to consider reviewing/applying this patch? Just to not return to this issue after some time?

Andrey, Vladimir, what do you think?

Yes, commit message was pretty confusing. This leaves the question, whether combination of clang and binutils that do not support -Wl,--no-relax exists though :) Otherwise I agree, we should use this patch.

#5 lore raw
Quoted 45 lines · Andrey Borzenkov

В Mon, 04 Aug 2014 10:45:22 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 42 lines

Hi!

Quoted 31 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 13 lines · Andrey Borzenkov

В Fri, 1 Aug 2014 16:15:56 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 10 lines

Early versions of binutils doesn't support --no-relax flag, so commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building with such versions.

---
  conf/Makefile.common |    8 ++++++++
  configure.ac         |   10 ++++++++++
  2 files changed, 18 insertions(+), 0 deletions(-)
Quoted 17 lines

conf/Makefile.common unexport LC_ALL · line 15

Quoted 13 lines
conf/Makefile.common +4 -0
index e4c301f..5bda66f 100644
@@ -8,11 +8,19 @@ unexport LC_ALL
  # Platform specific options
  if COND_sparc64_ieee1275
    CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
    LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif

TBO I think commit should simply be reverted. "Uniformity" is rather poor excuse for breaking existing systems.

Quoted 3 lines

This commit is needed for clang to compile for sparc64. Given that sparc64 clang still doesn't really work I'm ok with reverting, at least for now.

But, it this case, maybe it would be better to consider reviewing/applying this patch? Just to not return to this issue after some time?

Quoted 8 lines
Quoted 2 lines

Andrey, Vladimir, what do you think?

Yes, commit message was pretty confusing. This leaves the question, whether combination of clang and binutils that do not support -Wl,--no-relax exists though :) Otherwise I agree, we should use this patch.

I think we could try to push for clang to have -mno-relax. They're usually pretty responsive and we'll probably need few fixes for few other clang problems anyway. For now I just reverted it. We'll see how clang sparc64 goes.

Quoted 5 lines

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

#6 lore raw

В Sun, 21 Sep 2014 19:03:08 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 49 lines · Andrey Borzenkov
Quoted 48 lines

В Mon, 04 Aug 2014 10:45:22 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 44 lines

Hi!

Quoted 31 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 13 lines · Andrey Borzenkov

В Fri, 1 Aug 2014 16:15:56 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 10 lines

Early versions of binutils doesn't support --no-relax flag, so commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building with such versions.

---
  conf/Makefile.common |    8 ++++++++
  configure.ac         |   10 ++++++++++
  2 files changed, 18 insertions(+), 0 deletions(-)
Quoted 17 lines

conf/Makefile.common unexport LC_ALL · line 15

Quoted 13 lines
conf/Makefile.common +4 -0
index e4c301f..5bda66f 100644
@@ -8,11 +8,19 @@ unexport LC_ALL
  # Platform specific options
  if COND_sparc64_ieee1275
    CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
    LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif

TBO I think commit should simply be reverted. "Uniformity" is rather poor excuse for breaking existing systems.

Quoted 3 lines

This commit is needed for clang to compile for sparc64. Given that sparc64 clang still doesn't really work I'm ok with reverting, at least for now.

But, it this case, maybe it would be better to consider reviewing/applying this patch? Just to not return to this issue after some time?

Andrey, Vladimir, what do you think?

Quoted 8 lines
Quoted 5 lines

Yes, commit message was pretty confusing. This leaves the question, whether combination of clang and binutils that do not support -Wl,--no-relax exists though :) Otherwise I agree, we should use this patch.

I think we could try to push for clang to have -mno-relax. They're usually pretty responsive and we'll probably need few fixes for few other clang problems anyway. For now I just reverted it.

Did you push it?

#7 lore raw
Quoted 57 lines · Andrei Borzenkov

В Sun, 21 Sep 2014 19:03:08 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 54 lines · Andrey Borzenkov
Quoted 53 lines

В Mon, 04 Aug 2014 10:45:22 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 38 lines

Hi!

Quoted 31 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 13 lines · Andrey Borzenkov

В Fri, 1 Aug 2014 16:15:56 +0400
Stanislav Kholmanskikh <[email protected]> пишет:

Quoted 10 lines

Early versions of binutils doesn't support --no-relax flag, so commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building with such versions.

---
  conf/Makefile.common |    8 ++++++++
  configure.ac         |   10 ++++++++++
  2 files changed, 18 insertions(+), 0 deletions(-)
Quoted 17 lines

conf/Makefile.common unexport LC_ALL · line 15

Quoted 13 lines
conf/Makefile.common +4 -0
index e4c301f..5bda66f 100644
@@ -8,11 +8,19 @@ unexport LC_ALL
  # Platform specific options
  if COND_sparc64_ieee1275
    CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
    LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif

TBO I think commit should simply be reverted. "Uniformity" is rather poor excuse for breaking existing systems.

Quoted 3 lines

This commit is needed for clang to compile for sparc64. Given that sparc64 clang still doesn't really work I'm ok with reverting, at least for now.

Quoted 6 lines

But, it this case, maybe it would be better to consider reviewing/applying this patch? Just to not return to this issue after some time?

Andrey, Vladimir, what do you think?

Yes, commit message was pretty confusing. This leaves the question, whether combination of clang and binutils that do not support -Wl,--no-relax exists though :) Otherwise I agree, we should use this patch.

Quoted 6 lines
Quoted 3 lines

I think we could try to push for clang to have -mno-relax. They're usually pretty responsive and we'll probably need few fixes for few other clang problems anyway. For now I just reverted it.

Did you push it?

Now yes. I was offline when I wrote this. My mail automatically sent this when I got online but git needed manual intervention.

Quoted 7 lines

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