diff options
| author | Luuk de Gram <luuk@degram.dev> | 2022-06-24 22:01:41 +0200 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2022-06-24 22:01:41 +0200 |
| commit | e32a5ba78b5e42788cba57720ce88cbfd30d434b (patch) | |
| tree | da6d60b9ae93eb592f8330ddefd582ab77a11d32 /src/link/Wasm/types.zig | |
| parent | 905a18849f7f2c3f269fbf425170e0c86b12524a (diff) | |
| download | zig-e32a5ba78b5e42788cba57720ce88cbfd30d434b.tar.gz zig-e32a5ba78b5e42788cba57720ce88cbfd30d434b.zip | |
link/wasm: Put decls into the correct segments
Decls will now be put into their respective segment.
e.g. a constant decl will be inserted into the "rodata" segment,
whereas an uninitialized decl will be put in the "bss" segment instead.
Diffstat (limited to 'src/link/Wasm/types.zig')
| -rw-r--r-- | src/link/Wasm/types.zig | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/link/Wasm/types.zig b/src/link/Wasm/types.zig index 835c02ea12..a606e3f7b6 100644 --- a/src/link/Wasm/types.zig +++ b/src/link/Wasm/types.zig @@ -125,14 +125,15 @@ pub const Segment = struct { /// Bitfield containing flags for a segment flags: u32, + /// Returns the name as how it will be output into the final object + /// file or binary. When `merge_segments` is true, this will return the + /// short name. i.e. ".rodata". When false, it returns the entire name instead. pub fn outputName(self: Segment, merge_segments: bool) []const u8 { if (!merge_segments) return self.name; if (std.mem.startsWith(u8, self.name, ".rodata.")) { return ".rodata"; } else if (std.mem.startsWith(u8, self.name, ".text.")) { return ".text"; - } else if (std.mem.startsWith(u8, self.name, ".rodata.")) { - return ".rodata"; } else if (std.mem.startsWith(u8, self.name, ".data.")) { return ".data"; } else if (std.mem.startsWith(u8, self.name, ".bss.")) { |
