fix fasmdep: file dependencies were sometimes not recognized

git-svn-id: svn://kolibrios.org@5062 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2014-08-28 17:20:26 +00:00
parent 0dc19e3af3
commit 40038c1e69
2 changed files with 27 additions and 14 deletions

View File

@ -58,4 +58,3 @@ kernel.mnt: $(KERNEL)/kernel.asm ../common/Makefile.fasm .deps/.dir
rm $$tmpfile) || (rm $$tmpfile; false) rm $$tmpfile) || (rm $$tmpfile; false)
kerpack "$@" kerpack "$@"
-include .deps/kernel.Po -include .deps/kernel.Po

View File

@ -186,15 +186,23 @@ end repeat
; 8b. Loop over assembled lines in the range. ; 8b. Loop over assembled lines in the range.
cmp esi, [esp] cmp esi, [esp]
ja .file_done ja .file_done
; 8c. For every assembled line, look at first token; ; 8c. For every assembled line, skip "word" and one-byte tokens
; scanning for three predefined word tokens.
; Note that lines like "a:b:c:d file 'something'" are possible and valid.
; go to 8d for token 'file', ; go to 8d for token 'file',
; go to 8e for token 'format', ; go to 8e for token 'format',
; go to 8f for token 'section', ; go to 8f for token 'section',
; continue the loop otherwise. ; continue the loop otherwise.
mov eax, [esi+ebx+asm_row.preproc_offs] mov eax, [esi+ebx+asm_row.preproc_offs]
add eax, [ebx+fas_header.preproc_offs] add eax, [ebx+fas_header.preproc_offs]
cmp byte [eax+ebx+preproc_line_header.contents], 1Ah ; We save/restore esi since it is used for another thing in the internal loop;
jnz .file_next ; we push eax, which currently contains ebx-relative pointer to
; preproc_line_header, to be able to access it from resolve_name.
push esi eax
.file_tokens_loop:
mov cl, byte [eax+ebx+preproc_line_header.contents]
cmp cl, 1Ah
jnz .file_noword_token
movzx ecx, byte [eax+ebx+preproc_line_header.contents+1] movzx ecx, byte [eax+ebx+preproc_line_header.contents+1]
cmp cl, 4 cmp cl, 4
jnz .file_no_file jnz .file_no_file
@ -205,18 +213,14 @@ end repeat
; Parsing of tokens is similar to step 5 with the difference that ; Parsing of tokens is similar to step 5 with the difference that
; preprocessor token stops processing: 'file' directives are processed ; preprocessor token stops processing: 'file' directives are processed
; in assembler stage. ; in assembler stage.
; We save/restore esi since it is used for another thing in the internal loop;
; we push eax, which currently contains ebx-relative pointer to
; preproc_line_header, to be able to access it from resolve_name.
push esi eax
lea esi, [eax+preproc_line_header.contents+6] lea esi, [eax+preproc_line_header.contents+6]
.file_loop_int: .file_loop_int:
mov al, [esi+ebx] mov al, [esi+ebx]
inc esi inc esi
test al, al test al, al
jz .file_loop_int_done jz .file_next
cmp al, ';' cmp al, ';'
jz .file_loop_int_done jz .file_next
cmp al, 1Ah cmp al, 1Ah
jz .fileword jz .fileword
cmp al, '"' cmp al, '"'
@ -228,12 +232,9 @@ end repeat
movzx eax, byte [esi+ebx] movzx eax, byte [esi+ebx]
lea esi, [esi+eax+1] lea esi, [esi+eax+1]
jmp .file_loop_int jmp .file_loop_int
.file_loop_int_done:
pop eax esi
jmp .file_next
.file_no_file4: .file_no_file4:
cmp dword [eax+ebx+preproc_line_header.contents+2], 'data' cmp dword [eax+ebx+preproc_line_header.contents+2], 'data'
jnz .file_next jnz .file_word_token
jmp .file_scan_from jmp .file_scan_from
.file_no_file: .file_no_file:
cmp cl, 6 cmp cl, 6
@ -260,8 +261,21 @@ end repeat
.file_scan_from: .file_scan_from:
mov edx, TokenFrom mov edx, TokenFrom
call scan_after_word call scan_after_word
jmp .file_next
.file_no_section: .file_no_section:
.file_word_token:
lea eax, [eax+ecx+2]
jmp .file_tokens_loop
.file_noword_token:
inc eax
test cl, cl
jz .file_next
cmp cl, 3Bh
jz .file_next
cmp cl, 22h
jnz .file_tokens_loop
.file_next: .file_next:
pop eax esi
add esi, asm_row.sizeof add esi, asm_row.sizeof
jmp .file_loop jmp .file_loop
.file_done: .file_done: