From d119a20ce545596702d07bb0477f25f06092c4d6 Mon Sep 17 00:00:00 2001 From: phcoder Date: Thu, 4 Jun 2009 20:40:51 +0000 Subject: [PATCH] 2009-06-04 Vladimir Serbinenko 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 --- ChangeLog | 16 ++++++++++++++++ efiemu/runtime/efiemu.c | 20 ++++++++++++++------ include/grub/dl.h | 8 ++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71193d1b4..fdf61bbda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2009-06-04 Vladimir Serbinenko + + 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 Vladimir Serbinenko Allow a compilation without -mcmodel=large diff --git a/efiemu/runtime/efiemu.c b/efiemu/runtime/efiemu.c index 71188130d..0316e4957 100644 --- a/efiemu/runtime/efiemu.c +++ b/efiemu/runtime/efiemu.c @@ -40,18 +40,23 @@ grub_efi_status_t efiemu_set_wakeup_time (grub_efi_boolean_t enabled, grub_efi_time_t *time); +#ifdef APPLE_CC +#define PHYSICAL_ATTRIBUTE __attribute__ ((section("_text-physical, _text-physical"))); +#else +#define PHYSICAL_ATTRIBUTE __attribute__ ((section(".text-physical"))); +#endif grub_efi_status_t efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size, grub_efi_uintn_t descriptor_size, grub_efi_uint32_t descriptor_version, grub_efi_memory_descriptor_t *virtual_map) - __attribute__ ((section(".text-physical"))); + PHYSICAL_ATTRIBUTE; grub_efi_status_t efiemu_convert_pointer (grub_efi_uintn_t debug_disposition, void **address) - __attribute__ ((section(".text-physical"))); + PHYSICAL_ATTRIBUTE; grub_efi_status_t efiemu_get_variable (grub_efi_char16_t *variable_name, @@ -84,17 +89,20 @@ EFI_FUNC (efiemu_set_virtual_address_map) (grub_efi_uintn_t, grub_efi_uintn_t, grub_efi_uint32_t, grub_efi_memory_descriptor_t *) - __attribute__ ((section(".text-physical"))); + PHYSICAL_ATTRIBUTE; grub_efi_status_t EFI_FUNC (efiemu_convert_pointer) (grub_efi_uintn_t debug_disposition, void **address) - __attribute__ ((section(".text-physical"))); + PHYSICAL_ATTRIBUTE; static grub_uint32_t efiemu_getcrc32 (grub_uint32_t crc, void *buf, int size) - __attribute__ ((section(".text-physical"))); + PHYSICAL_ATTRIBUTE; static void init_crc32_table (void) - __attribute__ ((section(".text-physical"))); + PHYSICAL_ATTRIBUTE; +static grub_uint32_t +reflect (grub_uint32_t ref, int len) + PHYSICAL_ATTRIBUTE; /* The log. It's used when examining memory dump diff --git a/include/grub/dl.h b/include/grub/dl.h index 55f5d4e22..894da1d33 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -40,11 +40,19 @@ grub_##name##_fini (void) { grub_mod_fini (); } \ static void \ grub_mod_fini (void) +#ifdef APPLE_CC +#define GRUB_MOD_NAME(name) \ +static char grub_modname[] __attribute__ ((section ("_modname, _modname"), used)) = #name; + +#define GRUB_MOD_DEP(name) \ +__asm__ (".section _moddeps, _moddeps\n.asciz \"" #name "\"\n") +#else #define GRUB_MOD_NAME(name) \ __asm__ (".section .modname\n.asciz \"" #name "\"\n") #define GRUB_MOD_DEP(name) \ __asm__ (".section .moddeps\n.asciz \"" #name "\"\n") +#endif struct grub_dl_segment {