diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-05-11 21:06:31 +0200 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2019-05-13 16:41:07 +0200 |
| commit | a038ef3570caed01815173d95089e016fab3a050 (patch) | |
| tree | 62e157b941ddff639765b58212c8668fa177753c /std | |
| parent | 6cf7fb1177848c2f2a20c1f4093b1e003c477911 (diff) | |
| download | zig-a038ef3570caed01815173d95089e016fab3a050.tar.gz zig-a038ef3570caed01815173d95089e016fab3a050.zip | |
Assemble asm files using CC
Stuffing all the files together and compiling the resulting blob with
the main program is a terrible idea.
Some files, namely the .S ones, must be run trough the C preprocessor
before assembling them (#2437).
Beside that the aggregate may be mis-compiled due to the presence of
some flags that affect the following code.
For example let's consider two files, a.s and b.s
a.s
```
fn1:
ret
.data
data1:
.word 0
```
b.s
```
fn2:
ret
```
Now, fn1 and fn2 will be both placed in the .text section as intended if
the two files are compiled separately. But if we merge them the `.data`
flag ends up placing fn2 in the wrong section!
This fixes a nasty crash where musl's memset ended up in the
non-executable data segment, leading to too many hours of
head-scratching.
Diffstat (limited to 'std')
| -rw-r--r-- | std/build.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/std/build.zig b/std/build.zig index b5ec97ab5f..ff64c6cb93 100644 --- a/std/build.zig +++ b/std/build.zig @@ -1376,7 +1376,7 @@ pub const LibExeObjStep = struct { try zig_args.append(name); }, LinkObject.AssemblyFile => |asm_file| { - try zig_args.append("--assembly"); + try zig_args.append("--c-source"); try zig_args.append(builder.pathFromRoot(asm_file)); }, LinkObject.CSourceFile => |c_source_file| { |
