diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/8l/asm.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c index e1496e3d8..cdb5a33e6 100644 --- a/src/cmd/8l/asm.c +++ b/src/cmd/8l/asm.c @@ -174,7 +174,7 @@ adddynrel(Sym *s, Reloc *r) // Handle relocations found in ELF object files. case 256 + R_386_PC32: - if(targ->dynimpname) + if(targ->dynimpname != nil && !targ->dynexport) diag("unexpected R_386_PC32 relocation for dynamic symbol %s", targ->name); if(targ->type == 0 || targ->type == SXREF) diag("unknown symbol %s in pcrel", targ->name); @@ -185,7 +185,7 @@ adddynrel(Sym *s, Reloc *r) case 256 + R_386_PLT32: r->type = D_PCREL; r->add += 4; - if(targ->dynimpname != nil) { + if(targ->dynimpname != nil && !targ->dynexport) { addpltsym(targ); r->sym = lookup(".plt", 0); r->add += targ->plt; @@ -193,7 +193,7 @@ adddynrel(Sym *s, Reloc *r) return; case 256 + R_386_GOT32: - if(targ->dynimpname == nil) { + if(targ->dynimpname == nil || targ->dynexport) { // have symbol // turn MOVL of GOT entry into LEAL of symbol itself if(r->off < 2 || s->p[r->off-2] != 0x8b) { @@ -221,19 +221,19 @@ adddynrel(Sym *s, Reloc *r) return; case 256 + R_386_32: - if(targ->dynimpname) + if(targ->dynimpname != nil && !targ->dynexport) diag("unexpected R_386_32 relocation for dynamic symbol %s", targ->name); r->type = D_ADDR; return; case 512 + MACHO_GENERIC_RELOC_VANILLA*2 + 0: r->type = D_ADDR; - if(targ->dynimpname) + if(targ->dynimpname != nil && !targ->dynexport) diag("unexpected reloc for dynamic symbol %s", targ->name); return; case 512 + MACHO_GENERIC_RELOC_VANILLA*2 + 1: - if(targ->dynimpname) { + if(targ->dynimpname != nil && !targ->dynexport) { addpltsym(targ); r->sym = lookup(".plt", 0); r->add = targ->plt; @@ -241,12 +241,10 @@ adddynrel(Sym *s, Reloc *r) return; } r->type = D_PCREL; - if(targ->dynimpname) - diag("unexpected pc-relative reloc for dynamic symbol %s", targ->name); return; case 512 + MACHO_FAKE_GOTPCREL: - if(targ->dynimpname == nil) { + if(targ->dynimpname == nil || targ->dynexport) { // have symbol // turn MOVL of GOT entry into LEAL of symbol itself if(r->off < 2 || s->p[r->off-2] != 0x8b) { @@ -265,7 +263,7 @@ adddynrel(Sym *s, Reloc *r) } // Handle references to ELF symbols from our own object files. - if(targ->dynimpname == nil) + if(targ->dynimpname == nil || targ->dynexport) return; switch(r->type) { |