diff options
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/darwin.c | 29 | ||||
-rw-r--r-- | gcc/config/darwin.h | 26 |
2 files changed, 50 insertions, 5 deletions
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index f1370b9d00a..670a57aa3d8 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1275,5 +1275,34 @@ darwin_globalize_label (stream, name) default_globalize_label (stream, name); } +/* Output a difference of two labels that will be an assembly time + constant if the two labels are local. (.long lab1-lab2 will be + very different if lab1 is at the boundary between two sections; it + will be relocated according to the second section, not the first, + so one ends up with a difference between labels in different + sections, which is bad in the dwarf2 eh context for instance.) */ + +static int darwin_dwarf_label_counter; + +void +darwin_asm_output_dwarf_delta (file, size, lab1, lab2) + FILE *file; + int size ATTRIBUTE_UNUSED; + const char *lab1, *lab2; +{ + const char *p = lab1 + (lab1[0] == '*'); + int islocaldiff = (p[0] == 'L'); + + if (islocaldiff) + fprintf (file, "\t.set L$set$%d,", darwin_dwarf_label_counter); + else + fprintf (file, "\t%s\t", ".long"); + assemble_name (file, lab1); + fprintf (file, "-"); + assemble_name (file, lab2); + if (islocaldiff) + fprintf (file, "\n\t.long L$set$%d", darwin_dwarf_label_counter++); +} + #include "gt-darwin.h" diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index ba7cb66cc22..0c327b93b30 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -35,6 +35,12 @@ Boston, MA 02111-1307, USA. */ leave it undefined and expect system builders to set configure args correctly. */ +/* One of Darwin's NeXT legacies is the Mach-O format, which is partly + like a.out and partly like COFF, with additional features like + multi-architecture binary support. */ + +#define OBJECT_FORMAT_MACHO + /* Suppress g++ attempt to link in the math library automatically. (Some Darwin versions have a libm, but they seem to cause problems for C++ executables.) */ @@ -92,8 +98,12 @@ Boston, MA 02111-1307, USA. */ #undef STARTFILE_SPEC #define STARTFILE_SPEC \ - "%{pg:%{static:-lgcrt0.o}%{!static:-lgcrt1.o}} \ - %{!pg:%{static:-lcrt0.o}%{!static:-lcrt1.o}}" + "%{pg:%{static:-lgcrt0.o}%{!static:-lgcrt1.o -lcrtbegin.o}} \ + %{!pg:%{static:-lcrt0.o}%{!static:-lcrt1.o -lcrtbegin.o}}" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + "-lcrtend.o" #undef DOLLARS_IN_IDENTIFIERS #define DOLLARS_IN_IDENTIFIERS 2 @@ -131,7 +141,6 @@ do { text_section (); \ #define TARGET_ASM_CONSTRUCTOR machopic_asm_out_constructor #define TARGET_ASM_DESTRUCTOR machopic_asm_out_destructor - /* Don't output a .file directive. That is only used by the assembler for error reporting. */ @@ -425,7 +434,7 @@ SECTION_FUNCTION (machopic_picsymbol_stub_section, \ ".picsymbol_stub", 0) \ SECTION_FUNCTION (darwin_exception_section, \ in_darwin_exception, \ - ".section __TEXT,__gcc_except_tab", 0) \ + ".section __DATA,__gcc_except_tab", 0) \ SECTION_FUNCTION (darwin_eh_frame_section, \ in_darwin_eh_frame, \ ".section __TEXT,__eh_frame", 0) \ @@ -597,7 +606,14 @@ enum machopic_addr_class { #undef ASM_PREFERRED_EH_DATA_FORMAT #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ - (((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr) + (((CODE) == 2 && (GLOBAL) == 1) \ + ? (DW_EH_PE_pcrel | DW_EH_PE_indirect) : \ + ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr) + +#define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2) \ + darwin_asm_output_dwarf_delta (FILE, SIZE, LABEL1, LABEL2) + +#define TARGET_TERMINATE_DW2_EH_FRAME_INFO false #define DARWIN_REGISTER_TARGET_PRAGMAS(PFILE) \ do { \ |