diff --git a/newt/builder/extcmd.go b/newt/builder/extcmd.go index e28de1d42..e75530f8b 100644 --- a/newt/builder/extcmd.go +++ b/newt/builder/extcmd.go @@ -197,14 +197,6 @@ func getLinkTableEntry(name string) string { func (t *TargetBuilder) generateLinkTables() { var s []string - for _, pkg := range t.res.LpkgRpkgMap { - s = append(s, pkg.Lpkg.LinkTables()...) - } - - if len(s) == 0 { - return - } - dir := GeneratedBaseDir(t.target.FullName()) + "/link/include" err := os.MkdirAll(dir, os.ModePerm) if err != nil { @@ -218,6 +210,14 @@ func (t *TargetBuilder) generateLinkTables() { return } + for _, pkg := range t.res.LpkgRpkgMap { + s = append(s, pkg.Lpkg.LinkTables()...) + } + + if len(s) == 0 { + return + } + for _, linkTable := range s { linkHeader.WriteString(getLinkTableEntry(linkTable)) }