@@ -609,19 +609,13 @@ const Target = enum {
609
609
}
610
610
};
611
611
612
- const LinkerScript = enum {
613
- None ,
614
- Embed : []const u8 ,
615
- Path : []const u8 ,
616
- };
617
-
618
612
pub const LibExeObjStep = struct {
619
613
step : Step ,
620
614
builder : & Builder ,
621
615
root_src : ? []const u8 ,
622
616
name : []const u8 ,
623
617
target : Target ,
624
- linker_script : LinkerScript ,
618
+ linker_script : ? [] const u8 ,
625
619
link_libs : BufSet ,
626
620
verbose : bool ,
627
621
release : bool ,
@@ -679,7 +673,7 @@ pub const LibExeObjStep = struct {
679
673
.root_src = root_src ,
680
674
.name = name ,
681
675
.target = Target .Native ,
682
- .linker_script = LinkerScript . None ,
676
+ .linker_script = null ,
683
677
.link_libs = BufSet .init (builder .allocator ),
684
678
.step = Step .init (name , builder .allocator , make ),
685
679
.output_path = null ,
@@ -726,14 +720,8 @@ pub const LibExeObjStep = struct {
726
720
self .computeOutFileNames ();
727
721
}
728
722
729
- /// LibExeObjStep keeps a reference to script for its lifetime or until this function
730
- /// is called again.
731
- pub fn setLinkerScriptContents (self : & LibExeObjStep , script : []const u8 ) {
732
- self .linker_script = LinkerScript.Embed { script };
733
- }
734
-
735
723
pub fn setLinkerScriptPath (self : & LibExeObjStep , path : []const u8 ) {
736
- self .linker_script = LinkerScript.Path { path } ;
724
+ self .linker_script = path ;
737
725
}
738
726
739
727
pub fn linkSystemLibrary (self : & LibExeObjStep , name : []const u8 ) {
@@ -852,19 +840,9 @@ pub const LibExeObjStep = struct {
852
840
},
853
841
}
854
842
855
- switch (self .linker_script ) {
856
- LinkerScript .None = > {},
857
- LinkerScript .Embed = > | script | {
858
- const tmp_file_name = "linker.ld.tmp" ; // TODO issue #298
859
- io .writeFile (tmp_file_name , script , builder .allocator )
860
- %% | err | debug .panic ("unable to write linker script: {}\n " , @errorName (err ));
861
- %% zig_args .append ("--linker-script" );
862
- %% zig_args .append (tmp_file_name );
863
- },
864
- LinkerScript .Path = > | path | {
865
- %% zig_args .append ("--linker-script" );
866
- %% zig_args .append (path );
867
- },
843
+ test (self .linker_script ) | linker_script | {
844
+ %% zig_args .append ("--linker-script" );
845
+ %% zig_args .append (linker_script );
868
846
}
869
847
870
848
{
0 commit comments