diff options
-rw-r--r-- | gcc/c-lang.c | 6 | ||||
-rw-r--r-- | gcc/defaults.h | 10 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 6 | ||||
-rw-r--r-- | gcc/toplev.c | 18 | ||||
-rw-r--r-- | gcc/tree.h | 3 |
5 files changed, 43 insertions, 0 deletions
diff --git a/gcc/c-lang.c b/gcc/c-lang.c index c62f8d2..fe4acab 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -47,6 +47,12 @@ lang_finish () { } +char * +lang_identify () +{ + return "c"; +} + /* Used by c-lex.c, but only for objc. */ tree lookup_interface (arg) diff --git a/gcc/defaults.h b/gcc/defaults.h index e943fa6..7234206 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -108,3 +108,13 @@ do { fprintf (FILE, "\t%s\t", ASM_SHORT); \ } \ while (0) #endif + +#ifndef ASM_IDENTIFY_GCC + /* Default the definition, only if ASM_IDENTIFY_GCC is not set, + because if it is set, we might not want ASM_IDENTIFY_LANGUAGE + outputting labels, if we do want it to, then it must be defined + in the tm.h file. */ +#ifndef ASM_IDENTIFY_LANGUAGE +#define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE); +#endif +#endif diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index bfffa78..a7ae676 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -371,6 +371,12 @@ lang_finish () { } +char * +lang_identify () +{ + return "objc"; +} + int lang_decode_option (p) char *p; diff --git a/gcc/toplev.c b/gcc/toplev.c index 3ac6132..34351b1 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -52,6 +52,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "rtl.h" #include "flags.h" #include "insn-attr.h" +#include "defaults.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" @@ -1495,6 +1496,17 @@ output_file_directive (asm_file, input_name) #endif } +/* Routine to build language identifier for object file. */ +static void +output_lang_identify (asm_out_file) + FILE *asm_out_file; +{ + int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1; + char *s = (char *) alloca (len); + sprintf (s, "__gnu_compiled_%s", lang_identify ()); + ASM_OUTPUT_LABEL (asm_out_file, s); +} + /* Compile an entire file of output from cpp, named NAME. Write a file of assembly output and various debugging dumps. */ @@ -1789,6 +1801,12 @@ compile_file (name) #else ASM_IDENTIFY_GCC (asm_out_file); #endif + + /* Output something to identify which front-end produced this file. */ +#ifdef ASM_IDENTIFY_LANGUAGE + ASM_IDENTIFY_LANGUAGE (asm_out_file); +#endif + /* Don't let the first function fall at the same address as gcc_compiled., if profiling. */ if (profile_flag || profile_block_flag) @@ -1427,6 +1427,9 @@ extern void init_decl_processing PROTO((void)); extern void lang_init PROTO((void)); extern void lang_finish PROTO((void)); +/* Funtion to identify which front-end produced the output file. */ +extern char *lang_identify PROTO((void)); + /* Function called with no arguments to parse and compile the input. */ extern int yyparse PROTO((void)); /* Function called with option as argument |