* aclocal.m4: Add grub_CHECK_PIE. It check if the compiler
include -fPIE in the default specs.
* configure.ac: Check if pie_possible is yes and add -fno-PIE
to TARGET_CFLAGS.
Fix build with Apple's toolchain. Part 1
* commands/i386/pc/drivemap_int13h.S: use assembly-time constants
for long calls
* configure.ac: remove a leftover AC_MSG_RESULT
(CFLAGS): don't add -Wl,--defsym,___main=0x8100 when building with
Apple's toolchain
* configure.ac: Remove checks for __bswapsi2 and __bswapdi2,
they fail without libc headers for the target.
* include/grub/powerpc/libgcc.h: Use weak attribute for all
exports.
* include/grub/sparc64/libgcc.h: Likewise. Don't use
preprocessor conditionals.
Use objconv when compiling with Apple's CC
* conf/i386-pc.rmk (efiemu32.o): use OBJCONV if defined
(efiemu64.o): likewise
(efiemu64_c.o): omit -mcmodel=large and add -DAPPLE_CC=1
when compiling with Apple's CC
(efiemu64_s.o): likewise
* configure.ac: check for objconv when compiling with Apple's CC
* genmk.rb: use objconv for modules when compiled with Apple's CC
Allow a compilation without -mcmodel=large
* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB
when compiled without -mcmodel=large
(filter_memory_map): remove memory post 4 GiB when compiled
without -mcmodel=large
* configure.ac: fail gracefully and add -DMCMODEL_SMALL=1 to
TARGET_CFLAGS when -mcmodel=large isn't supported
Check if compiler is apple cc
* Makefile.in (ASFLAGS): new variable
(TARGET_ASFLAGS): likewise
(TARGET_MODULE_FORMAT): likewise
(TARGET_APPLE_CC): likewise
(OBJCONV): likewise
(TARGET_IMG_CFLAGS): likewise
(TARGET_CPPFLAGS): add includedir
* configure.ac: call grub_apple_cc and grub_apple_target_cc
(TARGET_IMG_LDFLAGS): Add -Wl,-Ttext,. All users updated
Check for linker script only if compiler isn't Apple's CC
(TARGET_MODULE_FORMAT): set
(TARGET_APPLE_CC): likewise
(TARGET_ASFLAGS): likewise
(ASFLAGS): likewise
Check for objcopy only if compiler isn't Apple's CC
Check for BSS symbol only if compiler isn't Apple's CC
* genmk.rb: adapt nm options if we use Apple's utils
* aclocal.m4 (grub_apple_cc): new test
(grub_apple_target_cc): likewise
* aclocal.m4 (grub_I386_CHECK_REGPARM_BUG): Remove.
* configure.ac: Don't call grub_I386_CHECK_REGPARM_BUG. Define
NESTED_FUNC_ATTR using AH_BOTTOM. Use regparm(1) only when
compiling for the i386 targets, but not for the utilities.
* Makefile.in (enable_efiemu): New variable.
* conf/i386-pc.rmk: Only compile efiemu runtimes when enable_efiemu is
set.
(efiemu32.o): Use macro $< for source file, add $(srcdir) to include
path.
(efi64_c.o): Use macro $< for source file, add $(srcdir) to include
path, add -mno-red-zone option.
(efiemu64_s.o): Likewise.
(efiemu64.o): Use macro $^ for source file.
* configure.ac (--enable-efiemu): New option.
* configure.ac: Change the logic when we check for target tools.
Do it when the target is specified and it's different from the
specified value of the host.
* util/hostdisk.c (read_device_map): Use grub_util_get_disk_size
instead of stat in mingw environment.
* util/misc.c (grub_millisleep): Use Sleep in mingw environment.
* aclocal.m4 (grub_CHECK_LINK_DIR): New function.
* configure.ac: Use grub_CHECK_LINK_DIR to determine whether to use
AC_CONFIG_LINKS.
Filter /etc/grub.d/10_* so that only add-ons for native kernels are
installed.
* Makefile.in (host_kernel): New variable.
* conf/common.rmk (grub-mkconfig_SCRIPTS): Conditionalize all 10_*.in
scripts instead of just the windows one.
* configure.ac: Initialize and AC_SUBST `host_kernel'.
* configure.ac: Only test -mcmodel=large option in x86_64-efi, also add
another option -mno-red-zone.
* commands/handler.c: Change module description.
* kern/handler.c: Add missing space at the end of description line.
* kern/list.c: Likewise.
* configure.ac: Change host_os to cygwin for mingw.
(asprintf): New check for function.
* include/grub/symbol.h: Replace #ifndef __CYGWIN__ with
#if ! defined (__CYGWIN__) && ! defined (__MINGW32__).
* include/grub/util/misc.h: #include <config.h> and <grub/types.h>,
declear asprintf if HAVE_ASPRINTF is not set, declear fseeko, ftello,
sync, sleep and grub_util_get_disk_size for mingw.
* util/biosdisk.c (grub_util_biosdisk_open): Use grub_util_get_disk_size
to get size in mingw.
(open_device): Use flag O_BINARY if it's defined.
(find_root_device): Add dummy code for mingw.
* util/grub-mkdevicemap.c (get_floppy_disk_name): Return 0 for mingw.
(get_ide_disk_name): Return //./PHYSICALDRIVE%d for mingw.
(get_scsi_disk_name): Return 0 for mingw.
* util/hostfs.c: #include <grub/util/misc.h>.
(grub_hostfs_open): Use "rb" flag to open file, use
grub_util_get_disk_size to get disk size for mingw.
* util/misc.c: #include <windows.h> and <winioctl.h> in mingw.
(asprintf): New function if HAVE_ASPRINTF is not set.
(sync): New function for mingw.
(sleep): Likewise.
(grub_util_get_disk_size): Likewise.
* Makefile.in: Add `target_os' and `enable_grub_pe2elf'.
* conf/common.rmk: Install `grub-pe2elf' only if requested.
Install `grub.d/10_windows' only on Cygwin.
* configure.ac: Add subst of `target_os'.
Check `target_os' also before setting TARGET_OBJ2ELF.
Add `--enable-grub-pe2elf'.
* common.rmk (bin_UTILITIES): Add grub-pe2elf.
(grub_pe2elf_SOURCES): New macro.
(CLEANFILES): Add grub-pe2elf.
* include/grub/efi/pe32.h (GRUB_PE32_SCN_ALIGN_1BYTES): New constant.
(GRUB_PE32_SCN_ALIGN_2BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_4BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_8BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_16BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_32BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_64BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_SHIFT): Likewise.
(GRUB_PE32_SCN_ALIGN_MASK): Likewise.
(GRUB_PE32_SYM_CLASS_EXTERNAL): Likewise.
(GRUB_PE32_SYM_CLASS_STATIC): Likewise.
(GRUB_PE32_SYM_CLASS_FILE): Likewise.
(GRUB_PE32_DT_FUNCTION): Likewise.
(GRUB_PE32_REL_I386_DIR32): Likewise.
(GRUB_PE32_REL_I386_REL32): Likewise.
(grub_pe32_symbol): New structure.
(grub_pe32_reloc): Likewise.
* util/grub-pe2elf.c: New file.
* configure.ac: Set TARGET_OBJ2ELF if host os is cygwin. Don't test for
start symbol in non pc platform.
* genmk.rb: Use TARGET_OBJ2ELF to convert native object format to elf.
The following patches are from Christian Franke.
* include/grub/dl.h: Remove .previous, gas supports this only
for ELF format.
* include/grub/symbol.h [__CYGWIN__] (#define FUNCTION/VARIABLE):
Remove .type, gas supports this only for ELF format.
* kern/dl.c (grub_dl_resolve_dependencies): Add check for trailing
nullbytes in symbol table. This fixes an infinite loop if table is
zero filled.
* Makefile.in: Add autoconf replacements TARGET_IMG_LDSCRIPT,
TARGET_IMG_LDFLAGS and EXEEXT.
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Replace -Wl,-N by
TARGET_IMG_LDFLAGS_AC.
(grub_CHECK_STACK_ARG_PROBE): New function.
* conf/i386-pc.rmk: Replace -Wl,-N by TARGET_IMG_LDFLAGS.
* conf/i386-pc-cygwin-ld-img.sc: New linker script.
* configure.ac: Add check for linker script "conf/${target}-img-ld.c"
to set TARGET_IMG_LD* accordingly.
Add check for Cygwin to set TARGET_MOD_OBJCOPY accordingly.
Add call to grub_CHECK_STACK_ARG_PROBE.
Use TARGET_IMG_LDFLAGS to check start, bss_start, end symbols.
* genkernsyms.sh.in: Handle HAVE_ASM_USCORE case.
* genmk.rb: Add EXEEXT to CLEANFILES.
* aclocal.m4 (grub_PROG_TARGET_CC): New macro. Check if the
target compiler is functional.
* configure.ac: Call grub_PROG_TARGET_CC once all target flags
are set up.
* configure.ac: Default to efi platform for x86_64-apple. Allow
powerpc64 CPU, default to ieee1275 platform for it. Split CPU
adjustments from the rest, only do them if target is not
explicitly given. Merge other adjustments with the final sanity
check. Remove an extraneous check for supported CPU. Be
specific which CPU and which platform is not supported.