aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2023-07-31 12:30:43 -0400
committerRuss Cox <rsc@golang.org>2023-07-31 19:10:10 +0000
commitceb95ea6aef52c1fb472d3539c6ef68670778b5b (patch)
tree37575761e3b271cbe50a2e37babb9434495c2cd2
parentbdd4b9503e47c2c38a9d0a9bb2f5d95ec5ff8ef6 (diff)
downloadgo-release-branch.go1.4.tar.gz
go-release-branch.go1.4.zip
[release-branch.go1.4] all: fixes for modern compilersrelease-branch.go1.4
This makes make.bash pass without any warnings for $ clang --version Ubuntu clang version 14.0.0-1ubuntu1.1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin $ gcc --version gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ The change in src/liblink/asm5.c silences a warning building on modern macOS, which doesn't actually produce a working toolchain anyway, but it still seems worth silencing the warning. These warnings surface now in the reproducible builds reports (for example https://gorebuild.storage.googleapis.com/gorebuild.html, click on "Bootstrap go1.4"). I'd rather not look at them anymore. For golang/go#58884. Change-Id: I689c862ad360ca23153438f9e143a1cb840730e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/514415 TryBot-Bypass: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
-rw-r--r--include/u.h2
-rw-r--r--src/cmd/6c/txt.c4
-rw-r--r--src/cmd/6g/peep.c2
-rw-r--r--src/cmd/dist/build.c3
-rw-r--r--src/cmd/ld/dwarf.c18
-rw-r--r--src/liblink/asm5.c15
6 files changed, 24 insertions, 20 deletions
diff --git a/include/u.h b/include/u.h
index 489b2a3886..64f1a9b583 100644
--- a/include/u.h
+++ b/include/u.h
@@ -83,7 +83,7 @@ extern "C" {
#ifdef _WIN32
typedef jmp_buf sigjmp_buf;
#endif
-typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
+typedef long p9jmp_buf[sizeof(sigjmp_buf)/(sizeof(long))];
#if defined(__linux__)
# include <sys/types.h>
diff --git a/src/cmd/6c/txt.c b/src/cmd/6c/txt.c
index 3bdbf410ea..8008512a2f 100644
--- a/src/cmd/6c/txt.c
+++ b/src/cmd/6c/txt.c
@@ -992,7 +992,7 @@ gmove(Node *f, Node *t)
f->vconst &= 0xffff;
if(f->vconst & 0x8000){
f->vconst |= 0xffff0000;
- f->vconst |= (vlong)~0 << 32;
+ f->vconst |= (vlong)((~(uvlong)0) << 32);
}
a = AMOVL;
}
@@ -1042,7 +1042,7 @@ gmove(Node *f, Node *t)
f->vconst &= 0xff;
if(f->vconst & 0x80){
f->vconst |= 0xffffff00;
- f->vconst |= (vlong)~0 << 32;
+ f->vconst |= (vlong)((~(uvlong)0) << 32);
}
a = AMOVQ;
}
diff --git a/src/cmd/6g/peep.c b/src/cmd/6g/peep.c
index 24617836fe..deed9d2c0b 100644
--- a/src/cmd/6g/peep.c
+++ b/src/cmd/6g/peep.c
@@ -768,7 +768,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 3;
case ACALL:
- if(REGEXT && v->type <= REGEXT && v->type > exregoffset)
+ if(REGEXT != 0 && v->type <= REGEXT && v->type > exregoffset)
return 2;
if(REGARG >= 0 && v->type == (uchar)REGARG)
return 2;
diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c
index 8d82167b99..614989b93a 100644
--- a/src/cmd/dist/build.c
+++ b/src/cmd/dist/build.c
@@ -475,6 +475,7 @@ static char *proto_gccargs[] = {
"-Wstrict-prototypes",
"-Wextra",
"-Wunused",
+ "-Wno-unknown-warning-option",
"-Wno-sign-compare",
"-Wno-missing-braces",
"-Wno-parentheses",
@@ -482,6 +483,8 @@ static char *proto_gccargs[] = {
"-Wno-switch",
"-Wno-comment",
"-Wno-missing-field-initializers",
+ "-Wno-implicit-fallthrough",
+ "-Wno-stringop-truncation",
"-fno-common",
"-ggdb",
"-pipe",
diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c
index dfe515c3c4..15db46c2dc 100644
--- a/src/cmd/ld/dwarf.c
+++ b/src/cmd/ld/dwarf.c
@@ -86,7 +86,7 @@ addrput(vlong addr)
}
static int
-uleb128enc(uvlong v, char* dst)
+uleb128enc(uvlong v, uchar* dst)
{
uint8 c, len;
@@ -104,7 +104,7 @@ uleb128enc(uvlong v, char* dst)
};
static int
-sleb128enc(vlong v, char *dst)
+sleb128enc(vlong v, uchar *dst)
{
uint8 c, s, len;
@@ -125,15 +125,15 @@ sleb128enc(vlong v, char *dst)
static void
uleb128put(vlong v)
{
- char buf[10];
- strnput(buf, uleb128enc(v, buf));
+ uchar buf[10];
+ strnput((char*)buf, uleb128enc(v, buf));
}
static void
sleb128put(vlong v)
{
- char buf[10];
- strnput(buf, sleb128enc(v, buf));
+ uchar buf[10];
+ strnput((char*)buf, sleb128enc(v, buf));
}
/*
@@ -854,7 +854,7 @@ reversetree(DWDie** list)
static void
newmemberoffsetattr(DWDie *die, int32 offs)
{
- char block[10];
+ uchar block[10];
int i;
i = 0;
@@ -1471,7 +1471,7 @@ putpclcdelta(vlong delta_pc, vlong delta_lc)
static void
newcfaoffsetattr(DWDie *die, int32 offs)
{
- char block[10];
+ uchar block[10];
int i;
i = 0;
@@ -1760,7 +1760,7 @@ writeframes(void)
uleb128put(DWARFREGSP); // register SP (**ABI-dependent, defined in l.h)
uleb128put(PtrSize); // offset
- cput(DW_CFA_offset + FAKERETURNCOLUMN); // return address
+ cput((char)(DW_CFA_offset + FAKERETURNCOLUMN)); // return address
uleb128put(-PtrSize / DATAALIGNMENTFACTOR); // at cfa - x*4
// 4 is to exclude the length field.
diff --git a/src/liblink/asm5.c b/src/liblink/asm5.c
index 96df9f7919..b8aff1a384 100644
--- a/src/liblink/asm5.c
+++ b/src/liblink/asm5.c
@@ -298,7 +298,7 @@ static Optab optab[] =
{ ASTREXD, C_SOREG,C_REG, C_REG, 92, 4, 0 },
{ APLD, C_SOREG,C_NONE, C_NONE, 95, 4, 0 },
-
+
{ AUNDEF, C_NONE, C_NONE, C_NONE, 96, 4, 0 },
{ ACLZ, C_REG, C_NONE, C_REG, 97, 4, 0 },
@@ -644,11 +644,12 @@ span5(Link *ctxt, LSym *cursym)
int m, bflag, i, v, times;
int32 c, opc, out[6+3];
uchar *bp;
+ int debug = 0;
p = cursym->text;
if(p == nil || p->link == nil) // handle external functions and ELF section symbols
return;
-
+
if(oprange[AAND].start == nil)
buildop(ctxt);
@@ -758,7 +759,7 @@ span5(Link *ctxt, LSym *cursym)
m = asmoutnacl(ctxt, c, p, o, nil);
if(p->pc != opc) {
bflag = 1;
- //print("%P pc changed %d to %d in iter. %d\n", p, opc, (int32)p->pc, times);
+ if(debug) print("%P pc changed %d to %d in iter. %d\n", p, opc, (int32)p->pc, times);
}
c = p->pc + m;
if(m % 4 != 0 || p->pc % 4 != 0) {
@@ -912,7 +913,7 @@ addpool(Link *ctxt, Prog *p, Addr *a)
t.to.sym = a->sym;
t.to.type = a->type;
t.to.name = a->name;
-
+
if(ctxt->flag_shared && t.to.sym != nil)
t.pcrel = p;
break;
@@ -1639,7 +1640,7 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
rel->siz = 4;
rel->sym = p->to.sym;
rel->add = p->to.offset;
-
+
// runtime.tlsg is special.
// Its "address" is the offset from the TLS thread pointer
// to the thread-local g and m pointers.
@@ -1829,7 +1830,7 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
o1 |= p->to.reg << 16;
aclass(ctxt, &p->to);
break;
-
+
case 39: /* movm oreg,$con -> ldm */
o1 = (0x4 << 25) | (1 << 20);
o1 |= p->to.offset & 0xffff;
@@ -2305,7 +2306,7 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
o1 = 0xe125be70;
break;
}
-
+
out[0] = o1;
out[1] = o2;
out[2] = o3;