Define functions explicitly rather than using --defsym in tests
whenever possible. Respect locality in remaining cases.
This commit is contained in:
parent
6a09d83e12
commit
37378f748a
3 changed files with 45 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-12-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Define functions explicitly rather than using --defsym in tests
|
||||
whenever possible. Respect locality in remaining cases.
|
||||
|
||||
2013-12-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/genmoddep.awk: Remove explicit getline < /dev/stdin.
|
||||
|
|
33
acinclude.m4
33
acinclude.m4
|
@ -19,6 +19,8 @@ AC_DEFUN([grub_PROG_TARGET_CC],
|
|||
AC_CACHE_VAL(grub_cv_prog_target_cc,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
asm (".globl start; start:");
|
||||
void __main (void);
|
||||
void __main (void) {}
|
||||
int main (void);
|
||||
]], [[]])],
|
||||
[grub_cv_prog_target_cc=yes],
|
||||
|
@ -288,7 +290,12 @@ AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
|
|||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING([if __bss_start is defined by the compiler])
|
||||
AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
asm (".globl start; start:");
|
||||
void __main (void);
|
||||
void __main (void) {}
|
||||
int main (void);
|
||||
]],
|
||||
[[asm ("incl __bss_start")]])],
|
||||
[grub_cv_check_uscore_uscore_bss_start_symbol=yes],
|
||||
[grub_cv_check_uscore_uscore_bss_start_symbol=no])])
|
||||
|
@ -297,7 +304,11 @@ AC_MSG_RESULT([$grub_cv_check_uscore_uscore_bss_start_symbol])
|
|||
|
||||
AC_MSG_CHECKING([if edata is defined by the compiler])
|
||||
AC_CACHE_VAL(grub_cv_check_edata_symbol,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
asm (".globl start; start:");
|
||||
void __main (void);
|
||||
void __main (void) {}
|
||||
int main (void);]],
|
||||
[[asm ("incl edata")]])],
|
||||
[grub_cv_check_edata_symbol=yes],
|
||||
[grub_cv_check_edata_symbol=no])])
|
||||
|
@ -306,7 +317,11 @@ AC_MSG_RESULT([$grub_cv_check_edata_symbol])
|
|||
|
||||
AC_MSG_CHECKING([if _edata is defined by the compiler])
|
||||
AC_CACHE_VAL(grub_cv_check_uscore_edata_symbol,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
asm (".globl start; start:");
|
||||
void __main (void);
|
||||
void __main (void) {}
|
||||
int main (void);]],
|
||||
[[asm ("incl _edata")]])],
|
||||
[grub_cv_check_uscore_edata_symbol=yes],
|
||||
[grub_cv_check_uscore_edata_symbol=no])])
|
||||
|
@ -330,7 +345,11 @@ AC_DEFUN([grub_CHECK_END_SYMBOL],
|
|||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING([if end is defined by the compiler])
|
||||
AC_CACHE_VAL(grub_cv_check_end_symbol,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
asm (".globl start; start:");
|
||||
void __main (void);
|
||||
void __main (void) {}
|
||||
int main (void);]],
|
||||
[[asm ("incl end")]])],
|
||||
[grub_cv_check_end_symbol=yes],
|
||||
[grub_cv_check_end_symbol=no])])
|
||||
|
@ -339,7 +358,11 @@ AC_MSG_RESULT([$grub_cv_check_end_symbol])
|
|||
|
||||
AC_MSG_CHECKING([if _end is defined by the compiler])
|
||||
AC_CACHE_VAL(grub_cv_check_uscore_end_symbol,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
asm (".globl start; start:");
|
||||
void __main (void);
|
||||
void __main (void) {}
|
||||
int main (void);]],
|
||||
[[asm ("incl _end")]])],
|
||||
[grub_cv_check_uscore_end_symbol=yes],
|
||||
[grub_cv_check_uscore_end_symbol=no])])
|
||||
|
|
18
configure.ac
18
configure.ac
|
@ -514,7 +514,12 @@ AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
|
|||
grub_cv_target_cc_w_extra_flags=
|
||||
for x in $EXTRA_WARN_FLAGS; do
|
||||
CFLAGS="$TARGET_CFLAGS $x -Werror"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
asm (".globl start; start:");
|
||||
void __main (void);
|
||||
void __main (void) {}
|
||||
int main (void);
|
||||
]], [[]])], [flag=1], [flag=0])
|
||||
if test x$flag = x1 ; then
|
||||
grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x"
|
||||
fi
|
||||
|
@ -959,7 +964,7 @@ CC="$TARGET_CC"
|
|||
if test "x$TARGET_APPLE_LINKER" = x1 ; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error"
|
||||
else
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
|
||||
fi
|
||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
|
||||
|
@ -973,10 +978,11 @@ LIBS="$TARGET_LIBGCC"
|
|||
grub_ASM_USCORE
|
||||
if test "x$TARGET_APPLE_LINKER" = x0 ; then
|
||||
if test x$grub_cv_asm_uscore = xyes; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,_abort=_main"
|
||||
DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main"
|
||||
else
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,abort=main"
|
||||
DEFSYM="-Wl,--defsym,abort=main -Wl,--defsym,_main=main -Wl,--defsym,__main=main"
|
||||
fi
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM"
|
||||
fi
|
||||
|
||||
# Check for libgcc symbols
|
||||
|
@ -985,7 +991,7 @@ AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _re
|
|||
if test "x$TARGET_APPLE_LINKER" = x1 ; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -static"
|
||||
else
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
||||
fi
|
||||
LIBS=""
|
||||
|
||||
|
@ -999,7 +1005,7 @@ if test "x$target_cpu" = xi386; then
|
|||
if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
|
||||
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
||||
# Check symbols provided by linker script.
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000 -Wl,--defsym,___main=0x8100"
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000"
|
||||
fi
|
||||
grub_CHECK_BSS_START_SYMBOL
|
||||
grub_CHECK_END_SYMBOL
|
||||
|
|
Loading…
Reference in a new issue