std: 표준 라이브러리가 컴파일러 옆에서 해석되고 호출된다
std 는 예약된 이름이고 프로그램이 아니라 컴파일러와 함께 있으므로 자기 루트를 갖는다 (--std=). 본문 없는 선언은 링커가 찾을 것 -- 런타임이나 C 라이브러리 -- 이므로 IR 에 extern 으로 나간다. 런타임에 write/alloc/free/exit 를 넣었다. 이것이 표준 라이브러리가 스스로 말할 수 없는 전부이고 나머지는 Ferro 로 쓴다. @trap @unreachable @size_of @align_of @line 을 내린다. 링크 이름에서 점과 괄호를 걸렀다. 유닛 경로에는 점이 있고 제네릭 인스턴스에는 괄호가 있는데 어셈블러가 받지 않는다.
This commit is contained in:
+3
-1
@@ -38,7 +38,9 @@ def build(fec: Path, source: Path, out_dir: Path, no_checks: bool = False):
|
||||
asm = out_dir / f"{stem}.asm"
|
||||
log = []
|
||||
|
||||
cmd = [fec, "--emit-asm", source, "-o", asm]
|
||||
# `std` ships with the compiler, so it is looked for beside it rather
|
||||
# than beside the program.
|
||||
cmd = [fec, "--emit-asm", source, "-o", asm, f"--std={ROOT / 'fec'}"]
|
||||
if no_checks:
|
||||
cmd.append("--no-checks")
|
||||
step = _run(cmd, out_dir)
|
||||
|
||||
Reference in New Issue
Block a user