Unified · Split
| @@ -883,8 +883,12 @@ static void asm_parse_directive(TCCState *s1, int global) · 882 unmodified lines | |||
| 883 | } | 883 | } |
| 884 | } | 884 | } |
| 885 | last_text_section = cur_text_section; | 885 | last_text_section = cur_text_section; |
| 886 | if (tok1 == TOK_ASMDIR_section) | 886 | if (tok1 == TOK_ASMDIR_section) { |
| 887 | use_section(s1, sname); | 887 | use_section(s1, sname); |
| 888 | /* The section directive supports flags, but they are unsupported. | ||
| 889 | For now, just assume any section contains code. */ | ||
| 890 | cur_text_section->sh_flags |= SHF_EXECINSTR; | ||
| 891 | } | ||
| 888 | else | 892 | else |
| 889 | push_section(s1, sname); | 893 | push_section(s1, sname); |
| 890 | /* If we just allocated a new section reset its alignment to | 894 | /* If we just allocated a new section reset its alignment to |
| @@ -893,9 +897,6 @@ static void asm_parse_directive(TCCState *s1, int global) · 2 unmodified lines | |||
| 893 | if (old_nb_section != s1->nb_sections) | 897 | if (old_nb_section != s1->nb_sections) |
| 894 | cur_text_section->sh_addralign = 1; | 898 | cur_text_section->sh_addralign = 1; |
| 895 | } | 899 | } |
| 896 | /* The section directive supports flags, but they are unsupported. | ||
| 897 | For now, just assume any section contains code. */ | ||
| 898 | cur_text_section->sh_flags |= SHF_EXECINSTR; | ||
| 899 | break; | 900 | break; |
| 900 | case TOK_ASMDIR_previous: | 901 | case TOK_ASMDIR_previous: |
| 901 | { | 902 | { |
| @@ -1506,20 +1506,6 @@ static int expr_preprocess(TCCState *s1) · 1505 unmodified lines | |||
| 1506 | tokc.i = c; | 1506 | tokc.i = c; |
| 1507 | } else { | 1507 | } else { |
| 1508 | /* if undefined macro, replace with zero */ | 1508 | /* if undefined macro, replace with zero */ |
| 1509 | next_nomacro(); | ||
| 1510 | // If the undefined macro is followed by parens, just skip them. | ||
| 1511 | if (tok == '(') { | ||
| 1512 | int bracket_depth = 1; | ||
| 1513 | while (bracket_depth > 0) { | ||
| 1514 | next(); | ||
| 1515 | if (tok == '(') | ||
| 1516 | bracket_depth++; | ||
| 1517 | else if (tok == ')') | ||
| 1518 | bracket_depth--; | ||
| 1519 | } | ||
| 1520 | } else { | ||
| 1521 | unget_tok(tok); // Is this actually the function I want? | ||
| 1522 | } | ||
| 1523 | tok = TOK_CINT; | 1509 | tok = TOK_CINT; |
| 1524 | tokc.i = 0; | 1510 | tokc.i = 0; |
| 1525 | } | 1511 | } |
File renamed without changes.
| @@ -0,0 +1 @@ | |||
| 1 | AAAAAAAAA | ||
| @@ -1,3 +1,5 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | |||
| 1 | /* Previously in TinyCC, ELF sections defined in attributes would always have | 3 | /* Previously in TinyCC, ELF sections defined in attributes would always have |
| 2 | the execute bit not set, so you would get segmentation faults when code in these | 4 | the execute bit not set, so you would get segmentation faults when code in these |
| 3 | sections was exectuted. This file is a minimal example of a file that will put | 5 | sections was exectuted. This file is a minimal example of a file that will put |
| @@ -9,5 +11,7 @@ int wumbo (int arg) { · 5 unmodified lines | |||
| 9 | } | 11 | } |
| 10 | 12 | ||
| 11 | int main () { | 13 | int main () { |
| 12 | return wumbo(2); | 14 | wumbo(2); |
| 15 | puts("hi"); | ||
| 16 | return 0; | ||
| 13 | } | 17 | } |
| @@ -0,0 +1 @@ | |||
| 1 | hi | ||
| @@ -1,13 +0,0 @@ | |||
| 1 | int main () { | ||
| 2 | // This used to evaluate to 0 (0), which is invalid. | ||
| 3 | // Now it should evaluate to 0. | ||
| 4 | #if WUMBOED(WUMBO) | ||
| 5 | #endif | ||
| 6 | |||
| 7 | // Just trying a more complicated test case. | ||
| 8 | #if WUMBO && defined(WUMBOLOGY) || WUMBOED(WUMBO) && !WUMBOLOGY | ||
| 9 | return 0; | ||
| 10 | #elif WUMBO && defined(WUMBOLOGY) || WUMBOED(WUMBO) && !WUMBOLOGY | ||
| 11 | return 1; | ||
| 12 | #endif | ||
| 13 | } | ||