From 742bef2a586d80e9f1987a7898c68d5f5f61f73b Mon Sep 17 00:00:00 2001 From: znley Date: Mon, 19 Aug 2024 06:36:41 +0000 Subject: [PATCH] main/dev86: fix build with gcc14 --- main/dev86/APKBUILD | 8 +- main/dev86/gcc14.patch | 266 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+), 2 deletions(-) create mode 100644 main/dev86/gcc14.patch diff --git a/main/dev86/APKBUILD b/main/dev86/APKBUILD index 28299a29850..df91bdbebb5 100644 --- a/main/dev86/APKBUILD +++ b/main/dev86/APKBUILD @@ -14,6 +14,7 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/lkundrak/dev86/archive/v$pkg dev86-noelks.patch dev86-pic.patch dev86-long.patch + gcc14.patch " prepare() { @@ -67,7 +68,10 @@ package() { install install-man } -sha512sums="e51d94cecc298f860c1dcbc225d5c77a18769eb7a51f888853ca3bdb3cc6596c07d67cd9b403f7d52155716eb1708396461dc596cd02728d762d0ed5e87d054f dev86-0.16.21.tar.gz +sha512sums=" +e51d94cecc298f860c1dcbc225d5c77a18769eb7a51f888853ca3bdb3cc6596c07d67cd9b403f7d52155716eb1708396461dc596cd02728d762d0ed5e87d054f dev86-0.16.21.tar.gz a4f2d3caa94f917bfd55eb8f26544b097362e0b5aee91720f0ddb6a1c91284ab875121c176c3225ac54cd2eb08ef5128edcdec4d53960ee64cb0d5cb5c1257d3 dev86-noelks.patch 1dafea998e3d62e71f069eb6bd6e0e05c7152a0470fbf9baa82c3ac9e3f5fe20c342ed0b35be91e82ce83638346a3e8c9855e77f4a71656f2ee7590e999e55fb dev86-pic.patch -94c7532724d6c02a389303f1ce023e13fe95abecb86e1e4126504701cc755053ad810514e599c1151d166c45c51e1af15cbfac9e25895408b1133feb86dce21e dev86-long.patch" +94c7532724d6c02a389303f1ce023e13fe95abecb86e1e4126504701cc755053ad810514e599c1151d166c45c51e1af15cbfac9e25895408b1133feb86dce21e dev86-long.patch +174c59b45b0daa341bcb115ed5daaa3c54e8f2f5b6184b29b8c0c1296c28ab71e469f55a45799da04873912bc5337be4911332808fdf7697f174a820c1f17cf6 gcc14.patch +" diff --git a/main/dev86/gcc14.patch b/main/dev86/gcc14.patch new file mode 100644 index 00000000000..f2db9b3b96f --- /dev/null +++ b/main/dev86/gcc14.patch @@ -0,0 +1,266 @@ +diff --git a/bcc/dbprintf.c b/bcc/dbprintf.c +index a77a012..ae9b3a9 100644 +--- a/bcc/dbprintf.c ++++ b/bcc/dbprintf.c +@@ -1,6 +1,7 @@ + + #include + #include ++#include + + #if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) + #include +@@ -10,6 +11,10 @@ + #define va_strt(p,i) va_start(p) + #endif + ++extern int strlen(); ++ ++int vdbprintf(register __const char *fmt, register va_list ap); ++ + #if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) + int dbprintf(const char * fmt, ...) + #else +diff --git a/cpp/cpp.c b/cpp/cpp.c +index a6e7337..1ca4422 100644 +--- a/cpp/cpp.c ++++ b/cpp/cpp.c +@@ -545,7 +545,7 @@ chget() + } + + static void +-unchget(ch) ++unchget(int ch) + { + #if CPP_DEBUG + fprintf(stderr, "\b", ch); +diff --git a/ld/catimage.c b/ld/catimage.c +index 1f5e160..7808916 100644 +--- a/ld/catimage.c ++++ b/ld/catimage.c +@@ -27,6 +27,15 @@ + #endif + #include "x86_aout.h" + ++extern int memcmp(); ++ ++void fatal(char * str); ++void open_obj(char * fname); ++void copy_segment(long out_offset, long in_offset, long length); ++void patch_bin(long file_off, int value); ++void read_symtable(); ++void fatal(char * str); ++ + #ifndef __OUT_OK + #error "Compile error: struct exec invalid (long not 32 bit ?)" + #endif +@@ -39,7 +48,7 @@ FILE * ofd; + FILE * ifd = 0; + struct exec header; + +-main(argc, argv) ++void main(argc, argv) + int argc; + char ** argv; + { +@@ -100,7 +109,7 @@ char ** argv; + exit(0); + } + +-open_obj(fname) ++void open_obj(fname) + char * fname; + { + input_file = fname; +@@ -117,7 +126,7 @@ char * fname; + fatal("Input file has bad magic number"); + } + +-copy_segment(out_offset, in_offset, length) ++void copy_segment(out_offset, in_offset, length) + long out_offset, in_offset, length; + { + char buffer[1024]; +@@ -143,7 +152,7 @@ long out_offset, in_offset, length; + } + } + +-patch_bin(file_off, value) ++void patch_bin(file_off, value) + long file_off; + int value; + { +@@ -163,7 +172,7 @@ int value; + } + } + +-read_symtable() ++void read_symtable() + { + struct nlist item; + int nitems; +@@ -234,7 +243,7 @@ read_symtable() + } + } + +-fatal(str) ++void fatal(str) + char * str; + { + fprintf(stderr, "catimage:%s: %s\n", input_file, str); +diff --git a/ld/objchop.c b/ld/objchop.c +index c7631c1..7d09619 100644 +--- a/ld/objchop.c ++++ b/ld/objchop.c +@@ -6,9 +6,12 @@ + #endif + #include "x86_aout.h" + ++void fatal(char * str); ++void write_file(char * fname, long bsize); ++ + #ifndef __OUT_OK + +-main() ++void main() + { + fprintf(stderr, "Compile error: struct exec invalid\n"); + exit(1); +@@ -19,7 +22,7 @@ main() + FILE * ifd; + struct exec header; + +-main(argc, argv) ++void main(argc, argv) + int argc; + char ** argv; + { +@@ -56,7 +59,7 @@ char ** argv; + exit(0); + } + +-write_file(fname, bsize) ++void write_file(fname, bsize) + char * fname; + long bsize; + { +@@ -81,7 +84,7 @@ long bsize; + fclose(ofd); + } + +-fatal(str) ++void fatal(str) + char * str; + { + fprintf(stderr, "objchop: %s\n", str); +diff --git a/unproto/strsave.c b/unproto/strsave.c +index c2a4b15..4c0da01 100644 +--- a/unproto/strsave.c ++++ b/unproto/strsave.c +@@ -28,6 +28,9 @@ static char strsave_sccsid[] = "@(#) strsave.c 1.1 92/01/15 21:53:13"; + + extern char *strcpy(); + extern char *malloc(); ++extern int hash(); ++extern int strcmp(); ++extern int strlen(); + + /* Application-specific stuff */ + +diff --git a/unproto/symbol.c b/unproto/symbol.c +index ce9f7d9..77da585 100644 +--- a/unproto/symbol.c ++++ b/unproto/symbol.c +@@ -44,6 +44,9 @@ static char symbol_sccsid[] = "@(#) symbol.c 1.4 92/02/15 18:59:56"; + + extern char *strcpy(); + extern char *malloc(); ++extern int strcmp(); ++extern int strlen(); ++extern int hash(); + + /* Application-specific stuff */ + +diff --git a/unproto/tok_class.c b/unproto/tok_class.c +index 38ccd0d..efe623b 100644 +--- a/unproto/tok_class.c ++++ b/unproto/tok_class.c +@@ -53,6 +53,7 @@ static char class_sccsid[] = "@(#) tok_class.c 1.4 92/01/15 21:53:02"; + extern char *strcpy(); + extern long time(); + extern char *ctime(); ++extern int strlen(); + + /* Application-specific stuff */ + +diff --git a/unproto/tok_io.c b/unproto/tok_io.c +index 3cae52e..edb2b36 100644 +--- a/unproto/tok_io.c ++++ b/unproto/tok_io.c +@@ -85,6 +85,8 @@ extern char *strchr(); + extern char *malloc(); + extern char *realloc(); + extern char *strcpy(); ++extern int strlen(); ++extern int atoi(); + + /* Application-specific stuff */ + +@@ -228,7 +230,7 @@ static int do_control() + } + out_line = in_line = line; /* synchronize */ + out_path = in_path = path; /* synchronize */ +- return; ++ return 0; + + #ifdef IGNORE_DIRECTIVES + +@@ -247,7 +249,7 @@ static int do_control() + do { + tok_free(t); + } while (t->tokno != '\n' && (t = tok_get())); +- return; ++ return 0; + } + } + } +@@ -259,12 +261,12 @@ static int do_control() + do { + tok_flush(t); + } while (t->tokno != '\n' && (t = tok_get())); +- return; ++ return 0; + + case 0: + /* Hit EOF, punt. */ + put_ch('#'); +- return; ++ return 0; + } + } + } +diff --git a/unproto/unproto.c b/unproto/unproto.c +index 1f29bff..b17b6e4 100644 +--- a/unproto/unproto.c ++++ b/unproto/unproto.c +@@ -143,6 +143,7 @@ extern void exit(); + extern int optind; + extern char *optarg; + extern int getopt(); ++extern int strcmp(); + + /* Application-specific stuff */ + +diff --git a/ar/ar.c b/ar/ar.c +index f808a3a..fce2ab7 100644 +--- a/ar/ar.c ++++ b/ar/ar.c +@@ -612,7 +612,7 @@ print_descr (member, instream) + return; + } + print_modes (member.mode); +- timestring = ctime (&member.date); ++ timestring = ctime ((const time_t *)&member.date); + printf (" %2d/%2d %6d %12.12s %4.4s %s\n", + member.uid, member.gid, + member.size, timestring + 4, timestring + 20,