Mercurial > hg > CbC > CbC_gcc
comparison gcc/mips-tfile.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | 3bfb6c00c1e0 |
children | b7f97abdc517 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
1 /* Update the symbol table (the .T file) in a MIPS object to | 1 /* Update the symbol table (the .T file) in a MIPS object to |
2 contain debugging information specified by the GNU compiler | 2 contain debugging information specified by the GNU compiler |
3 in the form of comments (the mips assembler does not support | 3 in the form of comments (the mips assembler does not support |
4 assembly access to debug information). | 4 assembly access to debug information). |
5 Copyright (C) 1991, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, | 5 Copyright (C) 1991, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, |
6 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | 6 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
7 Free Software Foundation, Inc. | 7 Free Software Foundation, Inc. |
8 Contributed by Michael Meissner (meissner@cygnus.com). | 8 Contributed by Michael Meissner (meissner@cygnus.com). |
9 | 9 |
10 This file is part of GCC. | 10 This file is part of GCC. |
11 | 11 |
672 #else | 672 #else |
673 #include "mips/a.out.h" | 673 #include "mips/a.out.h" |
674 #endif /* CROSS_DIRECTORY_STRUCTURE */ | 674 #endif /* CROSS_DIRECTORY_STRUCTURE */ |
675 | 675 |
676 #include "gstab.h" | 676 #include "gstab.h" |
677 | |
678 #define STAB_CODE_TYPE enum __stab_debug_code | |
679 | 677 |
680 #ifndef MALLOC_CHECK | 678 #ifndef MALLOC_CHECK |
681 #ifdef __SABER__ | 679 #ifdef __SABER__ |
682 #define MALLOC_CHECK | 680 #define MALLOC_CHECK |
683 #endif | 681 #endif |
1937 str_end_p1 = str_start + strlen (str_start); | 1935 str_end_p1 = str_start + strlen (str_start); |
1938 | 1936 |
1939 if (debug > 1) | 1937 if (debug > 1) |
1940 { | 1938 { |
1941 long value = esym->asym.value; | 1939 long value = esym->asym.value; |
1942 const char *sc_str = sc_to_string (esym->asym.sc); | 1940 const char *sc_str = sc_to_string ((sc_t) esym->asym.sc); |
1943 const char *st_str = st_to_string (esym->asym.st); | 1941 const char *st_str = st_to_string ((st_t) esym->asym.st); |
1944 | 1942 |
1945 fprintf (stderr, | 1943 fprintf (stderr, |
1946 "\tesym\tv= %10ld, ifd= %2d, sc= %-12s", | 1944 "\tesym\tv= %10ld, ifd= %2d, sc= %-12s", |
1947 value, ifd, sc_str); | 1945 value, ifd, sc_str); |
1948 | 1946 |
3473 { | 3471 { |
3474 /* Add a dummy @stabs symbol. */ | 3472 /* Add a dummy @stabs symbol. */ |
3475 stabs_seen = 1; | 3473 stabs_seen = 1; |
3476 (void) add_local_symbol (stabs_symbol, | 3474 (void) add_local_symbol (stabs_symbol, |
3477 stabs_symbol + sizeof (stabs_symbol), | 3475 stabs_symbol + sizeof (stabs_symbol), |
3478 stNil, scInfo, -1, MIPS_MARK_STAB (0)); | 3476 (st_t) stNil, (sc_t) scInfo, -1, |
3477 MIPS_MARK_STAB (0)); | |
3479 | 3478 |
3480 } | 3479 } |
3481 } | 3480 } |
3482 | 3481 |
3483 | 3482 |
3666 } | 3665 } |
3667 | 3666 |
3668 /* Traditionally, N_LBRAC and N_RBRAC are *not* relocated. */ | 3667 /* Traditionally, N_LBRAC and N_RBRAC are *not* relocated. */ |
3669 if (code == (int) N_LBRAC || code == (int) N_RBRAC) | 3668 if (code == (int) N_LBRAC || code == (int) N_RBRAC) |
3670 { | 3669 { |
3671 sc = scNil; | 3670 sc = (sc_t) scNil; |
3672 st = stNil; | 3671 st = (st_t) stNil; |
3673 } | 3672 } |
3674 else | 3673 else |
3675 { | 3674 { |
3676 sc = (sc_t) sym_ptr->sc; | 3675 sc = (sc_t) sym_ptr->sc; |
3677 st = (st_t) sym_ptr->st; | 3676 st = (st_t) sym_ptr->st; |
3992 | 3991 |
3993 if (vp->num_allocated == 0) | 3992 if (vp->num_allocated == 0) |
3994 return; | 3993 return; |
3995 | 3994 |
3996 if (debug) | 3995 if (debug) |
3997 fprintf (stderr, "\twarray\tvp = %p, offset = %7lu, size = %7lu, %s\n", | 3996 fprintf (stderr, "\twarray\tvp = " HOST_PTR_PRINTF |
3997 ", offset = %7lu, size = %7lu, %s\n", | |
3998 (void *) vp, (unsigned long) offset, | 3998 (void *) vp, (unsigned long) offset, |
3999 vp->num_allocated * vp->object_size, str); | 3999 vp->num_allocated * vp->object_size, str); |
4000 | 4000 |
4001 if (file_offset != (unsigned long) offset | 4001 if (file_offset != (unsigned long) offset |
4002 && fseek (object_stream, (long) offset, SEEK_SET) < 0) | 4002 && fseek (object_stream, (long) offset, SEEK_SET) < 0) |
4031 int sys_write; | 4031 int sys_write; |
4032 efdr_t *file_ptr; | 4032 efdr_t *file_ptr; |
4033 off_t offset; | 4033 off_t offset; |
4034 | 4034 |
4035 if (debug) | 4035 if (debug) |
4036 fprintf (stderr, "\n\twrite\tvp = %p, offset = %7u, size = %7lu, %s\n", | 4036 fprintf (stderr, "\n\twrite\tvp = " HOST_PTR_PRINTF |
4037 ", offset = %7u, size = %7lu, %s\n", | |
4037 (void *) &symbolic_header, 0, | 4038 (void *) &symbolic_header, 0, |
4038 (unsigned long) sizeof (symbolic_header), "symbolic header"); | 4039 (unsigned long) sizeof (symbolic_header), "symbolic header"); |
4039 | 4040 |
4040 sys_write = fwrite (&symbolic_header, | 4041 sys_write = fwrite (&symbolic_header, |
4041 1, | 4042 1, |
4061 if (file_offset != (unsigned long) symbolic_header.cbLineOffset | 4062 if (file_offset != (unsigned long) symbolic_header.cbLineOffset |
4062 && fseek (object_stream, symbolic_header.cbLineOffset, SEEK_SET) != 0) | 4063 && fseek (object_stream, symbolic_header.cbLineOffset, SEEK_SET) != 0) |
4063 pfatal_with_name (object_name); | 4064 pfatal_with_name (object_name); |
4064 | 4065 |
4065 if (debug) | 4066 if (debug) |
4066 fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n", | 4067 fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF |
4068 ", offset = %7lu, size = %7lu, %s\n", | |
4067 (void *) &orig_linenum, (long) symbolic_header.cbLineOffset, | 4069 (void *) &orig_linenum, (long) symbolic_header.cbLineOffset, |
4068 (long) symbolic_header.cbLine, "Line numbers"); | 4070 (long) symbolic_header.cbLine, "Line numbers"); |
4069 | 4071 |
4070 sys_write = fwrite (orig_linenum, | 4072 sys_write = fwrite (orig_linenum, |
4071 1, | 4073 1, |
4092 if (file_offset != (unsigned long) symbolic_header.cbOptOffset | 4094 if (file_offset != (unsigned long) symbolic_header.cbOptOffset |
4093 && fseek (object_stream, symbolic_header.cbOptOffset, SEEK_SET) != 0) | 4095 && fseek (object_stream, symbolic_header.cbOptOffset, SEEK_SET) != 0) |
4094 pfatal_with_name (object_name); | 4096 pfatal_with_name (object_name); |
4095 | 4097 |
4096 if (debug) | 4098 if (debug) |
4097 fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n", | 4099 fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF |
4100 ", offset = %7lu, size = %7lu, %s\n", | |
4098 (void *) &orig_opt_syms, (long) symbolic_header.cbOptOffset, | 4101 (void *) &orig_opt_syms, (long) symbolic_header.cbOptOffset, |
4099 num_write, "Optimizer symbols"); | 4102 num_write, "Optimizer symbols"); |
4100 | 4103 |
4101 sys_write = fwrite (orig_opt_syms, | 4104 sys_write = fwrite (orig_opt_syms, |
4102 1, | 4105 1, |
4180 for (file_ptr = first_file; | 4183 for (file_ptr = first_file; |
4181 file_ptr != (efdr_t *) 0; | 4184 file_ptr != (efdr_t *) 0; |
4182 file_ptr = file_ptr->next_file) | 4185 file_ptr = file_ptr->next_file) |
4183 { | 4186 { |
4184 if (debug) | 4187 if (debug) |
4185 fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n", | 4188 fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF |
4189 ", offset = %7lu, size = %7lu, %s\n", | |
4186 (void *) &file_ptr->fdr, file_offset, | 4190 (void *) &file_ptr->fdr, file_offset, |
4187 (unsigned long) sizeof (FDR), "File header"); | 4191 (unsigned long) sizeof (FDR), "File header"); |
4188 | 4192 |
4189 sys_write = fwrite (&file_ptr->fdr, | 4193 sys_write = fwrite (&file_ptr->fdr, |
4190 1, | 4194 1, |
4212 if (file_offset != (unsigned long) symbolic_header.cbRfdOffset | 4216 if (file_offset != (unsigned long) symbolic_header.cbRfdOffset |
4213 && fseek (object_stream, symbolic_header.cbRfdOffset, SEEK_SET) != 0) | 4217 && fseek (object_stream, symbolic_header.cbRfdOffset, SEEK_SET) != 0) |
4214 pfatal_with_name (object_name); | 4218 pfatal_with_name (object_name); |
4215 | 4219 |
4216 if (debug) | 4220 if (debug) |
4217 fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n", | 4221 fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF |
4222 ", offset = %7lu, size = %7lu, %s\n", | |
4218 (void *) &orig_rfds, (long) symbolic_header.cbRfdOffset, | 4223 (void *) &orig_rfds, (long) symbolic_header.cbRfdOffset, |
4219 num_write, "Relative file descriptors"); | 4224 num_write, "Relative file descriptors"); |
4220 | 4225 |
4221 sys_write = fwrite (orig_rfds, | 4226 sys_write = fwrite (orig_rfds, |
4222 1, | 4227 1, |
4779 } | 4784 } |
4780 | 4785 |
4781 if (version) | 4786 if (version) |
4782 { | 4787 { |
4783 printf (_("mips-tfile %s%s\n"), pkgversion_string, version_string); | 4788 printf (_("mips-tfile %s%s\n"), pkgversion_string, version_string); |
4784 fputs ("Copyright (C) 2010 Free Software Foundation, Inc.\n", stdout); | 4789 fputs ("Copyright (C) 2009 Free Software Foundation, Inc.\n", stdout); |
4785 fputs (_("This is free software; see the source for copying conditions. There is NO\n\ | 4790 fputs (_("This is free software; see the source for copying conditions. There is NO\n\ |
4786 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"), | 4791 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"), |
4787 stdout); | 4792 stdout); |
4788 exit (0); | 4793 exit (0); |
4789 } | 4794 } |
5005 | 5010 |
5006 if (sbrk (npages * PAGE_USIZE) == (char *) -1) | 5011 if (sbrk (npages * PAGE_USIZE) == (char *) -1) |
5007 pfatal_with_name ("allocate_cluster"); | 5012 pfatal_with_name ("allocate_cluster"); |
5008 | 5013 |
5009 if (debug > 3) | 5014 if (debug > 3) |
5010 fprintf (stderr, "\talloc\tnpages = %lu, value = %p\n", | 5015 fprintf (stderr, "\talloc\tnpages = %lu, value = " HOST_PTR_PRINTF "\n", |
5011 (unsigned long) npages, (void *) ptr); | 5016 (unsigned long) npages, (void *) ptr); |
5012 | 5017 |
5013 return ptr; | 5018 return ptr; |
5014 } | 5019 } |
5015 | 5020 |