Commit Graph

62 Commits

Author SHA1 Message Date
Alexander Graf e0d32cca1d RISC-V: Add awareness for RISC-V reloations
This patch adds awareness of RISC-V relocations throughout the grub tools
as well as dynamic linkage and elf->PE relocation conversion support.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-02-25 11:34:09 +01:00
Daniel Kiper ee7808e219 dl: Add support for persistent modules
This type of modules cannot be unloaded. This is useful if a given
functionality, e.g. UEFI secure boot shim signature verification, should
not be disabled if it was enabled at some point in time. Somebody may
say that we can use standalone GRUB2 here. That is true. However, the
code is not so big nor complicated hence it make sense to support
modularized configs too.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
2018-11-09 13:25:31 +01:00
Vladimir Serbinenko 34fe0b5901 arm64: Add support for GOT and PCREL32 relocations. 2017-02-01 21:46:19 +01:00
Andrey Borzenkov f371dd5da8 fix include loop on MinGW due to libintl.h pulling stdio.h
In file included from ./include/grub/dl.h:23:0,
                 from grub-core/lib/libgcrypt-grub/cipher/rfc2268.c:3:
./include/grub/list.h:34:18: warning: conflicting types for 'grub_list_push' [en
abled by default]
 void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
                  ^
./include/grub/symbol.h:68:25: note: in definition of macro 'EXPORT_FUNC'
 # define EXPORT_FUNC(x) x
                         ^
In file included from ./include/grub/fs.h:30:0,
                 from ./include/grub/file.h:25,
                 from ./grub-core/lib/posix_wrap/stdio.h:23,
                 from c:\mingw\include\libintl.h:314,
                 from ./include/grub/i18n.h:33,
                 from ./include/grub/misc.h:27,
                 from ./include/grub/list.h:25,
                 from ./include/grub/dl.h:28,
                 from grub-core/lib/libgcrypt-grub/cipher/rfc2268.c:3:
./include/grub/partition.h:106:3: note: previous implicit declaration of 'grub_l
ist_push' was here
   grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
   ^
