From 5b1827527bf1dcd9f2953e86eb8a5dfaf363f28e Mon Sep 17 00:00:00 2001 From: mrs Date: Mon, 16 Oct 2006 19:53:29 +0000 Subject: * config/rs6000/darwin.h (SUBTARGET_OVERRIDE_OPTIONS): Add -mkernel support. (C_COMMON_OVERRIDE_OPTIONS): Add -mkernel support. Add SUBTARGET_C_COMMON_OVERRIDE_OPTIONS callout. (CC1_SPEC): Don't turn on -fPIC when -mkernel is given. (OS_MISSING_ALTIVEC): Add. * config/i386/i386.c (override_options): Add SUBSUBTARGET_OVERRIDE_OPTIONS callout. * config/i386/darwin.h (CC1_SPEC): Don't turn on -fPIC when -mkernel, -static or -mdynamic-no-pic is given. (C_COMMON_OVERRIDE_OPTIONS): Add. * config/darwin.opt (fapple-kext): Add. (mkernel): Add. * config/darwin.h (TARGET_OPTION_TRANSLATE_TABLE): Add -fapple-kext, -findirect-virtual-calls, -fterminated-vtables and -mkernel support. (SUBSUBTARGET_OVERRIDE_OPTIONS): Add. (SUBTARGET_C_COMMON_OVERRIDE_OPTIONS): Add. (CPP_SPEC): Move defines for __DYNAMIC__ and __STATIC__ from here... (SUBTARGET_ATTRIBUTE_TABLE): Add apple_kext_compatibility. (TARGET_CXX_CDTOR_RETURNS_THIS): Add. (flag_mkernel): Add. (flag_apple_kext): Add. (TARGET_KEXTABI): Add. * config/darwin.c (darwin_handle_kext_attribute): Add. (DARWIN_VTABLE_P): Add. (darwin_binds_local_p): Add partial support for rebinding vtables in kexts. (darwin_kextabi_p): Add. (darwin_override_options): Add. * config/darwin-protos.h (darwin_handle_kext_attribute): Add. (darwin_kextabi_p): Add. (darwin_override_options): Add. * config/darwin-c.c (darwin_cpp_builtins): ... move defines for __DYNAMIC__ and __STATIC__ here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117793 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/darwin.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'gcc/config/darwin.h') diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 050eec96175..21f909d4107 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -127,14 +127,18 @@ extern GTY(()) int darwin_ms_struct; { "-segs_read_write_addr", "-Zsegs_read_write_addr" }, \ { "-seg_addr_table", "-Zseg_addr_table" }, \ { "-seg_addr_table_filename", "-Zfn_seg_addr_table_filename" }, \ + { "-fapple-kext", "-fapple-kext -static -Wa,-static" }, \ { "-filelist", "-Xlinker -filelist -Xlinker" }, \ - { "-framework", "-Xlinker -framework -Xlinker" }, \ + { "-findirect-virtual-calls", "-fapple-kext" }, \ { "-flat_namespace", "-Zflat_namespace" }, \ { "-force_cpusubtype_ALL", "-Zforce_cpusubtype_ALL" }, \ { "-force_flat_namespace", "-Zforce_flat_namespace" }, \ + { "-framework", "-Xlinker -framework -Xlinker" }, \ + { "-fterminated-vtables", "-fapple-kext" }, \ { "-image_base", "-Zimage_base" }, \ { "-init", "-Zinit" }, \ { "-install_name", "-Zinstall_name" }, \ + { "-mkernel", "-mkernel -static -Wa,-static" }, \ { "-multiply_defined_unused", "-Zmultiplydefinedunused" }, \ { "-multiply_defined", "-Zmultiply_defined" }, \ { "-multi_module", "-Zmulti_module" }, \ @@ -143,6 +147,11 @@ extern GTY(()) int darwin_ms_struct; { "-unexported_symbols_list", "-Zunexported_symbols_list" }, \ SUBTARGET_OPTION_TRANSLATE_TABLE +#define SUBSUBTARGET_OVERRIDE_OPTIONS \ + do { \ + darwin_override_options (); \ + } while (0) + /* These compiler options take n arguments. */ #undef WORD_SWITCH_TAKES_ARG @@ -188,11 +197,24 @@ extern GTY(()) int darwin_ms_struct; !strcmp (STR, "dylinker_install_name") ? 1 : \ 0) +#define SUBTARGET_C_COMMON_OVERRIDE_OPTIONS do { \ + if (flag_mkernel || flag_apple_kext) \ + { \ + if (flag_use_cxa_atexit == 2) \ + flag_use_cxa_atexit = 0; \ + /* kexts should always be built without the coalesced sections \ + because the kernel loader doesn't grok such sections. */ \ + flag_weak = 0; \ + /* No RTTI in kexts. */ \ + flag_rtti = 0; \ + } \ + } while (0) + /* Machine dependent cpp options. Don't add more options here, add them to darwin_cpp_builtins in darwin-c.c. */ #undef CPP_SPEC -#define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC__}" +#define CPP_SPEC "" /* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus precomp, libtool, and fat build additions. Also we @@ -693,6 +715,8 @@ extern GTY(()) section * darwin_sections[NUM_DARWIN_SECTIONS]; /* Extra attributes for Darwin. */ #define SUBTARGET_ATTRIBUTE_TABLE \ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ \ + { "apple_kext_compatibility", 0, 0, false, true, false, \ + darwin_handle_kext_attribute }, \ { "weak_import", 0, 0, true, false, false, \ darwin_handle_weak_import_attribute } @@ -926,4 +950,11 @@ __enable_execute_stack (void *addr) \ (void) mprotect (page, end - page, 7); \ } +/* For Apple KEXTs, we make the constructors return this to match gcc + 2.95. */ +#define TARGET_CXX_CDTOR_RETURNS_THIS (darwin_kextabi_p) +extern int flag_mkernel; +extern int flag_apple_kext; +#define TARGET_KEXTABI flag_apple_kext + #endif /* CONFIG_DARWIN_H */ -- cgit v1.2.1