Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/darwin.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Functions for generic Darwin as target machine for GNU C compiler. | 1 /* Functions for generic Darwin as target machine for GNU C compiler. |
2 Copyright (C) 1989-2017 Free Software Foundation, Inc. | 2 Copyright (C) 1989-2018 Free Software Foundation, Inc. |
3 Contributed by Apple Computer Inc. | 3 Contributed by Apple Computer Inc. |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify | 7 GCC is free software; you can redistribute it and/or modify |
15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
18 along with GCC; see the file COPYING3. If not see | 18 along with GCC; see the file COPYING3. If not see |
19 <http://www.gnu.org/licenses/>. */ | 19 <http://www.gnu.org/licenses/>. */ |
20 | |
21 #define IN_TARGET_CODE 1 | |
20 | 22 |
21 #include "config.h" | 23 #include "config.h" |
22 #include "system.h" | 24 #include "system.h" |
23 #include "coretypes.h" | 25 #include "coretypes.h" |
24 #include "backend.h" | 26 #include "backend.h" |
820 if (! MACHOPIC_INDIRECT) | 822 if (! MACHOPIC_INDIRECT) |
821 return orig; | 823 return orig; |
822 | 824 |
823 /* First handle a simple SYMBOL_REF or LABEL_REF */ | 825 /* First handle a simple SYMBOL_REF or LABEL_REF */ |
824 if (GET_CODE (orig) == LABEL_REF | 826 if (GET_CODE (orig) == LABEL_REF |
825 || (GET_CODE (orig) == SYMBOL_REF | 827 || GET_CODE (orig) == SYMBOL_REF) |
826 )) | |
827 { | 828 { |
828 /* addr(foo) = &func+(foo-func) */ | 829 /* addr(foo) = &func+(foo-func) */ |
829 orig = machopic_indirect_data_reference (orig, reg); | 830 orig = machopic_indirect_data_reference (orig, reg); |
830 | 831 |
831 if (GET_CODE (orig) == PLUS | 832 if (GET_CODE (orig) == PLUS |
1020 else | 1021 else |
1021 { | 1022 { |
1022 return pic_ref; | 1023 return pic_ref; |
1023 } | 1024 } |
1024 } | 1025 } |
1025 | |
1026 else if (GET_CODE (orig) == SYMBOL_REF) | |
1027 return orig; | |
1028 | |
1029 else if (GET_CODE (orig) == PLUS | 1026 else if (GET_CODE (orig) == PLUS |
1030 && (GET_CODE (XEXP (orig, 0)) == MEM | 1027 && (GET_CODE (XEXP (orig, 0)) == MEM |
1031 || GET_CODE (XEXP (orig, 0)) == SYMBOL_REF | 1028 || GET_CODE (XEXP (orig, 0)) == SYMBOL_REF |
1032 || GET_CODE (XEXP (orig, 0)) == LABEL_REF) | 1029 || GET_CODE (XEXP (orig, 0)) == LABEL_REF) |
1033 && XEXP (orig, 0) != pic_offset_table_rtx | 1030 && XEXP (orig, 0) != pic_offset_table_rtx |
1053 emit_move_insn (reg, pic_ref); | 1050 emit_move_insn (reg, pic_ref); |
1054 pic_ref = reg; | 1051 pic_ref = reg; |
1055 } | 1052 } |
1056 /* Likewise, should we set special REG_NOTEs here? */ | 1053 /* Likewise, should we set special REG_NOTEs here? */ |
1057 } | 1054 } |
1058 | |
1059 else if (GET_CODE (orig) == CONST) | 1055 else if (GET_CODE (orig) == CONST) |
1060 { | 1056 { |
1061 return machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, reg); | 1057 return machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, reg); |
1062 } | 1058 } |
1063 | |
1064 else if (GET_CODE (orig) == MEM | 1059 else if (GET_CODE (orig) == MEM |
1065 && GET_CODE (XEXP (orig, 0)) == SYMBOL_REF) | 1060 && GET_CODE (XEXP (orig, 0)) == SYMBOL_REF) |
1066 { | 1061 { |
1067 rtx addr = machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, reg); | 1062 rtx addr = machopic_legitimize_pic_address (XEXP (orig, 0), Pmode, reg); |
1068 addr = replace_equiv_address (orig, addr); | 1063 addr = replace_equiv_address (orig, addr); |
1929 | 1924 |
1930 /* File to temporarily store LTO data. This is appended to asm_out_file | 1925 /* File to temporarily store LTO data. This is appended to asm_out_file |
1931 in darwin_end_file. */ | 1926 in darwin_end_file. */ |
1932 static FILE *lto_asm_out_file, *saved_asm_out_file; | 1927 static FILE *lto_asm_out_file, *saved_asm_out_file; |
1933 static char *lto_asm_out_name; | 1928 static char *lto_asm_out_name; |
1929 static enum debug_info_levels saved_debug_info_level; | |
1934 | 1930 |
1935 /* Prepare asm_out_file for LTO output. For darwin, this means hiding | 1931 /* Prepare asm_out_file for LTO output. For darwin, this means hiding |
1936 asm_out_file and switching to an alternative output file. */ | 1932 asm_out_file and switching to an alternative output file. */ |
1937 void | 1933 void |
1938 darwin_asm_lto_start (void) | 1934 darwin_asm_lto_start (void) |
1939 { | 1935 { |
1940 gcc_assert (! saved_asm_out_file); | 1936 gcc_assert (! saved_asm_out_file); |
1941 saved_asm_out_file = asm_out_file; | 1937 saved_asm_out_file = asm_out_file; |
1938 saved_debug_info_level = debug_info_level; | |
1939 debug_info_level = DINFO_LEVEL_NONE; | |
1942 if (! lto_asm_out_name) | 1940 if (! lto_asm_out_name) |
1943 lto_asm_out_name = make_temp_file (".lto.s"); | 1941 lto_asm_out_name = make_temp_file (".lto.s"); |
1944 lto_asm_out_file = fopen (lto_asm_out_name, "a"); | 1942 lto_asm_out_file = fopen (lto_asm_out_name, "a"); |
1945 if (lto_asm_out_file == NULL) | 1943 if (lto_asm_out_file == NULL) |
1946 fatal_error (input_location, | 1944 fatal_error (input_location, |
1955 { | 1953 { |
1956 gcc_assert (saved_asm_out_file); | 1954 gcc_assert (saved_asm_out_file); |
1957 fclose (lto_asm_out_file); | 1955 fclose (lto_asm_out_file); |
1958 asm_out_file = saved_asm_out_file; | 1956 asm_out_file = saved_asm_out_file; |
1959 saved_asm_out_file = NULL; | 1957 saved_asm_out_file = NULL; |
1958 debug_info_level = saved_debug_info_level; | |
1960 } | 1959 } |
1961 | 1960 |
1962 static void | 1961 static void |
1963 darwin_asm_dwarf_section (const char *name, unsigned int flags, | 1962 darwin_asm_dwarf_section (const char *name, unsigned int flags, |
1964 tree decl, bool is_for_lto); | 1963 tree decl, bool is_for_lto); |
3168 if (!global_options_set.x_dwarf_strict) | 3167 if (!global_options_set.x_dwarf_strict) |
3169 dwarf_strict = 1; | 3168 dwarf_strict = 1; |
3170 if (!global_options_set.x_dwarf_version) | 3169 if (!global_options_set.x_dwarf_version) |
3171 dwarf_version = 2; | 3170 dwarf_version = 2; |
3172 | 3171 |
3172 if (global_options_set.x_dwarf_split_debug_info) | |
3173 { | |
3174 inform (input_location, | |
3175 "-gsplit-dwarf is not supported on this platform, ignored"); | |
3176 dwarf_split_debug_info = 0; | |
3177 global_options_set.x_dwarf_split_debug_info = 0; | |
3178 } | |
3179 | |
3173 /* Do not allow unwind tables to be generated by default for m32. | 3180 /* Do not allow unwind tables to be generated by default for m32. |
3174 fnon-call-exceptions will override this, regardless of what we do. */ | 3181 fnon-call-exceptions will override this, regardless of what we do. */ |
3175 if (generating_for_darwin_version < 10 | 3182 if (generating_for_darwin_version < 10 |
3176 && !global_options_set.x_flag_asynchronous_unwind_tables | 3183 && !global_options_set.x_flag_asynchronous_unwind_tables |
3177 && !TARGET_64BIT) | 3184 && !TARGET_64BIT) |
3703 default_function_sections: | 3710 default_function_sections: |
3704 return (use_coal) ? darwin_sections[text_coal_section] | 3711 return (use_coal) ? darwin_sections[text_coal_section] |
3705 : text_section; | 3712 : text_section; |
3706 } | 3713 } |
3707 | 3714 |
3708 /* When a function is partitioned between sections, we need to insert a label | |
3709 at the start of each new chunk - so that it may become a valid 'atom' for | |
3710 eh and debug purposes. Without this the linker will emit warnings if one | |
3711 tries to add line location information (since the switched fragment will | |
3712 be anonymous). */ | |
3713 | |
3714 void | |
3715 darwin_function_switched_text_sections (FILE *fp, tree decl, bool new_is_cold) | |
3716 { | |
3717 /* Make sure we pick up all the relevant quotes etc. */ | |
3718 assemble_name_raw (fp, new_is_cold ? "__cold_sect_of_" : "__hot_sect_of_"); | |
3719 assemble_name_raw (fp, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); | |
3720 fputs (":\n", fp); | |
3721 } | |
3722 | |
3723 #include "gt-darwin.h" | 3715 #include "gt-darwin.h" |