Changeset 1260
- Timestamp:
- 08/07/08 03:10:26 (3 years ago)
- Location:
- trunk/tigcc
- Files:
-
- 4 added
- 4 edited
-
doc/System/Info/ld/symbols.hss (modified) (1 diff)
-
doc/System/Info/ld/symbols_ld_link_time_d.hss (added)
-
doc/System/Info/ld/symbols_ld_link_time_m.hss (added)
-
doc/System/Info/ld/symbols_ld_link_time_timestamp.hss (added)
-
doc/System/Info/ld/symbols_ld_link_time_y.hss (added)
-
ld-tigcc/data.h (modified) (2 diffs)
-
ld-tigcc/main.c (modified) (3 diffs)
-
ld-tigcc/special.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tigcc/doc/System/Info/ld/symbols.hss
r11 r1260 1 1 [Main] 2 2 Title=Symbols Built into the TIGCC Linker 3 Subsections=symbols_rom_call, symbols_ti_ams_api, symbols_ram_call, symbols_extra_ram_addr, symbols_lib_call, symbols_ld_calc_const, symbols_ld_entry_point, symbols_ld_entry_point_plus_0x8000, symbols_ld_program_size, symbols_ld_constructors_start, symbols_ld_constructors_end, symbols_ld_constructors_size, symbols_ld_constructor_count, symbols_ld_destructors_start, symbols_ld_destructors_end, symbols_ld_destructors_size, symbols_ld_destructor_count, symbols_ld_reloc_count, symbols_ld_data_start, symbols_ld_data_end, symbols_ld_data_size, symbols_ld_data_ref_count, symbols_ld_bss_start, symbols_ld_bss_end, symbols_ld_bss_size, symbols_ld_bss_ref_count, symbols_ld_rom_call_count, symbols_ld_ram_call_count, symbols_ld_lib_count, symbols_ld_referenced_lib_count, symbols_ld_export_count, symbols_ld_nostub_comment_count, symbols_ld_has, symbols_ld_file_version, symbols_ld_kernel_flags, symbols_ld_kernel_bss_table, symbols_ld_kernel_export_table, symbols_ld_data_var_name_end, symbols_ld_hardware_id, symbols_ exit, symbols_comment, symbols_extraram, symbols_library3 Subsections=symbols_rom_call, symbols_ti_ams_api, symbols_ram_call, symbols_extra_ram_addr, symbols_lib_call, symbols_ld_calc_const, symbols_ld_entry_point, symbols_ld_entry_point_plus_0x8000, symbols_ld_program_size, symbols_ld_constructors_start, symbols_ld_constructors_end, symbols_ld_constructors_size, symbols_ld_constructor_count, symbols_ld_destructors_start, symbols_ld_destructors_end, symbols_ld_destructors_size, symbols_ld_destructor_count, symbols_ld_reloc_count, symbols_ld_data_start, symbols_ld_data_end, symbols_ld_data_size, symbols_ld_data_ref_count, symbols_ld_bss_start, symbols_ld_bss_end, symbols_ld_bss_size, symbols_ld_bss_ref_count, symbols_ld_rom_call_count, symbols_ld_ram_call_count, symbols_ld_lib_count, symbols_ld_referenced_lib_count, symbols_ld_export_count, symbols_ld_nostub_comment_count, symbols_ld_has, symbols_ld_file_version, symbols_ld_kernel_flags, symbols_ld_kernel_bss_table, symbols_ld_kernel_export_table, symbols_ld_data_var_name_end, symbols_ld_hardware_id, symbols_ld_link_time_y, symbols_ld_link_time_m, symbols_ld_link_time_d, symbols_ld_link_time_timestamp, symbols_exit, symbols_comment, symbols_extraram, symbols_library 4 4 5 5 [Top] -
trunk/tigcc/ld-tigcc/data.h
r219 r1260 25 25 #include "lists.h" 26 26 #include "intrface.h" 27 28 #include <time.h> 27 29 28 30 #define MAX_SYM_LEN 255 … … 139 141 OPTIMIZE_INFO 140 142 *OptimizeInfo; // Optimization settings and results. 143 struct { 144 time_t LinkTime; 145 unsigned short year, month, day; 146 } LinkTime; // Time info, initialized when linking starts. 141 147 } PROGRAM; 142 148 -
trunk/tigcc/ld-tigcc/main.c
r1171 r1260 40 40 #include <string.h> 41 41 #include <ctype.h> 42 #include <time.h> 42 43 43 44 #define RESULT_OK 0 … … 122 123 } 123 124 125 // Fill internal structures with time information 126 static void ComputeTimeInformation(PROGRAM *Program) 127 { 128 // Get the timestamp. 129 if (time(&Program->LinkTime.LinkTime) != (time_t)-1) 130 { 131 struct tm * broken_down_time; 132 133 broken_down_time = gmtime(&Program->LinkTime.LinkTime); 134 if (broken_down_time != NULL) { 135 // gmtime returns the number of years since 1900. 136 Program->LinkTime.year = broken_down_time->tm_year + 1900; 137 // gmtime returns the month between 0 and 11. 138 Program->LinkTime.month = broken_down_time->tm_mon + 1; 139 Program->LinkTime.day = broken_down_time->tm_mday; 140 // Convert from "seconds since Jan 1, 1970" to "seconds since Jan 1, 1997". 141 // 197x: 8x365 days, 2x366 days (leap years: 1972, 1976) => 315532800 seconds 142 // 198x: 7x365 days, 3x366 days (leap years: 1980, 1984, 1988) => 315619200 seconds 143 // 199x: 5x365 days, 2x366 days (leap years: 1992, 1996) => 220924800 seconds 144 // Total: 852076800 seconds. 145 Program->LinkTime.LinkTime -= (time_t)852076800L; 146 return; 147 } 148 } 149 150 // Failed, so set dummy values. 151 Warning (NULL, "Couldn't get current time, setting dummy values."); 152 Program->LinkTime.LinkTime = (time_t)0, 153 Program->LinkTime.year = 1997, 154 Program->LinkTime.month = 1, 155 Program->LinkTime.day = 1; 156 } 157 124 158 int main (int ArgCount, const char **Args) 125 159 { … … 170 204 // Initialize. 171 205 memset (&Program, 0, sizeof (Program)); 206 207 ComputeTimeInformation(&Program); 208 172 209 Program.EntryPoint.SymbolName = "__entry_point"; 173 210 #ifdef TARGET_EMBEDDED -
trunk/tigcc/ld-tigcc/special.c
r278 r1260 754 754 { 755 755 NewValue = Program->Version; 756 HasValue = TRUE; 757 } 758 } 759 else if (SymNameMatches ("link_time_y")) // Preliminary name 760 { 761 if (Program->ResolveAllBuiltins) 762 { 763 NewValue = Program->LinkTime.year; 764 HasValue = TRUE; 765 } 766 } 767 else if (SymNameMatches ("link_time_m")) // Preliminary name 768 { 769 if (Program->ResolveAllBuiltins) 770 { 771 NewValue = Program->LinkTime.month; 772 HasValue = TRUE; 773 } 774 } 775 else if (SymNameMatches ("link_time_d")) // Preliminary name 776 { 777 if (Program->ResolveAllBuiltins) 778 { 779 NewValue = Program->LinkTime.day; 780 HasValue = TRUE; 781 } 782 } 783 else if (SymNameMatches ("link_time_timestamp")) // Preliminary name 784 { 785 if (Program->ResolveAllBuiltins) 786 { 787 NewValue = Program->LinkTime.LinkTime; 756 788 HasValue = TRUE; 757 789 }
Note: See TracChangeset
for help on using the changeset viewer.
