// This function handles the first part.
func asmb(ctxt *Link) {
ctxt.loader.InitOutData()
- if ctxt.IsExternal() && !(ctxt.IsAMD64() && ctxt.IsELF) {
+ if ctxt.IsExternal() && !ctxt.StreamExtRelocs() {
ctxt.loader.InitExtRelocs()
}
target := st.target
syms := st.syms
var extRelocs []loader.ExtReloc
- if target.IsExternal() && !(target.IsAMD64() && target.IsELF) {
+ if target.IsExternal() && !target.StreamExtRelocs() {
// preallocate a slice conservatively assuming that all
// relocs will require an external reloc
extRelocs = st.preallocExtRelocSlice(relocs.Count())
addExtReloc:
if needExtReloc {
- if target.IsAMD64() && target.IsELF {
+ if target.StreamExtRelocs() {
extraExtReloc++
} else {
extRelocs = append(extRelocs, rr)
}
}
}
- if target.IsExternal() && target.IsAMD64() && target.IsELF {
+ if target.IsExternal() && target.StreamExtRelocs() {
// On AMD64 ELF, we'll stream out the external relocations in elfrelocsect
// and we only need the count here.
// TODO: just count, but not compute the external relocations. For now it
func (t *Target) IsBigEndian() bool {
return t.Arch.ByteOrder == binary.BigEndian
}
+
+// Temporary helper.
+func (t *Target) StreamExtRelocs() bool {
+ return t.IsELF && (t.IsAMD64() || t.Is386())
+}