Rev 5222 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5222 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* read.c - read a source file - |
1 | /* read.c - read a source file - |
2 | Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, |
- | |
3 | 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, |
- | |
4 | 2010, 2011, 2012 Free Software Foundation, Inc. |
2 | Copyright (C) 1986-2015 Free Software Foundation, Inc. |
Line 5... | Line 3... | ||
5 | 3 | ||
Line 6... | Line 4... | ||
6 | This file is part of GAS, the GNU Assembler. |
4 | This file is part of GAS, the GNU Assembler. |
7 | 5 | ||
Line 41... | Line 39... | ||
41 | #include "ecoff.h" |
39 | #include "ecoff.h" |
42 | #include "dw2gencfi.h" |
40 | #include "dw2gencfi.h" |
43 | #include "wchar.h" |
41 | #include "wchar.h" |
Line 44... | Line 42... | ||
44 | 42 | ||
45 | #ifndef TC_START_LABEL |
43 | #ifndef TC_START_LABEL |
46 | #define TC_START_LABEL(x,y,z) (x == ':') |
44 | #define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) (NEXT_CHAR == ':') |
Line 47... | Line 45... | ||
47 | #endif |
45 | #endif |
48 | 46 | ||
49 | /* Set by the object-format or the target. */ |
47 | /* Set by the object-format or the target. */ |
Line 263... | Line 261... | ||
263 | /* Something close -- but not too close -- to a multiple of 1024. |
261 | /* Something close -- but not too close -- to a multiple of 1024. |
264 | The debugging malloc I'm using has 24 bytes of overhead. */ |
262 | The debugging malloc I'm using has 24 bytes of overhead. */ |
265 | obstack_begin (¬es, chunksize); |
263 | obstack_begin (¬es, chunksize); |
266 | obstack_begin (&cond_obstack, chunksize); |
264 | obstack_begin (&cond_obstack, chunksize); |
Line -... | Line 265... | ||
- | 265 | ||
- | 266 | #ifndef tc_line_separator_chars |
|
- | 267 | #define tc_line_separator_chars line_separator_chars |
|
267 | 268 | #endif |
|
268 | /* Use machine dependent syntax. */ |
269 | /* Use machine dependent syntax. */ |
269 | for (p = line_separator_chars; *p; p++) |
270 | for (p = tc_line_separator_chars; *p; p++) |
270 | is_end_of_line[(unsigned char) *p] = 2; |
271 | is_end_of_line[(unsigned char) *p] = 2; |
Line 271... | Line 272... | ||
271 | /* Use more. FIXME-SOMEDAY. */ |
272 | /* Use more. FIXME-SOMEDAY. */ |
272 | 273 | ||
Line 554... | Line 555... | ||
554 | pop_table_name = "cfi"; |
555 | pop_table_name = "cfi"; |
555 | pop_override_ok = 1; |
556 | pop_override_ok = 1; |
556 | cfi_pop_insert (); |
557 | cfi_pop_insert (); |
557 | } |
558 | } |
558 | 559 | ||
559 | #define HANDLE_CONDITIONAL_ASSEMBLY() \ |
560 | #define HANDLE_CONDITIONAL_ASSEMBLY(num_read) \ |
560 | if (ignore_input ()) \ |
561 | if (ignore_input ()) \ |
561 | { \ |
562 | { \ |
562 | char *eol = find_end_of_line (input_line_pointer, flag_m68k_mri); \ |
563 | char *eol = find_end_of_line (input_line_pointer - (num_read), \ |
- | 564 | flag_m68k_mri); \ |
|
563 | input_line_pointer = (input_line_pointer <= buffer_limit \ |
565 | input_line_pointer = (input_line_pointer <= buffer_limit \ |
564 | && eol >= buffer_limit) \ |
566 | && eol >= buffer_limit) \ |
565 | ? buffer_limit \ |
567 | ? buffer_limit \ |
566 | : eol + 1; \ |
568 | : eol + 1; \ |
567 | continue; \ |
569 | continue; \ |
Line 737... | Line 739... | ||
737 | /* We read the file, putting things into a web that represents what we |
739 | /* We read the file, putting things into a web that represents what we |
738 | have been reading. */ |
740 | have been reading. */ |
739 | void |
741 | void |
740 | read_a_source_file (char *name) |
742 | read_a_source_file (char *name) |
741 | { |
743 | { |
742 | char c; |
744 | char nul_char; |
- | 745 | char next_char; |
|
743 | char *s; /* String of symbol, '\0' appended. */ |
746 | char *s; /* String of symbol, '\0' appended. */ |
744 | int temp; |
747 | int temp; |
745 | pseudo_typeS *pop; |
748 | pseudo_typeS *pop; |
Line 746... | Line 749... | ||
746 | 749 | ||
Line 824... | Line 827... | ||
824 | { |
827 | { |
825 | line_label = NULL; |
828 | line_label = NULL; |
Line 826... | Line 829... | ||
826 | 829 | ||
827 | if (LABELS_WITHOUT_COLONS || flag_m68k_mri) |
830 | if (LABELS_WITHOUT_COLONS || flag_m68k_mri) |
- | 831 | { |
|
828 | { |
832 | next_char = * input_line_pointer; |
829 | /* Text at the start of a line must be a label, we |
833 | /* Text at the start of a line must be a label, we |
830 | run down and stick a colon in. */ |
834 | run down and stick a colon in. */ |
831 | if (is_name_beginner (*input_line_pointer)) |
835 | if (is_name_beginner (next_char) || next_char == '"') |
832 | { |
836 | { |
833 | char *line_start = input_line_pointer; |
837 | char *line_start; |
Line 834... | Line 838... | ||
834 | int mri_line_macro; |
838 | int mri_line_macro; |
Line 835... | Line 839... | ||
835 | 839 | ||
- | 840 | HANDLE_CONDITIONAL_ASSEMBLY (0); |
|
Line 836... | Line 841... | ||
836 | HANDLE_CONDITIONAL_ASSEMBLY (); |
841 | |
837 | 842 | nul_char = get_symbol_name (& line_start); |
|
838 | c = get_symbol_end (); |
843 | next_char = (nul_char == '"' ? input_line_pointer[1] : nul_char); |
839 | 844 | ||
Line 867... | Line 872... | ||
867 | /* In MRI mode, we need to handle the MACRO |
872 | /* In MRI mode, we need to handle the MACRO |
868 | pseudo-op specially: we don't want to put the |
873 | pseudo-op specially: we don't want to put the |
869 | symbol in the symbol table. */ |
874 | symbol in the symbol table. */ |
870 | if (!mri_line_macro |
875 | if (!mri_line_macro |
871 | #ifdef TC_START_LABEL_WITHOUT_COLON |
876 | #ifdef TC_START_LABEL_WITHOUT_COLON |
872 | && TC_START_LABEL_WITHOUT_COLON(c, |
877 | && TC_START_LABEL_WITHOUT_COLON (nul_char, next_char) |
873 | input_line_pointer) |
- | |
874 | #endif |
878 | #endif |
875 | ) |
879 | ) |
876 | line_label = colon (line_start); |
880 | line_label = colon (line_start); |
877 | else |
881 | else |
878 | line_label = symbol_create (line_start, |
882 | line_label = symbol_create (line_start, |
879 | absolute_section, |
883 | absolute_section, |
880 | (valueT) 0, |
884 | (valueT) 0, |
881 | &zero_address_frag); |
885 | &zero_address_frag); |
Line 882... | Line 886... | ||
882 | 886 | ||
883 | *input_line_pointer = c; |
887 | next_char = restore_line_pointer (nul_char); |
884 | if (c == ':') |
888 | if (next_char == ':') |
885 | input_line_pointer++; |
889 | input_line_pointer++; |
886 | } |
890 | } |
887 | } |
891 | } |
Line 894... | Line 898... | ||
894 | Depending on what compiler is used, the order of these tests |
898 | Depending on what compiler is used, the order of these tests |
895 | may vary to catch most common case 1st. |
899 | may vary to catch most common case 1st. |
896 | Each test is independent of all other tests at the (top) |
900 | Each test is independent of all other tests at the (top) |
897 | level. */ |
901 | level. */ |
898 | do |
902 | do |
899 | c = *input_line_pointer++; |
903 | nul_char = next_char = *input_line_pointer++; |
900 | while (c == '\t' || c == ' ' || c == '\f'); |
904 | while (next_char == '\t' || next_char == ' ' || next_char == '\f'); |
Line 901... | Line 905... | ||
901 | 905 | ||
902 | /* C is the 1st significant character. |
906 | /* C is the 1st significant character. |
903 | Input_line_pointer points after that character. */ |
907 | Input_line_pointer points after that character. */ |
904 | if (is_name_beginner (c)) |
908 | if (is_name_beginner (next_char) || next_char == '"') |
- | 909 | { |
|
- | 910 | char *rest; |
|
905 | { |
911 | |
906 | /* Want user-defined label or pseudo/opcode. */ |
912 | /* Want user-defined label or pseudo/opcode. */ |
Line 907... | Line 913... | ||
907 | HANDLE_CONDITIONAL_ASSEMBLY (); |
913 | HANDLE_CONDITIONAL_ASSEMBLY (1); |
908 | 914 | ||
- | 915 | --input_line_pointer; |
|
- | 916 | nul_char = get_symbol_name (& s); /* name's delimiter. */ |
|
Line 909... | Line 917... | ||
909 | s = --input_line_pointer; |
917 | next_char = (nul_char == '"' ? input_line_pointer[1] : nul_char); |
910 | c = get_symbol_end (); /* name's delimiter. */ |
918 | rest = input_line_pointer + (nul_char == '"' ? 2 : 1); |
911 | 919 | ||
912 | /* C is character after symbol. |
920 | /* NEXT_CHAR is character after symbol. |
913 | That character's place in the input line is now '\0'. |
921 | The end of symbol in the input line is now '\0'. |
914 | S points to the beginning of the symbol. |
922 | S points to the beginning of the symbol. |
915 | [In case of pseudo-op, s->'.'.] |
923 | [In case of pseudo-op, s->'.'.] |
916 | Input_line_pointer->'\0' where c was. */ |
924 | Input_line_pointer->'\0' where NUL_CHAR was. */ |
917 | if (TC_START_LABEL (c, s, input_line_pointer)) |
925 | if (TC_START_LABEL (s, nul_char, next_char)) |
918 | { |
- | |
919 | if (flag_m68k_mri) |
- | |
920 | { |
926 | { |
921 | char *rest = input_line_pointer + 1; |
927 | if (flag_m68k_mri) |
922 | 928 | { |
|
Line 923... | Line 929... | ||
923 | /* In MRI mode, \tsym: set 0 is permitted. */ |
929 | /* In MRI mode, \tsym: set 0 is permitted. */ |
Line 936... | Line 942... | ||
936 | continue; |
942 | continue; |
937 | } |
943 | } |
938 | } |
944 | } |
Line 939... | Line 945... | ||
939 | 945 | ||
940 | line_label = colon (s); /* User-defined label. */ |
946 | line_label = colon (s); /* User-defined label. */ |
941 | /* Put ':' back for error messages' sake. */ |
947 | restore_line_pointer (nul_char); |
942 | *input_line_pointer++ = ':'; |
948 | ++ input_line_pointer; |
943 | #ifdef tc_check_label |
949 | #ifdef tc_check_label |
944 | tc_check_label (line_label); |
950 | tc_check_label (line_label); |
945 | #endif |
951 | #endif |
946 | /* Input_line_pointer->after ':'. */ |
952 | /* Input_line_pointer->after ':'. */ |
947 | SKIP_WHITESPACE (); |
953 | SKIP_WHITESPACE (); |
948 | } |
954 | } |
949 | else if ((c == '=' && input_line_pointer[1] == '=') |
955 | else if ((next_char == '=' && *rest == '=') |
950 | || ((c == ' ' || c == '\t') |
956 | || ((next_char == ' ' || next_char == '\t') |
951 | && input_line_pointer[1] == '=' |
957 | && rest[0] == '=' |
952 | && input_line_pointer[2] == '=')) |
958 | && rest[1] == '=')) |
953 | { |
959 | { |
954 | equals (s, -1); |
960 | equals (s, -1); |
955 | demand_empty_rest_of_line (); |
961 | demand_empty_rest_of_line (); |
956 | } |
962 | } |
957 | else if ((c == '=' |
963 | else if ((next_char == '=' |
958 | || ((c == ' ' || c == '\t') |
964 | || ((next_char == ' ' || next_char == '\t') |
959 | && input_line_pointer[1] == '=')) |
965 | && *rest == '=')) |
960 | #ifdef TC_EQUAL_IN_INSN |
966 | #ifdef TC_EQUAL_IN_INSN |
961 | && !TC_EQUAL_IN_INSN (c, s) |
967 | && !TC_EQUAL_IN_INSN (next_char, s) |
962 | #endif |
968 | #endif |
963 | ) |
969 | ) |
964 | { |
970 | { |
965 | equals (s, 1); |
971 | equals (s, 1); |
Line 996... | Line 1002... | ||
996 | if (pop != NULL |
1002 | if (pop != NULL |
997 | || (!flag_m68k_mri && *s == '.')) |
1003 | || (!flag_m68k_mri && *s == '.')) |
998 | { |
1004 | { |
999 | /* PSEUDO - OP. |
1005 | /* PSEUDO - OP. |
Line 1000... | Line 1006... | ||
1000 | 1006 | ||
1001 | WARNING: c has next char, which may be end-of-line. |
1007 | WARNING: next_char may be end-of-line. |
1002 | We lookup the pseudo-op table with s+1 because we |
1008 | We lookup the pseudo-op table with s+1 because we |
Line 1003... | Line 1009... | ||
1003 | already know that the pseudo-op begins with a '.'. */ |
1009 | already know that the pseudo-op begins with a '.'. */ |
1004 | 1010 | ||
Line 1041... | Line 1047... | ||
1041 | /* Print the error msg now, while we still can. */ |
1047 | /* Print the error msg now, while we still can. */ |
1042 | if (pop == NULL) |
1048 | if (pop == NULL) |
1043 | { |
1049 | { |
1044 | char *end = input_line_pointer; |
1050 | char *end = input_line_pointer; |
Line 1045... | Line 1051... | ||
1045 | 1051 | ||
1046 | *input_line_pointer = c; |
1052 | (void) restore_line_pointer (nul_char); |
1047 | s_ignore (0); |
1053 | s_ignore (0); |
1048 | c = *--input_line_pointer; |
1054 | nul_char = next_char = *--input_line_pointer; |
1049 | *input_line_pointer = '\0'; |
1055 | *input_line_pointer = '\0'; |
1050 | if (! macro_defined || ! try_macro (c, s)) |
1056 | if (! macro_defined || ! try_macro (next_char, s)) |
1051 | { |
1057 | { |
1052 | *end = '\0'; |
1058 | *end = '\0'; |
1053 | as_bad (_("unknown pseudo-op: `%s'"), s); |
1059 | as_bad (_("unknown pseudo-op: `%s'"), s); |
1054 | *input_line_pointer++ = c; |
1060 | *input_line_pointer++ = nul_char; |
1055 | } |
1061 | } |
1056 | continue; |
1062 | continue; |
Line 1057... | Line 1063... | ||
1057 | } |
1063 | } |
1058 | 1064 | ||
1059 | /* Put it back for error messages etc. */ |
1065 | /* Put it back for error messages etc. */ |
1060 | *input_line_pointer = c; |
1066 | next_char = restore_line_pointer (nul_char); |
1061 | /* The following skip of whitespace is compulsory. |
1067 | /* The following skip of whitespace is compulsory. |
1062 | A well shaped space is sometimes all that separates |
1068 | A well shaped space is sometimes all that separates |
1063 | keyword from operands. */ |
1069 | keyword from operands. */ |
Line 1064... | Line 1070... | ||
1064 | if (c == ' ' || c == '\t') |
1070 | if (next_char == ' ' || next_char == '\t') |
1065 | input_line_pointer++; |
1071 | input_line_pointer++; |
1066 | 1072 | ||
Line 1073... | Line 1079... | ||
1073 | if (pop->poc_handler == s_end) |
1079 | if (pop->poc_handler == s_end) |
1074 | goto quit; |
1080 | goto quit; |
1075 | } |
1081 | } |
1076 | else |
1082 | else |
1077 | { |
1083 | { |
1078 | /* WARNING: c has char, which may be end-of-line. */ |
1084 | /* WARNING: next_char may be end-of-line. */ |
1079 | /* Also: input_line_pointer->`\0` where c was. */ |
1085 | /* Also: input_line_pointer->`\0` where nul_char was. */ |
1080 | *input_line_pointer = c; |
1086 | (void) restore_line_pointer (nul_char); |
1081 | input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1, 0); |
1087 | input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1, 0); |
1082 | c = *input_line_pointer; |
1088 | next_char = nul_char = *input_line_pointer; |
1083 | *input_line_pointer = '\0'; |
1089 | *input_line_pointer = '\0'; |
Line 1084... | Line 1090... | ||
1084 | 1090 | ||
Line 1085... | Line 1091... | ||
1085 | generate_lineno_debug (); |
1091 | generate_lineno_debug (); |
1086 | 1092 | ||
Line 1087... | Line 1093... | ||
1087 | if (macro_defined && try_macro (c, s)) |
1093 | if (macro_defined && try_macro (next_char, s)) |
1088 | continue; |
1094 | continue; |
1089 | 1095 | ||
Line 1098... | Line 1104... | ||
1098 | } |
1104 | } |
1099 | } |
1105 | } |
Line 1100... | Line 1106... | ||
1100 | 1106 | ||
Line 1101... | Line 1107... | ||
1101 | assemble_one (s); /* Assemble 1 instruction. */ |
1107 | assemble_one (s); /* Assemble 1 instruction. */ |
Line 1102... | Line 1108... | ||
1102 | 1108 | ||
1103 | *input_line_pointer++ = c; |
1109 | *input_line_pointer++ = nul_char; |
1104 | 1110 | ||
1105 | /* We resume loop AFTER the end-of-line from |
1111 | /* We resume loop AFTER the end-of-line from |
1106 | this instruction. */ |
1112 | this instruction. */ |
1107 | } |
1113 | } |
Line 1108... | Line 1114... | ||
1108 | } |
1114 | } |
1109 | continue; |
1115 | continue; |
1110 | } |
1116 | } |
Line 1111... | Line 1117... | ||
1111 | 1117 | ||
1112 | /* Empty statement? */ |
1118 | /* Empty statement? */ |
1113 | if (is_end_of_line[(unsigned char) c]) |
1119 | if (is_end_of_line[(unsigned char) next_char]) |
1114 | continue; |
1120 | continue; |
Line 1115... | Line 1121... | ||
1115 | 1121 | ||
Line 1116... | Line 1122... | ||
1116 | if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c)) |
1122 | if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (next_char)) |
- | 1123 | { |
|
- | 1124 | /* local label ("4:") */ |
|
- | 1125 | char *backup = input_line_pointer; |
|
Line 1117... | Line 1126... | ||
1117 | { |
1126 | |
1118 | /* local label ("4:") */ |
1127 | HANDLE_CONDITIONAL_ASSEMBLY (1); |
1119 | char *backup = input_line_pointer; |
1128 | |
1120 | 1129 | temp = next_char - '0'; |
|
Line 1152... | Line 1161... | ||
1152 | colon (fb_label_name (temp, 0)); |
1161 | colon (fb_label_name (temp, 0)); |
1153 | continue; |
1162 | continue; |
1154 | } |
1163 | } |
Line 1155... | Line 1164... | ||
1155 | 1164 | ||
1156 | input_line_pointer = backup; |
1165 | input_line_pointer = backup; |
Line 1157... | Line 1166... | ||
1157 | } /* local label ("4:") */ |
1166 | } |
1158 | 1167 | ||
1159 | if (c && strchr (line_comment_chars, c)) |
1168 | if (next_char && strchr (line_comment_chars, next_char)) |
1160 | { /* Its a comment. Better say APP or NO_APP. */ |
1169 | { /* Its a comment. Better say APP or NO_APP. */ |
1161 | sb sbuf; |
1170 | sb sbuf; |
1162 | char *ends; |
1171 | char *ends; |
Line 1263... | Line 1272... | ||
1263 | buffer_limit = input_scrub_next_buffer (&input_line_pointer); |
1272 | buffer_limit = input_scrub_next_buffer (&input_line_pointer); |
1264 | free (new_buf); |
1273 | free (new_buf); |
1265 | continue; |
1274 | continue; |
1266 | } |
1275 | } |
Line 1267... | Line 1276... | ||
1267 | 1276 | ||
Line 1268... | Line 1277... | ||
1268 | HANDLE_CONDITIONAL_ASSEMBLY (); |
1277 | HANDLE_CONDITIONAL_ASSEMBLY (1); |
1269 | 1278 | ||
1270 | #ifdef tc_unrecognized_line |
1279 | #ifdef tc_unrecognized_line |
1271 | if (tc_unrecognized_line (c)) |
1280 | if (tc_unrecognized_line (next_char)) |
1272 | continue; |
1281 | continue; |
1273 | #endif |
1282 | #endif |
1274 | input_line_pointer--; |
1283 | input_line_pointer--; |
Line 1467... | Line 1476... | ||
1467 | } |
1476 | } |
1468 | else |
1477 | else |
1469 | { |
1478 | { |
1470 | align = get_absolute_expression (); |
1479 | align = get_absolute_expression (); |
1471 | SKIP_WHITESPACE (); |
1480 | SKIP_WHITESPACE (); |
- | 1481 | ||
- | 1482 | #ifdef TC_ALIGN_ZERO_IS_DEFAULT |
|
- | 1483 | if (arg > 0 && align == 0) |
|
- | 1484 | align = arg; |
|
- | 1485 | #endif |
|
1472 | } |
1486 | } |
Line 1473... | Line 1487... | ||
1473 | 1487 | ||
1474 | if (bytes_p) |
1488 | if (bytes_p) |
1475 | { |
1489 | { |
Line 1575... | Line 1589... | ||
1575 | s_align (arg, 0); |
1589 | s_align (arg, 0); |
1576 | } |
1590 | } |
Line 1577... | Line 1591... | ||
1577 | 1591 | ||
Line 1578... | Line 1592... | ||
1578 | /* Switch in and out of alternate macro mode. */ |
1592 | /* Switch in and out of alternate macro mode. */ |
1579 | 1593 | ||
1580 | void |
1594 | static void |
1581 | s_altmacro (int on) |
1595 | s_altmacro (int on) |
1582 | { |
1596 | { |
1583 | demand_empty_rest_of_line (); |
1597 | demand_empty_rest_of_line (); |
Line 1596... | Line 1610... | ||
1596 | Advances i_l_p to the next non-whitespace character. |
1610 | Advances i_l_p to the next non-whitespace character. |
Line 1597... | Line 1611... | ||
1597 | 1611 | ||
1598 | If a symbol name could not be read, the routine issues an error |
1612 | If a symbol name could not be read, the routine issues an error |
Line 1599... | Line 1613... | ||
1599 | messages, skips to the end of the line and returns NULL. */ |
1613 | messages, skips to the end of the line and returns NULL. */ |
1600 | 1614 | ||
1601 | static char * |
1615 | char * |
1602 | read_symbol_name (void) |
1616 | read_symbol_name (void) |
1603 | { |
1617 | { |
1604 | char * name; |
1618 | char * name; |
Line 1701... | Line 1715... | ||
1701 | if (*input_line_pointer == ',') |
1715 | if (*input_line_pointer == ',') |
1702 | input_line_pointer++; |
1716 | input_line_pointer++; |
Line 1703... | Line 1717... | ||
1703 | 1717 | ||
1704 | temp = get_absolute_expr (&exp); |
1718 | temp = get_absolute_expr (&exp); |
1705 | size = temp; |
1719 | size = temp; |
1706 | size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1; |
1720 | size &= ((addressT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1; |
1707 | if (exp.X_op == O_absent) |
1721 | if (exp.X_op == O_absent) |
1708 | { |
1722 | { |
1709 | as_bad (_("missing size expression")); |
1723 | as_bad (_("missing size expression")); |
1710 | ignore_rest_of_line (); |
1724 | ignore_rest_of_line (); |
Line 1791... | Line 1805... | ||
1791 | 1805 | ||
Line 1792... | Line 1806... | ||
1792 | SKIP_WHITESPACE (); |
1806 | SKIP_WHITESPACE (); |
1793 | 1807 | ||
1794 | name = input_line_pointer; |
1808 | name = input_line_pointer; |
1795 | if (!ISDIGIT (*name)) |
1809 | if (!ISDIGIT (*name)) |
1796 | c = get_symbol_end (); |
1810 | c = get_symbol_name (& name); |
1797 | else |
1811 | else |
1798 | { |
1812 | { |
1799 | do |
1813 | do |
Line 1814... | Line 1828... | ||
1814 | name = alc; |
1828 | name = alc; |
1815 | } |
1829 | } |
1816 | } |
1830 | } |
Line 1817... | Line 1831... | ||
1817 | 1831 | ||
1818 | sym = symbol_find_or_make (name); |
1832 | sym = symbol_find_or_make (name); |
1819 | *input_line_pointer = c; |
1833 | c = restore_line_pointer (c); |
1820 | if (alc != NULL) |
1834 | if (alc != NULL) |
Line 1821... | Line 1835... | ||
1821 | free (alc); |
1835 | free (alc); |
1822 | 1836 | ||
Line 2334... | Line 2348... | ||
2334 | if (!is_end_of_line[(unsigned char) *input_line_pointer]) |
2348 | if (!is_end_of_line[(unsigned char) *input_line_pointer]) |
2335 | { |
2349 | { |
2336 | char *s; |
2350 | char *s; |
2337 | char c; |
2351 | char c; |
Line 2338... | Line -... | ||
2338 | - | ||
2339 | s = input_line_pointer; |
2352 | |
2340 | c = get_symbol_end (); |
2353 | c = get_symbol_name (& s); |
2341 | if (strcasecmp (s, "discard") == 0) |
2354 | if (strcasecmp (s, "discard") == 0) |
2342 | type = LINKONCE_DISCARD; |
2355 | type = LINKONCE_DISCARD; |
2343 | else if (strcasecmp (s, "one_only") == 0) |
2356 | else if (strcasecmp (s, "one_only") == 0) |
2344 | type = LINKONCE_ONE_ONLY; |
2357 | type = LINKONCE_ONE_ONLY; |
Line 2347... | Line 2360... | ||
2347 | else if (strcasecmp (s, "same_contents") == 0) |
2360 | else if (strcasecmp (s, "same_contents") == 0) |
2348 | type = LINKONCE_SAME_CONTENTS; |
2361 | type = LINKONCE_SAME_CONTENTS; |
2349 | else |
2362 | else |
2350 | as_warn (_("unrecognized .linkonce type `%s'"), s); |
2363 | as_warn (_("unrecognized .linkonce type `%s'"), s); |
Line 2351... | Line 2364... | ||
2351 | 2364 | ||
2352 | *input_line_pointer = c; |
2365 | (void) restore_line_pointer (c); |
Line 2353... | Line 2366... | ||
2353 | } |
2366 | } |
2354 | 2367 | ||
2355 | #ifdef obj_handle_link_once |
2368 | #ifdef obj_handle_link_once |
Line 2841... | Line 2854... | ||
2841 | 2854 | ||
Line 2842... | Line 2855... | ||
2842 | SKIP_WHITESPACE (); |
2855 | SKIP_WHITESPACE (); |
2843 | 2856 | ||
2844 | name = input_line_pointer; |
2857 | name = input_line_pointer; |
2845 | if (!ISDIGIT (*name)) |
2858 | if (!ISDIGIT (*name)) |
2846 | c = get_symbol_end (); |
2859 | c = get_symbol_name (& name); |
2847 | else |
2860 | else |
2848 | { |
2861 | { |
2849 | do |
2862 | do |
Line 2856... | Line 2869... | ||
2856 | *input_line_pointer = '\0'; |
2869 | *input_line_pointer = '\0'; |
2857 | } |
2870 | } |
Line 2858... | Line 2871... | ||
2858 | 2871 | ||
Line 2859... | Line 2872... | ||
2859 | name = xstrdup (name); |
2872 | name = xstrdup (name); |
Line 2860... | Line 2873... | ||
2860 | 2873 | ||
Line 2861... | Line 2874... | ||
2861 | *input_line_pointer = c; |
2874 | c = restore_line_pointer (c); |
2862 | 2875 | ||
2863 | seg = subseg_new (name, 0); |
2876 | seg = subseg_new (name, 0); |
Line 2864... | Line 2877... | ||
2864 | 2877 | ||
2865 | if (*input_line_pointer == ',') |
2878 | if (c == ',') |
Line 2915... | Line 2928... | ||
2915 | char c; |
2928 | char c; |
2916 | segT seg; |
2929 | segT seg; |
Line 2917... | Line 2930... | ||
2917 | 2930 | ||
Line 2918... | Line -... | ||
2918 | SKIP_WHITESPACE (); |
- | |
2919 | 2931 | SKIP_WHITESPACE (); |
|
Line 2920... | Line 2932... | ||
2920 | name = input_line_pointer; |
2932 | |
Line 2921... | Line 2933... | ||
2921 | c = get_symbol_end (); |
2933 | c = get_symbol_name (& name); |
Line 2922... | Line 2934... | ||
2922 | 2934 | ||
Line 2923... | Line 2935... | ||
2923 | name = xstrdup (name); |
2935 | name = xstrdup (name); |
2924 | 2936 | ||
2925 | *input_line_pointer = c; |
2937 | c = restore_line_pointer (c); |
2926 | 2938 | ||
2927 | seg = subseg_new (name, 0); |
2939 | seg = subseg_new (name, 0); |
Line 2928... | Line 2940... | ||
2928 | 2940 | ||
2929 | if (*input_line_pointer != ',') |
2941 | if (c != ',') |
2930 | *type = 'C'; |
- | |
2931 | else |
2942 | *type = 'C'; |
2932 | { |
2943 | else |
2933 | char *sectype; |
2944 | { |
2934 | 2945 | char *sectype; |
|
2935 | ++input_line_pointer; |
2946 | |
2936 | SKIP_WHITESPACE (); |
2947 | ++input_line_pointer; |
2937 | sectype = input_line_pointer; |
2948 | SKIP_WHITESPACE (); |
2938 | c = get_symbol_end (); |
2949 | c = get_symbol_name (& sectype); |
2939 | if (*sectype == '\0') |
2950 | if (*sectype == '\0') |
2940 | *type = 'C'; |
2951 | *type = 'C'; |
2941 | else if (strcasecmp (sectype, "text") == 0) |
2952 | else if (strcasecmp (sectype, "text") == 0) |
2942 | *type = 'C'; |
2953 | *type = 'C'; |
2943 | else if (strcasecmp (sectype, "data") == 0) |
2954 | else if (strcasecmp (sectype, "data") == 0) |
Line 2944... | Line 2955... | ||
2944 | *type = 'D'; |
2955 | *type = 'D'; |
2945 | else if (strcasecmp (sectype, "romdata") == 0) |
2956 | else if (strcasecmp (sectype, "romdata") == 0) |
2946 | *type = 'R'; |
2957 | *type = 'R'; |
Line 2947... | Line 2958... | ||
2947 | else |
2958 | else |
2948 | as_warn (_("unrecognized section type `%s'"), sectype); |
2959 | as_warn (_("unrecognized section type `%s'"), sectype); |
2949 | *input_line_pointer = c; |
- | |
2950 | } |
2960 | (void) restore_line_pointer (c); |
2951 | 2961 | } |
|
2952 | if (*input_line_pointer == ',') |
2962 | |
2953 | { |
2963 | if (*input_line_pointer == ',') |
2954 | char *seccmd; |
2964 | { |
2955 | 2965 | char *seccmd; |
|
Line 2966... | Line 2976... | ||
2966 | } |
2976 | } |
2967 | else if (strcasecmp (seccmd, "align") == 0) |
2977 | else if (strcasecmp (seccmd, "align") == 0) |
2968 | { |
2978 | { |
2969 | int align; |
2979 | int align; |
Line 2970... | Line 2980... | ||
2970 | 2980 | ||
2971 | *input_line_pointer = c; |
2981 | (void) restore_line_pointer (c); |
2972 | align = get_absolute_expression (); |
2982 | align = get_absolute_expression (); |
2973 | record_alignment (seg, align); |
2983 | record_alignment (seg, align); |
2974 | } |
2984 | } |
2975 | else |
2985 | else |
2976 | { |
2986 | { |
2977 | as_warn (_("unrecognized section command `%s'"), seccmd); |
2987 | as_warn (_("unrecognized section command `%s'"), seccmd); |
2978 | *input_line_pointer = c; |
2988 | (void) restore_line_pointer (c); |
2979 | } |
2989 | } |
Line 2980... | Line 2990... | ||
2980 | } |
2990 | } |
Line 3019... | Line 3029... | ||
3019 | { |
3029 | { |
3020 | char *name; |
3030 | char *name; |
3021 | char c; |
3031 | char c; |
Line 3022... | Line 3032... | ||
3022 | 3032 | ||
3023 | SKIP_WHITESPACE (); |
- | |
3024 | name = input_line_pointer; |
3033 | SKIP_WHITESPACE (); |
3025 | c = get_symbol_end (); |
3034 | c = get_symbol_name (& name); |
3026 | delete_macro (name); |
3035 | delete_macro (name); |
3027 | *input_line_pointer = c; |
3036 | *input_line_pointer = c; |
3028 | SKIP_WHITESPACE (); |
3037 | SKIP_WHITESPACE_AFTER_NAME (); |
3029 | } |
3038 | } |
Line 3030... | Line 3039... | ||
3030 | while (*input_line_pointer++ == ','); |
3039 | while (*input_line_pointer++ == ','); |
3031 | 3040 | ||
Line 3184... | Line 3193... | ||
3184 | dummy_frag->line = listing_tail; |
3193 | dummy_frag->line = listing_tail; |
3185 | dummy_frag->fr_symbol = symbolP; |
3194 | dummy_frag->fr_symbol = symbolP; |
3186 | symbol_set_frag (symbolP, dummy_frag); |
3195 | symbol_set_frag (symbolP, dummy_frag); |
3187 | } |
3196 | } |
3188 | #endif |
3197 | #endif |
3189 | #ifdef OBJ_COFF |
3198 | #if defined (OBJ_COFF) && !defined (TE_PE) |
3190 | /* "set" symbols are local unless otherwise specified. */ |
3199 | /* "set" symbols are local unless otherwise specified. */ |
3191 | SF_SET_LOCAL (symbolP); |
3200 | SF_SET_LOCAL (symbolP); |
3192 | #endif |
3201 | #endif |
3193 | } |
3202 | } |
Line 3848... | Line 3857... | ||
3848 | parse_mri_cons (expressionS *exp, unsigned int nbytes); |
3857 | parse_mri_cons (expressionS *exp, unsigned int nbytes); |
3849 | #endif |
3858 | #endif |
Line 3850... | Line 3859... | ||
3850 | 3859 | ||
3851 | #ifndef TC_PARSE_CONS_EXPRESSION |
3860 | #ifndef TC_PARSE_CONS_EXPRESSION |
3852 | #ifdef BITFIELD_CONS_EXPRESSIONS |
3861 | #ifdef BITFIELD_CONS_EXPRESSIONS |
- | 3862 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \ |
|
3853 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES) |
3863 | (parse_bitfield_cons (EXP, NBYTES), TC_PARSE_CONS_RETURN_NONE) |
3854 | static void |
3864 | static void |
3855 | parse_bitfield_cons (expressionS *exp, unsigned int nbytes); |
3865 | parse_bitfield_cons (expressionS *exp, unsigned int nbytes); |
3856 | #endif |
3866 | #endif |
3857 | #ifdef REPEAT_CONS_EXPRESSIONS |
3867 | #ifdef REPEAT_CONS_EXPRESSIONS |
- | 3868 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \ |
|
3858 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES) |
3869 | (parse_repeat_cons (EXP, NBYTES), TC_PARSE_CONS_RETURN_NONE) |
3859 | static void |
3870 | static void |
3860 | parse_repeat_cons (expressionS *exp, unsigned int nbytes); |
3871 | parse_repeat_cons (expressionS *exp, unsigned int nbytes); |
Line 3861... | Line 3872... | ||
3861 | #endif |
3872 | #endif |
3862 | 3873 | ||
3863 | /* If we haven't gotten one yet, just call expression. */ |
3874 | /* If we haven't gotten one yet, just call expression. */ |
- | 3875 | #ifndef TC_PARSE_CONS_EXPRESSION |
|
3864 | #ifndef TC_PARSE_CONS_EXPRESSION |
3876 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \ |
3865 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP) |
3877 | (expression (EXP), TC_PARSE_CONS_RETURN_NONE) |
Line 3866... | Line 3878... | ||
3866 | #endif |
3878 | #endif |
3867 | #endif |
3879 | #endif |
3868 | 3880 | ||
3869 | void |
3881 | void |
3870 | do_parse_cons_expression (expressionS *exp, |
3882 | do_parse_cons_expression (expressionS *exp, |
3871 | int nbytes ATTRIBUTE_UNUSED) |
3883 | int nbytes ATTRIBUTE_UNUSED) |
Line 3872... | Line 3884... | ||
3872 | { |
3884 | { |
3873 | TC_PARSE_CONS_EXPRESSION (exp, nbytes); |
3885 | (void) TC_PARSE_CONS_EXPRESSION (exp, nbytes); |
Line 3911... | Line 3923... | ||
3911 | #endif |
3923 | #endif |
Line 3912... | Line 3924... | ||
3912 | 3924 | ||
3913 | c = 0; |
3925 | c = 0; |
3914 | do |
3926 | do |
- | 3927 | { |
|
- | 3928 | TC_PARSE_CONS_RETURN_TYPE ret = TC_PARSE_CONS_RETURN_NONE; |
|
- | 3929 | #ifdef TC_CONS_FIX_CHECK |
|
- | 3930 | fixS **cur_fix = &frchain_now->fix_tail; |
|
- | 3931 | ||
- | 3932 | if (*cur_fix != NULL) |
|
- | 3933 | cur_fix = &(*cur_fix)->fx_next; |
|
- | 3934 | #endif |
|
3915 | { |
3935 | |
3916 | #ifdef TC_M68K |
3936 | #ifdef TC_M68K |
3917 | if (flag_m68k_mri) |
3937 | if (flag_m68k_mri) |
3918 | parse_mri_cons (&exp, (unsigned int) nbytes); |
3938 | parse_mri_cons (&exp, (unsigned int) nbytes); |
3919 | else |
3939 | else |
3920 | #endif |
3940 | #endif |
- | 3941 | { |
|
3921 | { |
3942 | #if 0 |
3922 | if (*input_line_pointer == '"') |
3943 | if (*input_line_pointer == '"') |
3923 | { |
3944 | { |
3924 | as_bad (_("unexpected `\"' in expression")); |
3945 | as_bad (_("unexpected `\"' in expression")); |
3925 | ignore_rest_of_line (); |
3946 | ignore_rest_of_line (); |
3926 | return; |
3947 | return; |
- | 3948 | } |
|
3927 | } |
3949 | #endif |
3928 | TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes); |
3950 | ret = TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes); |
Line 3929... | Line 3951... | ||
3929 | } |
3951 | } |
3930 | 3952 | ||
3931 | if (rva) |
3953 | if (rva) |
3932 | { |
3954 | { |
3933 | if (exp.X_op == O_symbol) |
3955 | if (exp.X_op == O_symbol) |
3934 | exp.X_op = O_symbol_rva; |
3956 | exp.X_op = O_symbol_rva; |
3935 | else |
3957 | else |
3936 | as_fatal (_("rva without symbol")); |
3958 | as_fatal (_("rva without symbol")); |
- | 3959 | } |
|
- | 3960 | emit_expr_with_reloc (&exp, (unsigned int) nbytes, ret); |
|
- | 3961 | #ifdef TC_CONS_FIX_CHECK |
|
3937 | } |
3962 | TC_CONS_FIX_CHECK (&exp, nbytes, *cur_fix); |
3938 | emit_expr (&exp, (unsigned int) nbytes); |
3963 | #endif |
3939 | ++c; |
3964 | ++c; |
Line 3940... | Line 3965... | ||
3940 | } |
3965 | } |
Line 3966... | Line 3991... | ||
3966 | cons_worker (size, 1); |
3991 | cons_worker (size, 1); |
3967 | } |
3992 | } |
Line 3968... | Line 3993... | ||
3968 | 3993 | ||
Line 3969... | Line 3994... | ||
3969 | /* .reloc offset, reloc_name, symbol+addend. */ |
3994 | /* .reloc offset, reloc_name, symbol+addend. */ |
3970 | 3995 | ||
3971 | void |
3996 | static void |
3972 | s_reloc (int ignore ATTRIBUTE_UNUSED) |
3997 | s_reloc (int ignore ATTRIBUTE_UNUSED) |
3973 | { |
3998 | { |
3974 | char *stop = NULL; |
3999 | char *stop = NULL; |
3975 | char stopc = 0; |
4000 | char stopc = 0; |
3976 | expressionS exp; |
4001 | expressionS exp; |
3977 | char *r_name; |
4002 | char *r_name; |
- | 4003 | int c; |
|
- | 4004 | struct reloc_list *reloc; |
|
- | 4005 | struct _bfd_rel { char *name; bfd_reloc_code_real_type code; }; |
|
- | 4006 | static struct _bfd_rel bfd_relocs[] = { |
|
- | 4007 | { "NONE", BFD_RELOC_NONE }, |
|
- | 4008 | { "8", BFD_RELOC_8 }, |
|
- | 4009 | { "16", BFD_RELOC_16 }, |
|
- | 4010 | { "32", BFD_RELOC_32 }, |
|
Line 3978... | Line 4011... | ||
3978 | int c; |
4011 | { "64", BFD_RELOC_64 } |
Line 3979... | Line 4012... | ||
3979 | struct reloc_list *reloc; |
4012 | }; |
3980 | 4013 | ||
Line 4015... | Line 4048... | ||
4015 | goto err_out; |
4048 | goto err_out; |
4016 | } |
4049 | } |
Line 4017... | Line 4050... | ||
4017 | 4050 | ||
4018 | ++input_line_pointer; |
4051 | ++input_line_pointer; |
4019 | SKIP_WHITESPACE (); |
4052 | SKIP_WHITESPACE (); |
- | 4053 | c = get_symbol_name (& r_name); |
|
- | 4054 | if (strncasecmp (r_name, "BFD_RELOC_", 10) == 0) |
|
4020 | r_name = input_line_pointer; |
4055 | { |
- | 4056 | unsigned int i; |
|
- | 4057 | ||
- | 4058 | for (reloc->u.a.howto = NULL, i = 0; i < ARRAY_SIZE (bfd_relocs); i++) |
|
- | 4059 | if (strcasecmp (r_name + 10, bfd_relocs[i].name) == 0) |
|
- | 4060 | { |
|
- | 4061 | reloc->u.a.howto = bfd_reloc_type_lookup (stdoutput, |
|
- | 4062 | bfd_relocs[i].code); |
|
- | 4063 | break; |
|
- | 4064 | } |
|
- | 4065 | } |
|
4021 | c = get_symbol_end (); |
4066 | else |
4022 | reloc->u.a.howto = bfd_reloc_name_lookup (stdoutput, r_name); |
4067 | reloc->u.a.howto = bfd_reloc_name_lookup (stdoutput, r_name); |
4023 | *input_line_pointer = c; |
4068 | *input_line_pointer = c; |
4024 | if (reloc->u.a.howto == NULL) |
4069 | if (reloc->u.a.howto == NULL) |
4025 | { |
4070 | { |
4026 | as_bad (_("unrecognized reloc type")); |
4071 | as_bad (_("unrecognized reloc type")); |
4027 | goto err_out; |
4072 | goto err_out; |
Line 4028... | Line 4073... | ||
4028 | } |
4073 | } |
4029 | 4074 | ||
4030 | exp.X_op = O_absent; |
4075 | exp.X_op = O_absent; |
4031 | SKIP_WHITESPACE (); |
4076 | SKIP_WHITESPACE_AFTER_NAME (); |
4032 | if (*input_line_pointer == ',') |
4077 | if (*input_line_pointer == ',') |
4033 | { |
4078 | { |
4034 | ++input_line_pointer; |
4079 | ++input_line_pointer; |
Line 4077... | Line 4122... | ||
4077 | NBYTES bytes. If need_pass_2 is 1, this does nothing. */ |
4122 | NBYTES bytes. If need_pass_2 is 1, this does nothing. */ |
Line 4078... | Line 4123... | ||
4078 | 4123 | ||
4079 | void |
4124 | void |
4080 | emit_expr (expressionS *exp, unsigned int nbytes) |
4125 | emit_expr (expressionS *exp, unsigned int nbytes) |
- | 4126 | { |
|
- | 4127 | emit_expr_with_reloc (exp, nbytes, TC_PARSE_CONS_RETURN_NONE); |
|
- | 4128 | } |
|
- | 4129 | ||
- | 4130 | void |
|
- | 4131 | emit_expr_with_reloc (expressionS *exp, |
|
- | 4132 | unsigned int nbytes, |
|
- | 4133 | TC_PARSE_CONS_RETURN_TYPE reloc) |
|
4081 | { |
4134 | { |
4082 | operatorT op; |
4135 | operatorT op; |
4083 | char *p; |
4136 | char *p; |
Line 4084... | Line 4137... | ||
4084 | valueT extra_digit = 0; |
4137 | valueT extra_digit = 0; |
Line 4218... | Line 4271... | ||
4218 | op = O_constant; |
4271 | op = O_constant; |
4219 | } |
4272 | } |
Line 4220... | Line 4273... | ||
4220 | 4273 | ||
Line -... | Line 4274... | ||
- | 4274 | p = frag_more ((int) nbytes); |
|
- | 4275 | ||
- | 4276 | if (reloc != TC_PARSE_CONS_RETURN_NONE) |
|
- | 4277 | { |
|
- | 4278 | emit_expr_fix (exp, nbytes, frag_now, p, reloc); |
|
- | 4279 | return; |
|
4221 | p = frag_more ((int) nbytes); |
4280 | } |
4222 | 4281 | ||
4223 | #ifndef WORKING_DOT_WORD |
4282 | #ifndef WORKING_DOT_WORD |
4224 | /* If we have the difference of two symbols in a word, save it on |
4283 | /* If we have the difference of two symbols in a word, save it on |
4225 | the broken_words list. See the code in write.c. */ |
4284 | the broken_words list. See the code in write.c. */ |
Line 4376... | Line 4435... | ||
4376 | p += CHARS_PER_LITTLENUM; |
4435 | p += CHARS_PER_LITTLENUM; |
4377 | } |
4436 | } |
4378 | } |
4437 | } |
4379 | } |
4438 | } |
4380 | else |
4439 | else |
4381 | emit_expr_fix (exp, nbytes, frag_now, p); |
4440 | emit_expr_fix (exp, nbytes, frag_now, p, TC_PARSE_CONS_RETURN_NONE); |
4382 | } |
4441 | } |
Line 4383... | Line 4442... | ||
4383 | 4442 | ||
4384 | void |
4443 | void |
- | 4444 | emit_expr_fix (expressionS *exp, unsigned int nbytes, fragS *frag, char *p, |
|
4385 | emit_expr_fix (expressionS *exp, unsigned int nbytes, fragS *frag, char *p) |
4445 | TC_PARSE_CONS_RETURN_TYPE r ATTRIBUTE_UNUSED) |
- | 4446 | { |
|
- | 4447 | int offset = 0; |
|
- | 4448 | unsigned int size = nbytes; |
|
4386 | { |
4449 | |
Line 4387... | Line 4450... | ||
4387 | memset (p, 0, nbytes); |
4450 | memset (p, 0, size); |
Line 4388... | Line 4451... | ||
4388 | 4451 | ||
4389 | /* Generate a fixS to record the symbol value. */ |
4452 | /* Generate a fixS to record the symbol value. */ |
4390 | 4453 | ||
- | 4454 | #ifdef TC_CONS_FIX_NEW |
|
4391 | #ifdef TC_CONS_FIX_NEW |
4455 | TC_CONS_FIX_NEW (frag, p - frag->fr_literal + offset, size, exp, r); |
4392 | TC_CONS_FIX_NEW (frag, p - frag->fr_literal, nbytes, exp); |
4456 | #else |
Line -... | Line 4457... | ||
- | 4457 | if (r != TC_PARSE_CONS_RETURN_NONE) |
|
- | 4458 | { |
|
- | 4459 | reloc_howto_type *reloc_howto; |
|
- | 4460 | ||
- | 4461 | reloc_howto = bfd_reloc_type_lookup (stdoutput, r); |
|
- | 4462 | size = bfd_get_reloc_size (reloc_howto); |
|
- | 4463 | ||
- | 4464 | if (size > nbytes) |
|
- | 4465 | { |
|
- | 4466 | as_bad (_("%s relocations do not fit in %u bytes\n"), |
|
- | 4467 | reloc_howto->name, nbytes); |
|
- | 4468 | return; |
|
- | 4469 | } |
|
4393 | #else |
4470 | else if (target_big_endian) |
4394 | { |
4471 | offset = nbytes - size; |
4395 | bfd_reloc_code_real_type r; |
4472 | } |
4396 | 4473 | else |
|
4397 | switch (nbytes) |
4474 | switch (size) |
4398 | { |
4475 | { |
Line 4410... | Line 4487... | ||
4410 | break; |
4487 | break; |
4411 | case 8: |
4488 | case 8: |
4412 | r = BFD_RELOC_64; |
4489 | r = BFD_RELOC_64; |
4413 | break; |
4490 | break; |
4414 | default: |
4491 | default: |
4415 | as_bad (_("unsupported BFD relocation size %u"), nbytes); |
4492 | as_bad (_("unsupported BFD relocation size %u"), size); |
4416 | r = BFD_RELOC_32; |
- | |
4417 | break; |
4493 | return; |
4418 | } |
- | |
4419 | fix_new_exp (frag, p - frag->fr_literal, (int) nbytes, exp, |
- | |
4420 | 0, r); |
- | |
4421 | } |
4494 | } |
- | 4495 | fix_new_exp (frag, p - frag->fr_literal + offset, size, |
|
- | 4496 | exp, 0, r); |
|
4422 | #endif |
4497 | #endif |
4423 | } |
4498 | } |
4424 | 4499 | ||
4425 | #ifdef BITFIELD_CONS_EXPRESSIONS |
4500 | #ifdef BITFIELD_CONS_EXPRESSIONS |
Line 4525... | Line 4600... | ||
4525 | *input_line_pointer = cache; |
4600 | *input_line_pointer = cache; |
4526 | demand_empty_rest_of_line (); |
4601 | demand_empty_rest_of_line (); |
4527 | return; |
4602 | return; |
4528 | } /* Too complex. */ |
4603 | } /* Too complex. */ |
Line 4529... | Line 4604... | ||
4529 | 4604 | ||
4530 | value |= ((~(-1 << width) & exp->X_add_number) |
4605 | value |= ((~(-(1 << width)) & exp->X_add_number) |
Line 4531... | Line 4606... | ||
4531 | << ((BITS_PER_CHAR * nbytes) - bits_available)); |
4606 | << ((BITS_PER_CHAR * nbytes) - bits_available)); |
4532 | 4607 | ||
4533 | if ((bits_available -= width) == 0 |
4608 | if ((bits_available -= width) == 0 |
Line 4552... | Line 4627... | ||
4552 | 4627 | ||
4553 | /* Handle an MRI style string expression. */ |
4628 | /* Handle an MRI style string expression. */ |
Line 4554... | Line 4629... | ||
4554 | 4629 | ||
4555 | #ifdef TC_M68K |
4630 | #ifdef TC_M68K |
4556 | static void |
4631 | static void |
4557 | parse_mri_cons (exp, nbytes) |
- | |
4558 | expressionS *exp; |
- | |
4559 | unsigned int nbytes; |
4632 | parse_mri_cons (expressionS *exp, unsigned int nbytes) |
4560 | { |
4633 | { |
4561 | if (*input_line_pointer != '\'' |
4634 | if (*input_line_pointer != '\'' |
4562 | && (input_line_pointer[1] != '\'' |
4635 | && (input_line_pointer[1] != '\'' |
4563 | || (*input_line_pointer != 'A' |
4636 | || (*input_line_pointer != 'A' |
4564 | && *input_line_pointer != 'E'))) |
4637 | && *input_line_pointer != 'E'))) |
4565 | TC_PARSE_CONS_EXPRESSION (exp, nbytes); |
4638 | (void) TC_PARSE_CONS_EXPRESSION (exp, nbytes); |
4566 | else |
4639 | else |
4567 | { |
4640 | { |
4568 | unsigned int scan; |
4641 | unsigned int scan; |
Line 5017... | Line 5090... | ||
5017 | /* Mop up any left-over bits (of which there will be less than 7). */ |
5090 | /* Mop up any left-over bits (of which there will be less than 7). */ |
5018 | if ((byte & 0x80) != 0) |
5091 | if ((byte & 0x80) != 0) |
5019 | { |
5092 | { |
5020 | /* Sign-extend VAL. */ |
5093 | /* Sign-extend VAL. */ |
5021 | if (val & (1 << (loaded - 1))) |
5094 | if (val & (1 << (loaded - 1))) |
5022 | val |= ~0 << loaded; |
5095 | val |= ~0U << loaded; |
5023 | if (orig) |
5096 | if (orig) |
5024 | *p = val & 0x7f; |
5097 | *p = val & 0x7f; |
5025 | p++; |
5098 | p++; |
5026 | } |
5099 | } |
Line 5340... | Line 5413... | ||
5340 | bump_line_counters (); |
5413 | bump_line_counters (); |
5341 | break; |
5414 | break; |
Line 5342... | Line 5415... | ||
5342 | 5415 | ||
5343 | #ifndef NO_STRING_ESCAPES |
5416 | #ifndef NO_STRING_ESCAPES |
5344 | case '\\': |
5417 | case '\\': |
5345 | switch (c = *input_line_pointer++) |
5418 | switch (c = *input_line_pointer++ & CHAR_MASK) |
5346 | { |
5419 | { |
5347 | case 'b': |
5420 | case 'b': |
5348 | c = '\b'; |
5421 | c = '\b'; |
Line 5391... | Line 5464... | ||
5391 | c = *input_line_pointer++, i++) |
5464 | c = *input_line_pointer++, i++) |
5392 | { |
5465 | { |
5393 | number = number * 8 + c - '0'; |
5466 | number = number * 8 + c - '0'; |
5394 | } |
5467 | } |
Line 5395... | Line 5468... | ||
5395 | 5468 | ||
5396 | c = number & 0xff; |
5469 | c = number & CHAR_MASK; |
5397 | } |
5470 | } |
5398 | --input_line_pointer; |
5471 | --input_line_pointer; |
Line 5399... | Line 5472... | ||
5399 | break; |
5472 | break; |
Line 5413... | Line 5486... | ||
5413 | number = number * 16 + c - 'A' + 10; |
5486 | number = number * 16 + c - 'A' + 10; |
5414 | else |
5487 | else |
5415 | number = number * 16 + c - 'a' + 10; |
5488 | number = number * 16 + c - 'a' + 10; |
5416 | c = *input_line_pointer++; |
5489 | c = *input_line_pointer++; |
5417 | } |
5490 | } |
5418 | c = number & 0xff; |
5491 | c = number & CHAR_MASK; |
5419 | --input_line_pointer; |
5492 | --input_line_pointer; |
5420 | } |
5493 | } |
5421 | break; |
5494 | break; |
Line 5422... | Line 5495... | ||
5422 | 5495 | ||
Line 5792... | Line 5865... | ||
5792 | } |
5865 | } |
5793 | else |
5866 | else |
5794 | { |
5867 | { |
5795 | include_dir_count++; |
5868 | include_dir_count++; |
5796 | include_dirs = |
5869 | include_dirs = |
5797 | (char **) realloc (include_dirs, |
5870 | (char **) xrealloc (include_dirs, |
5798 | include_dir_count * sizeof (*include_dirs)); |
5871 | include_dir_count * sizeof (*include_dirs)); |
5799 | } |
5872 | } |
Line 5800... | Line 5873... | ||
5800 | 5873 | ||
Line 5885... | Line 5958... | ||
5885 | as_bad (_(".endfunc missing for previous .func")); |
5958 | as_bad (_(".endfunc missing for previous .func")); |
5886 | ignore_rest_of_line (); |
5959 | ignore_rest_of_line (); |
5887 | return; |
5960 | return; |
5888 | } |
5961 | } |
Line 5889... | Line -... | ||
5889 | - | ||
5890 | name = input_line_pointer; |
5962 | |
5891 | delim1 = get_symbol_end (); |
5963 | delim1 = get_symbol_name (& name); |
5892 | name = xstrdup (name); |
5964 | name = xstrdup (name); |
5893 | *input_line_pointer = delim1; |
5965 | *input_line_pointer = delim1; |
5894 | SKIP_WHITESPACE (); |
5966 | SKIP_WHITESPACE_AFTER_NAME (); |
5895 | if (*input_line_pointer != ',') |
5967 | if (*input_line_pointer != ',') |
5896 | { |
5968 | { |
5897 | if (default_prefix) |
5969 | if (default_prefix) |
5898 | { |
5970 | { |
Line 5915... | Line 5987... | ||
5915 | } |
5987 | } |
5916 | else |
5988 | else |
5917 | { |
5989 | { |
5918 | ++input_line_pointer; |
5990 | ++input_line_pointer; |
5919 | SKIP_WHITESPACE (); |
5991 | SKIP_WHITESPACE (); |
5920 | label = input_line_pointer; |
- | |
5921 | delim2 = get_symbol_end (); |
5992 | delim2 = get_symbol_name (& label); |
5922 | label = xstrdup (label); |
5993 | label = xstrdup (label); |
5923 | *input_line_pointer = delim2; |
5994 | restore_line_pointer (delim2); |
5924 | } |
5995 | } |
Line 5925... | Line 5996... | ||
5925 | 5996 | ||
5926 | if (debug_type == DEBUG_STABS) |
5997 | if (debug_type == DEBUG_STABS) |
Line 6093... | Line 6164... | ||
6093 | inquote ^= *s; |
6164 | inquote ^= *s; |
6094 | ++s; |
6165 | ++s; |
6095 | } |
6166 | } |
6096 | if (inquote) |
6167 | if (inquote) |
6097 | as_warn (_("missing closing `%c'"), inquote); |
6168 | as_warn (_("missing closing `%c'"), inquote); |
6098 | if (inescape) |
6169 | if (inescape && !ignore_input ()) |
6099 | as_warn (_("stray `\\'")); |
6170 | as_warn (_("stray `\\'")); |
6100 | return s; |
6171 | return s; |
6101 | } |
6172 | } |
Line 6102... | Line 6173... | ||
6102 | 6173 |