Browse Source

Fixing order of elements for ld

This should fix BSD issues, and it's the right way
to do an static compilation.
Elbing Miss 3 years ago
parent
commit
7fc41deacf
1 changed files with 3 additions and 3 deletions
  1. 3 3
      util/src/harvey/cmd/build/build.go

+ 3 - 3
util/src/harvey/cmd/build/build.go

@@ -330,12 +330,12 @@ func link(b *build) {
 			f := path.Base(n)
 			o := f[:len(f)] + ".o"
 			args := []string{"-o", n, o}
+			args = append(args, "-L", fromRoot("/$ARCH/lib"))
+			args = append(args, b.Libs...)
 			args = append(args, b.Oflags...)
 			if toolOpts, ok := b.ToolOpts[tools["ld"]]; ok {
 				args = append(args, toolOpts...)
 			}
-			args = append(args, "-L", fromRoot("/$ARCH/lib"))
-			args = append(args, b.Libs...)
 			run(b, *shellhack, exec.Command(tools["ld"], args...))
 		}
 		return
@@ -345,9 +345,9 @@ func link(b *build) {
 		args = append(args, toolOpts...)
 	}
 	args = append(args, b.ObjectFiles...)
-	args = append(args, b.Oflags...)
 	args = append(args, "-L", fromRoot("/$ARCH/lib"))
 	args = append(args, b.Libs...)
+	args = append(args, b.Oflags...)
 	run(b, *shellhack, exec.Command(tools["ld"], args...))
 }