list.h needs just ATTRIBUTE_ERROR from misc.h; split compiler features
into separate file grub/compiler.h and include it instead.
2014-01-18 21:22:57 +04:00
Vladimir Serbinenko 7a148da6dd Implement sparc64 trampolines (needed for sparc64-emu). 2013-12-10 00:01:27 +01:00
Vladimir Serbinenko a19293cb75 Move OS-dependent mprotect for module loading to grub-core/osdep/*/dl.c
and implement windows variant.
2013-12-08 18:08:23 +01:00
Vladimir Serbinenko 8c534b85f1 Revamp relocation handling.
Move more code to common dl.c. Add missing veneers for arm and arm64.
	Decreases kernel size by 70 bytes on i386-pc (40-50 compressed)
2013-12-06 09:18:55 +01:00
Vladimir Serbinenko ce55ed0389 Remove leftover GRUB_IA64_DL_TRAMP_SIZE. 2013-11-30 11:14:30 +01:00
Vladimir Serbinenko 4906052019 Unify GOT/trampoline handling between PPC, MIPS and IA64 as they
do essentially the same thing, do it in similar way.
2013-11-21 21:54:33 +01:00
Vladimir Serbinenko af81ed880d * conf/Makefile.common (CPPFLAGS_KERNEL): Add -DGRUB_KERNEL=1.
* include/grub/dl.h (GRUB_MOD_INIT), (GRUB_MOD_FINI): Define
	functions when compiling for kernel.
2013-10-25 16:07:01 +02:00
Vladimir 'phcoder' Serbinenko f4ccf29dd5 * include/grub/dl.h: Remove double declaration of GRUB_MOD_DEP.
Use __unused__ rather than __used__ on gcc < 3.2.
2013-10-18 16:41:50 +02:00
Vladimir 'phcoder' Serbinenko 7cd0df84f1 New command `nativedisk'. 2013-04-28 15:31:33 +02:00
Vladimir 'phcoder' Serbinenko c4b7e58882 * include/grub/dl.h: Switch from APPLE_CC to __APPLE__.
(GRUB_MOD_LICENSE) [ASM_FILE]: Make into macro. All users updated.
2012-02-29 14:51:09 +01:00
Vladimir 'phcoder' Serbinenko c36e5cd162 Remove any awareness of *.c util files about target.
* Makefile.util.def (grub-setup): Split to ...
	(grub-bios-setup): ... and this.
	(grub-sparc64-setup): ... and this.
	* configure.ac: Don't add machine_CPPFLAGS into HOST_CPPFLAGS.
	* docs/man/grub-setup.h2m: Split into ...
	* docs/man/grub-sparc64-setup.h2m: ... this.
	* docs/man/grub-bios-setup.h2m: ... and this.
	* include/grub/dl.h (grub_dl) [GRUB_UTIL]: Remove struct.
	* include/grub/elf.h (Elf_*) [GRUB_UTIL]: Remove types.
	(GRUB_TARGET_WORDSIZE) [GRUB_UTIL]: Remove.
	(grub_target_addr_t): Remove.
	(grub_target_size_t): Remove.
	(grub_target_ssize_t): Remove.
	* util/grub-install.in: Use new grub-*-setup.
	* util/grub-mkimagexx.c (Elf_Word): New define.
	(Elf_Half): Likewise.
	(Elf_Section): Likewise.
	(ELF_ST_TYPE): Likewise.
	* util/grub-setup.c: Switch from GRUB_MACHINE_SPARC64 to
	GRUB_SETUP_SPARC64 and from GRUB_MACHINE_PCBIOS to GRUB_SETUP_BIOS.
2012-02-27 14:24:22 +01:00
Vladimir 'phcoder' Serbinenko 036985b8ce Remove grub_{modname}_init and grub_{modname}_fini. They should never
be used directly if it's really a module and GRUB_MOD_INIT shouldn't
	be used on non-modules.

	* grub-core/commands/boot.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]:
	Rename to grub_boot_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_boot_fini.
	* grub-core/commands/keylayouts.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_fini.
	* grub-core/font/font_cmd.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_font_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_font_fini.
	* grub-core/kern/mips/loongson/init.c: Replace explicit protos with
	includes.
	(grub_machine_init): Remove empty inits.
	* grub-core/kern/mips/qemu_mips/init.c: Replace explicit protos with
	includes.
	(grub_machine_init): Remove empty inits.
	* grub-core/term/arc/console.c: Remove explicit proto.
	* grub-core/term/at_keyboard.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_at_keyboard_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_at_keyboard_fini.
	* grub-core/term/gfxterm.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_gfxterm_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_gfxterm_fini.
	* grub-core/term/i386/pc/vga_text.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_vgatext_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_vgatext_fini.
	* grub-core/term/ieee1275/console.c: Remove explicit proto.
	* grub-core/term/serial.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_serial_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_serial_fini.
	* grub-core/term/terminfo.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_terminfo_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_terminfo_fini.
	* grub-core/video/bitmap.c (GRUB_MOD_INIT): Removed.
	(GRUB_MOD_FINI): Likewise.
	* grub-core/video/radeon_fuloong2e.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_radeon_fuloong2e_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_radeon_fuloong2e_fini.
	* grub-core/video/sis315pro.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_sis315pro_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_sis315pro_fini.
	* grub-core/video/sm712.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_sm712_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_sm712_fini.
	* include/grub/at_keyboard.h (grub_at_keyboard_init): New proto.
	(grub_at_keyboard_fini): Likewise.
	* include/grub/dl.h (GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]:
	Don't declare grub_{modname}_init.
	(GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]: Don't declare grub_{modname}_fini.
	* include/grub/keyboard_layouts.h (grub_keylayouts_init) [!EMU]:
	New proto.
	(grub_keylayouts_fini) [!EMU]: Likewise.
	* include/grub/serial.h (grub_serial_init) [!EMU]:
	New proto.
	(grub_serial_fini) [!EMU]: Likewise.
	* include/grub/terminfo.h (grub_terminfo_init) [!EMU]:
	New proto.
	(grub_terminfo_fini) [!EMU]: Likewise.
	* include/grub/video.h (grub_font_init) [!EMU]:
	New proto.
	(grub_font_fini) [!EMU]: Likewise.
	(grub_gfxterm_init) [!EMU]: Likewise.
	(grub_gfxterm_fini) [!EMU]: Likewise.
	(grub_video_sm712_init) [!EMU]: Likewise.
	(grub_video_sm712_fini) [!EMU]: Likewise.
	(grub_video_sis315pro_init) [!EMU]: Likewise.
	(grub_video_sis315pro_fini) [!EMU]: Likewise.
	(grub_video_radeon_fuloong2e_init) [!EMU]: Likewise.
	(grub_video_radeon_fuloong2e_fini) [!EMU]: Likewise.
2012-02-27 00:28:45 +01:00
Vladimir 'phcoder' Serbinenko d87893d5dc * include/grub/dl.h (grub_dl_load_file): Don't export. 2012-02-26 23:44:39 +01:00
Vladimir 'phcoder' Serbinenko b50787de09 * include/grub/dl.h (GRUB_ARCH_DL_TRAMP_SIZE) [__ia64__]: Add back
forgotten define.
	(GRUB_ARCH_DL_GOT_ALIGN) [__ia64__]: Redefine in terms of
	GRUB_IA64_DL_GOT_ALIGN.
	(GRUB_ARCH_DL_TRAMP_ALIGN) [__ia64__]: Redefine in terms of
	GRUB_IA64_DL_TRAMP_ALIGN.
2011-11-12 00:26:04 +01:00
Vladimir 'phcoder' Serbinenko ed64e9e279 Support trampoline jumps on powerpc.
* grub-core/kern/dl.c (grub_dl_load_segments) [__powerpc__]: Follow
	__ia64__ path.
	(grub_dl_load_segments): Set mod->sz.
	(grub_dl_flush_cache): Flush whole space occupied by module, not just
	segments.
	* grub-core/kern/ia64/dl.c (nopm): Make const while on it.
	(jump): Likewise.
	* grub-core/kern/powerpc/dl.c (grub_arch_dl_get_tramp_got_size): New
	function.
	(trampoline): New struct.
	(trampoline_template): New const.
	(grub_arch_dl_relocate_symbols): Create trampolines on overflow.
	* include/grub/dl.h (grub_dl): Add sz element.
	[__powerpc__]: Follow __ia64__.
	(GRUB_ARCH_DL_TRAMP_ALIGN): Define on ppc.
	(GRUB_ARCH_DL_GOT_ALIGN): Likewise.
	(GRUB_ARCH_DL_TRAMP_SIZE): Likewise.
	(grub_arch_dl_get_tramp_got_size) [__powerpc__]: New proto.
2011-11-08 11:23:56 +01:00
Vladimir 'phcoder' Serbinenko 005dd67cb6 * grub-core/disk/ahci.c: Add missing license statements.
* grub-core/fs/romfs.c: Likewise.
	* grub-core/lib/ia64/setjmp.S: Likewise.
	* grub-core/loader/i386/pc/freedos.c: Likewise.
	* grub-core/loader/ia64/efi/linux.c: Likewise.
	* grub-core/video/colors.c: Likewise.
	* include/grub/dl.h (GRUB_MOD_DEP): New macro.
2011-06-24 00:29:21 +02:00
Tristan Gingold 32297d5ff7 IA64 support.
* Makefile.util.def (libgrubmods.a): Add grub-core/kern/ia64/dl_helper.c
	* configure.ac: Add ia64-efi target.
	Probe for __ia64_trampoline, __udivsi3, __umoddi3, __udivdi3,
	__divsi3, __modsi3, __umodsi3, __moddi3 and __divdi3 symbols.
	* gentpl.py: Add ia64_efi platform.
	Rename x86_efi to efi and Add ia64-efi. All users updated.
	* grub-core/Makefile.am: Set KERNEL_HEADER_FILES for ia64-efi.
	* grub-core/Makefile.core.def (kernel.img): Add compile flags for ia64.
	Remove kern/generic/rtc_get_time_ms.c on EFI.
	Add kern/ia64/efi/startup.S, kern/ia64/efi/init.c, kern/ia64/dl.c,
	kern/ia64/dl_helper.c on ia64-efi.
	Add kern/emu/cache.c on emu.
	(linux): Use on loader/ia64/efi/linux.c on ia64.
	* grub-core/gensymlist.sh (grub_register_exported_symbols): Check
	whether symbol is a function.
	* grub-core/kern/dl.c [GRUB_MACHINE_EMU]: Include sys/mman.h.
	(grub_symbol): New field 'isfunc'.
	(grub_dl_resolve_symbol): Return whole symbol rather than just address.
	(grub_dl_register_symbol): New argument 'isfunc'. All users updated.
	(grub_dl_load_segments): Place all sections into the same region.
	[__ia64__]: Create trampolines and got.
	[GRUB_MACHINE_EMU]: Call mprotect.
	(grub_dl_resolve_symbols): Resolve symbol type as well.
	[__ia64__]: Create function descriptors.
	* grub-core/kern/efi/efi.c (grub_get_rtc): Renamed to ...
	(grub_rtc_get_time_ms): ... this. Expressions simplified.
	(grub_get_rtc): New function.
	* grub-core/kern/emu/cache.c [__ia64__]: New file.
	* grub-core/kern/emu/cache.S: Renamed to ...
	* grub-core/kern/emu/cache_s.S: ... this.
	[__ia64__]: Add a nop.
	* grub-core/kern/emu/full.c (grub_arch_dl_get_tramp_got_size)
	[__ia64__]: New function.
	* grub-core/kern/emu/lite.c [__ia64__]: Include ../ia64/dl.c.
	* grub-core/kern/ia64/dl.c: New file.
	* grub-core/kern/ia64/dl_helper.c: Likewise.
	* grub-core/kern/ia64/efi/init.c: New file.
	* grub-core/kern/ia64/efi/startup.S: Likewise.
	* grub-core/lib/efi/halt.c [__ia64__]: Don't try acpi.
	* grub-core/lib/ia64/longjmp.S: New file (from glibc).
	* grub-core/lib/ia64/setjmp.S: Likewise (from glibc).
	* grub-core/lib/setjmp.S [__ia64__]: Include ./ia64/setjmp.S.
	* grub-core/loader/ia64/efi/linux.c: New file.
	* include/grub/dl.h (GRUB_MOD_NAME): Redefined using C rather than asm.
	(GRUB_MOD_DEP): Likewise.
	(grub_dl) [__ia64__]: New fields got and tramp.
	(grub_dl): New field 'base'.
	(grub_dl_register_symbol): New argument isfunc. All users updated.
	(GRUB_IA64_DL_TRAMP_ALIGN): New definition.
	(GRUB_IA64_DL_TRAMP_SIZE): Likewise.
	(GRUB_IA64_DL_GOT_ALIGN): Likewise.
	(grub_ia64_dl_get_tramp_got_size): New proto.
	(GRUB_ARCH_DL_TRAMP_ALIGN) [__ia64__]: Likewise
	(GRUB_ARCH_DL_GOT_ALIGN) [__ia64__]: Likewise
	(grub_arch_dl_get_tramp_got_size) [__ia64__]: Likewise
	* include/grub/efi/api.h: Skip call wrappers on ia64.
	* include/grub/efi/pe32.h (GRUB_PE32_MACHINE_IA64): New definition.
	* include/grub/efi/time.h (GRUB_TICKS_PER_SECOND): Change to 1000.
	* include/grub/elf.h (ELF_ST_INFO): New definition.
	* include/grub/ia64/efi/kernel.h: New file.
	* include/grub/ia64/efi/memory.h: Likewise.
	* include/grub/ia64/efi/time.h: Likewise.
	* include/grub/ia64/kernel.h: Likewise.
	* include/grub/ia64/setjmp.h: Likewise (from glibc).
	* include/grub/ia64/time.h: New file.
	* include/grub/ia64/types.h: Likewise.
	* include/grub/libgcc.h (__udivsi3, __umodsi3, __umoddi3, __udivdi3,
	__moddi3, __divdi3, __divsi3, __modsi3, __ia64_trampoline):
	New protos.
	* include/grub/offsets.h (GRUB_KERNEL_IA64_EFI_PREFIX): New definition.
	(GRUB_KERNEL_IA64_EFI_PREFIX_END): Likewise.
	* include/grub/types.h (PRIxGRUB_ADDR): Likewise.
	* util/grub-mkimage.c (image_target_desc): New field pe_target.
	All users updated.
	(EFI64_HEADER_SIZE): New definition. All users updated.
	(image_targets): Add ia64-efi.
	* util/grub-mkimagexx.c (relocate_symbols): New arguments jumpers and
	jumpers_addr. All users updated.
	Create function descriptors.
	(count_funcs): New function.
	(unaligned_uint32): New struct.
	(MASK20): New definition.
	(MASK19): Likewise.
	(MASKF21): Likewise.
	(add_value_to_slot_20b): New function.
	(add_value_to_slot_21_real): Likewise.
	(add_value_to_slot_21): Likewise.
	(ia64_kernel_trampoline): New struct.
	(nopm): New variable.
	(jump): Likewise.
	(make_trampoline): New function.
	(relocate_addresses): Handle ia64.
	(make_reloc_section): Likewise.
	(load_image): Likewise.

	Also-By: Robert Millan <rmh.grub@aybabtu.com>

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2011-05-15 11:22:59 +02:00
Vladimir 'phcoder' Serbinenko 7b58e65f24 track function symbols 2011-05-08 18:29:37 +02:00
Vladimir 'phcoder' Serbinenko 5452733f35 more or less functional ia64 grub-mkimage 2011-05-08 12:39:08 +02:00
Vladimir 'phcoder' Serbinenko d97e7b5935 * include/grub/dl.h [ASM_FILE]: Adapt for assembly.
* grub-core/lib/i386/setjmp.S: Add missing GRUB_MOD_LICENSE.
	* grub-core/lib/x86_64/setjmp.S: Likewise.
	* grub-core/lib/mips/setjmp.S: Likewise.
	* grub-core/lib/powerpc/setjmp.S: Likewise.
	* grub-core/lib/sparc64/setjmp.S: Likewise.
2011-04-20 01:37:48 +02:00
Vladimir 'phcoder' Serbinenko e745cf0ca6 Implement automatic module license checking according to new GNU
guidelines.

	* grub-core/kern/dl.c (grub_dl_check_license): New function.
	(grub_dl_load_core): Use grub_dl_check_license.
	* include/grub/dl.h (GRUB_MOD_SECTION): New macro.
	(GRUB_MOD_LICENSE): Likewise.
	(GRUB_MOD_DUAL_LICENSE): Likewise.
	All modules updated.
2011-04-11 23:01:51 +02:00
Vladimir 'phcoder' Serbinenko 0718f66d12 Discard a bunch of junk code 2011-01-03 00:56:28 +01:00
phcoder 5faa440cb0 Discard several spurious differences from mainline 2011-01-03 00:47:21 +01:00
Vladimir 'phcoder' Serbinenko 7edf63fce6 merge ia64-emu into ia64 2011-01-02 23:55:50 +01:00
phcoder f49157dfe5 Restructure module loading and many fixes. Now normal.mod loads successfully 2011-01-02 23:30:25 +01:00
phcoder 73911575dd support for registering functions from modules (not tested yet) 2011-01-02 14:58:57 +01:00
phcoder f9c30af6d0 Succesfully loaded return-only module on ia64-emu 2011-01-02 14:09:58 +01:00
Vladimir 'phcoder' Serbinenko 07329a9ac9 Fix some compilation problems 2010-09-01 09:44:32 +02:00
Vladimir 'phcoder' Serbinenko 6585de4c0c merge mainline into ia64 2010-08-31 21:47:26 +02:00
Vladimir 'phcoder' Serbinenko 89e07694dc Remove grub_dl_unload_all. It's unnecessary and causes trouble 2010-08-25 21:19:45 +02:00
BVK Chaitanya 6304d29255 working copy, wo nested packaging 2010-08-17 19:03:22 +05:30
BVK Chaitanya 8c41176882 automake commit without merge history 2010-05-06 11:34:04 +05:30
Vladimir 'phcoder' Serbinenko f38873b80b Build system support for grub-emu modules 2010-02-07 15:17:26 +01:00
Vladimir 'phcoder' Serbinenko 2083672af1 Remove -DGRUB_UTIL when compiling grub-emu 2010-02-07 04:23:44 +01:00
Vladimir 'phcoder' Serbinenko a4bced7752 2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/dl.h (grub_dl_register_symbol): Don't export.
2010-02-07 00:40:17 +01:00
Robert Millan e68d3b243f Resync with trunk 2010-01-18 15:02:21 +00:00
Robert Millan 2c40cc7868 Import Tristan Gingold's ia64 port
(based on patch sent to grub-devel by Tristan in 2008-01-28)
2010-01-18 14:17:47 +00:00
Vladimir 'phcoder' Serbinenko 035a008c13 Remove leftover 2009-12-02 11:44:29 +01:00
Vladimir 'phcoder' Serbinenko 6abdf8e20d Fix for native miscompilation 2009-11-21 17:33:52 +01:00
proski f76ce8896a 2009-07-21 Pavel Roskin <proski@gnu.org>
* kern/dl.c (grub_dl_check_header): Make static.
2009-07-21 20:18:44 +00:00
proski c8d229882a 2009-07-01 Pavel Roskin <proski@gnu.org>
* kern/dl.c (grub_dl_resolve_symbol): Make static.
	* include/grub/dl.h: Remove grub_dl_resolve_symbol().
2009-07-01 16:00:34 +00:00
robertmh 8231fb77c6 2009-06-27 Pavel Roskin <proski@gnu.org>
2009-06-27  Robert Millan  <rmh.grub@aybabtu.com>

        * include/grub/dl.h: Include grub/elf.h.
        (struct grub_dl): Add symtab field.
        * kern/dl.c [GRUB_MACHINE_QEMU]: Define
        GRUB_MODULES_MACHINE_READONLY.
        (grub_dl_resolve_symbols): Populate mod->symtab, making a copy
        of the header for read-only modules.
        (grub_dl_unload): Free mod->symtab for read-only modules.
        * kern/i386/dl.c: Use mod->symtab.
        * kern/powerpc/dl.c: Likewise.
        * kern/sparc64/dl.c: Likewise.
        * kern/x86_64/dl.c: Likewise.

        * conf/i386-qemu.rmk: New file.
        * kern/i386/qemu/startup.S: Likewise.
        * kern/i386/qemu/mmap.c: Likewise.
        * boot/i386/qemu/boot.S: Likewise.
        * include/grub/i386/qemu/time.h: Likewise.
        * include/grub/i386/qemu/serial.h: Likewise.
        * include/grub/i386/qemu/kernel.h: Likewise.
        * include/grub/i386/qemu/console.h: Likewise.
        * include/grub/i386/qemu/boot.h: Likewise.
        * include/grub/i386/qemu/init.h: Likewise.
        * include/grub/i386/qemu/machine.h: Likewise.
        * include/grub/i386/qemu/loader.h: Likewise.
        * include/grub/i386/qemu/memory.h: Likewise.

        * conf/i386-coreboot.rmk (GRUB_BOOT_MACHINE_LINK_ADDR)
        (GRUB_KERNEL_MACHINE_LINK_ADDR): New variables.
        [qemu] (pkglib_IMAGES): Add `boot.img'.
        [qemu] (boot_img_SOURCES, boot_img_ASFLAGS, boot_img_LDFLAGS)
        [qemu] (boot_img_FORMAT): New variables.
        [qemu] (bin_UTILITIES): Add `grub-mkimage'.
        [qemu] (grub_mkimage_SOURCES, grub_mkimage_CFLAGS): New variables.
        [qemu] (kernel_img_SOURCES, kernel_img_HEADERS, kernel_img_CFLAGS)
        [qemu] (kernel_img_ASFLAGS, kernel_img_LDFLAGS)
        [qemu] (kernel_img_FORMAT): New variables.

        * configure.ac: Recognise `i386-qemu'.

        * util/i386/pc/grub-mkimage.c (compress_kernel): Add dummy variant
        (for no compression).
        [GRUB_MACHINE_QEMU] (generate_image): Misc adjustments to produce
        a valid i386 ROM image.  Make `GRUB_KERNEL_MACHINE_COMPRESSED_SIZE',
        `GRUB_KERNEL_MACHINE_INSTALL_DOS_PART' and
        `GRUB_KERNEL_MACHINE_INSTALL_BSD_PART' optional features (with
        ifdefs).
2009-06-27 11:18:10 +00:00
phcoder d119a20ce5 2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
Define segment as well as section when compiling with
	Apple's CC

	* efiemu/runtime/efiemu.c (PHYSICAL_ATTRIBUTE): new definition
	(efiemu_set_virtual_address_map): declare with PHYSICAL_ATTRIBUTE
	(efiemu_convert_pointer): likewise
	(efiemu_set_virtual_address_map): likewise
	(efiemu_convert_pointer): likewise
	(efiemu_getcrc32): likewise
	(init_crc32_table): likewise
	(reflect): likewise
	* include/grub/dl.h (GRUB_MOD_NAME): define segment with Apple's CC
	(GRUB_MOD_DEP): likewise
2009-06-04 20:40:51 +00:00
phcoder 5389763d12 2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
Use .asciz instead of .string

	* i386/pc/diskboot.S: use .asciz instead of .string
	* i386/pc/boot.S: likewise
	* include/grub/dl.h (GRUB_MOD_DEP): likewise
	(GRUB_MOD_NAME): likewise
2009-06-04 19:28:02 +00:00
proski 119494b506 2009-05-05 Pavel Roskin <proski@gnu.org>
* include/grub/dl.h [GRUB_UTIL]: Provide inline implementations
	of grub_dl_ref() and grub_dl_unref().
	* commands/parttool.c: Remove preprocessor conditionals around
	grub_dl_ref() and grub_dl_unref().
	* fs/affs.c: Likewise.
	* fs/afs.c: Likewise.
	* fs/cpio.c: Likewise.
	* fs/ext2.c: Likewise.
	* fs/fat.c: Likewise.
	* fs/hfs.c: Likewise.
	* fs/hfsplus.c: Likewise.
	* fs/iso9660.c: Likewise.
	* fs/jfs.c: Likewise.
	* fs/minix.c: Likewise.
	* fs/ntfs.c: Likewise.
	* fs/reiserfs.c: Likewise.
	* fs/sfs.c: Likewise.
	* fs/udf.c: Likewise.
	* fs/ufs.c: Likewise.
	* fs/xfs.c: Likewise.
	* include/grub/dl.h: Likewise.
	* loader/xnu.c: Likewise.
2009-05-05 16:36:58 +00:00
robertmh f36cc10867 2009-01-10 Robert Millan <rmh@aybabtu.com>
Update a few copyright years which we forgot to do in 2008 (only for
            files whose changes made in 2008 were copyright-significant)

            * Makefile.in: Add 2008 to Copyright line.
            * disk/ieee1275/ofdisk.c: Likewise.
            * disk/efi/efidisk.c: Likewise.
            * kern/dl.c: Likewise.
            * kern/sparc64/ieee1275/init.c: Likewise.
            * kern/mm.c: Likewise.
            * kern/efi/mm.c: Likewise.
            * boot/i386/pc/boot.S: Likewise.
            * genfslist.sh: Likewise.
            * fs/iso9660.c: Likewise.
            * fs/hfs.c: Likewise.
            * fs/jfs.c: Likewise.
            * fs/minix.c: Likewise.
            * fs/ufs.c: Likewise.
            * gensymlist.sh.in: Likewise.
            * genkernsyms.sh.in: Likewise.
            * include/grub/misc.h: Likewise.
            * include/grub/types.h: Likewise.
            * include/grub/symbol.h: Likewise.
            * include/grub/elf.h: Likewise.
            * include/grub/kernel.h: Likewise.
            * include/grub/disk.h: Likewise.
            * include/grub/dl.h: Likewise.
            * include/grub/i386/linux.h: Likewise.
            * include/grub/i386/pc/biosdisk.h: Likewise.
            * include/grub/efi/api.h: Likewise.
            * include/grub/efi/pe32.h: Likewise.
            * include/grub/util/misc.h: Likewise.
            * normal/execute.c: Likewise.
            * normal/arg.c: Likewise.
            * normal/completion.c: Likewise.
            * normal/lexer.c: Likewise.
            * normal/parser.y: Likewise.
            * normal/misc.c: Likewise.
            * commands/i386/pc/vbeinfo.c: Likewise.
            * commands/hexdump.c: Likewise.
            * commands/terminal.c: Likewise.
            * commands/ls.c: Likewise.
            * commands/help.c: Likewise.
            * partmap/pc.c: Likewise.
            * loader/efi/chainloader.c: Likewise.
            * loader/multiboot_loader.c: Likewise.
            * loader/i386/pc/multiboot2.c: Likewise.
            * term/efi/console.c: Likewise.
            * term/i386/pc/serial.c: Likewise.
            * util/lvm.c: Likewise.
            * util/console.c: Likewise.
            * util/i386/efi/grub-mkimage.c: Likewise.
            * util/raid.c: Likewise.
2009-01-10 13:07:44 +00:00
bean 2a8a80e4f4 2008-07-24 Bean <bean123ch@gmail.com>
* 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.
2008-07-24 14:56:30 +00:00