mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
macho: Pass sections by pointer when slicing names
We were accidentally returning a pointer to stack memory, because these arguments were passed by value. It's just an accident that stage 1 was passing these by reference, so things were alright until stage 3.
This commit is contained in:
parent
0efc6a35be
commit
de62bd0647
@ -653,7 +653,7 @@ pub const segment_command_64 = extern struct {
|
||||
nsects: u32 = 0,
|
||||
flags: u32 = 0,
|
||||
|
||||
pub fn segName(seg: segment_command_64) []const u8 {
|
||||
pub fn segName(seg: *const segment_command_64) []const u8 {
|
||||
return parseName(&seg.segname);
|
||||
}
|
||||
};
|
||||
@ -772,11 +772,11 @@ pub const section_64 = extern struct {
|
||||
/// reserved
|
||||
reserved3: u32 = 0,
|
||||
|
||||
pub fn sectName(sect: section_64) []const u8 {
|
||||
pub fn sectName(sect: *const section_64) []const u8 {
|
||||
return parseName(§.sectname);
|
||||
}
|
||||
|
||||
pub fn segName(sect: section_64) []const u8 {
|
||||
pub fn segName(sect: *const section_64) []const u8 {
|
||||
return parseName(§.segname);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user