aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/loadxcoff/ldxcoff.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/link/internal/loadxcoff/ldxcoff.go')
-rw-r--r--src/cmd/link/internal/loadxcoff/ldxcoff.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/link/internal/loadxcoff/ldxcoff.go b/src/cmd/link/internal/loadxcoff/ldxcoff.go
index 29d162596a..50b472047a 100644
--- a/src/cmd/link/internal/loadxcoff/ldxcoff.go
+++ b/src/cmd/link/internal/loadxcoff/ldxcoff.go
@@ -46,14 +46,14 @@ func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, input *bio.Read
return nil, fmt.Errorf("loadxcoff: %v: %v", pn, fmt.Sprintf(str, args...))
}
- var ldSections []*ldSection
-
f, err := xcoff.NewFile((*xcoffBiobuf)(input))
if err != nil {
return nil, err
}
defer f.Close()
+ ldSections := make([]*ldSection, 0, len(f.Sections))
+
for _, sect := range f.Sections {
//only text, data and bss section
if sect.Type < xcoff.STYP_TEXT || sect.Type > xcoff.STYP_BSS {