openbsd-ports/lang/go/patches/patch-src_cmd_6l_asm_c

64 lines
1.9 KiB
Plaintext

$OpenBSD: patch-src_cmd_6l_asm_c,v 1.1 2012/09/19 21:10:38 sthen Exp $
--- src/cmd/6l/asm.c.orig Thu Jun 14 04:23:38 2012
+++ src/cmd/6l/asm.c Mon Sep 17 11:38:32 2012
@@ -95,6 +95,7 @@ enum {
ElfStrGnuVersion,
ElfStrGnuVersionR,
ElfStrNoteNetbsdIdent,
+ ElfStrNoteOpenbsdIdent,
ElfStrNoPtrData,
ElfStrNoPtrBss,
NElfStr
@@ -577,6 +578,8 @@ doelf(void)
elfstr[ElfStrNoPtrBss] = addstring(shstrtab, ".noptrbss");
if(HEADTYPE == Hnetbsd)
elfstr[ElfStrNoteNetbsdIdent] = addstring(shstrtab, ".note.netbsd.ident");
+ if(HEADTYPE == Hopenbsd)
+ elfstr[ElfStrNoteOpenbsdIdent] = addstring(shstrtab, ".note.openbsd.ident");
addstring(shstrtab, ".elfdata");
addstring(shstrtab, ".rodata");
addstring(shstrtab, ".gosymtab");
@@ -781,7 +784,7 @@ asmb(void)
if(elfverneed)
elftextsh += 2;
}
- if(HEADTYPE == Hnetbsd)
+ if(HEADTYPE == Hnetbsd || HEADTYPE == Hopenbsd)
elftextsh += 1;
break;
case Hwindows:
@@ -939,12 +942,18 @@ asmb(void)
phsh(ph, sh);
}
- if(HEADTYPE == Hnetbsd) {
- sh = newElfShdr(elfstr[ElfStrNoteNetbsdIdent]);
- sh->type = SHT_NOTE;
- sh->flags = SHF_ALLOC;
- sh->addralign = 4;
- resoff -= elfnetbsdsig(sh, startva, resoff);
+ if(HEADTYPE == Hnetbsd || HEADTYPE == Hopenbsd) {
+ sh = nil;
+ switch(HEADTYPE) {
+ case Hnetbsd:
+ sh = newElfShdr(elfstr[ElfStrNoteNetbsdIdent]);
+ resoff -= elfnetbsdsig(sh, startva, resoff);
+ break;
+ case Hopenbsd:
+ sh = newElfShdr(elfstr[ElfStrNoteOpenbsdIdent]);
+ resoff -= elfopenbsdsig(sh, startva, resoff);
+ break;
+ }
ph = newElfPhdr();
ph->type = PT_NOTE;
@@ -1129,6 +1138,8 @@ asmb(void)
a += elfwriteinterp(elfstr[ElfStrInterp]);
if(HEADTYPE == Hnetbsd)
a += elfwritenetbsdsig(elfstr[ElfStrNoteNetbsdIdent]);
+ if(HEADTYPE == Hopenbsd)
+ a += elfwriteopenbsdsig(elfstr[ElfStrNoteOpenbsdIdent]);
if(a > ELFRESERVE)
diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE);
break;