Skip to content

Instantly share code, notes, and snippets.

@X547
Last active August 14, 2021 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save X547/451e2fd4fd7076794e89cf03e3b902f1 to your computer and use it in GitHub Desktop.
Save X547/451e2fd4fd7076794e89cf03e3b902f1 to your computer and use it in GitHub Desktop.
Haiku Buildtools btrev43166 changes for RISC-V
From 387ae84090e3d3622da00b6e28681fda479a7da3 Mon Sep 17 00:00:00 2001
From: X512 <danger_mail@list.ru>
Date: Mon, 25 May 2020 01:00:39 +0900
Subject: jam: use load_image on Haiku
---
jam/execunix.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/jam/execunix.c b/jam/execunix.c
index 11f73ca1db..ff25b6d999 100644
--- a/jam/execunix.c
+++ b/jam/execunix.c
@@ -54,6 +54,10 @@
# define USE_POSIX_SPAWN
# endif
+# ifdef __HAIKU__
+# define USE_LOAD_IMAGE
+# endif
+
# ifdef unix
# include <unistd.h>
@@ -62,6 +66,11 @@ extern char **environ;
# include <spawn.h>
# endif
+# ifdef USE_LOAD_IMAGE
+# include <OS.h>
+# include <image.h>
+# endif
+
# endif
# ifdef OS_NT
@@ -243,6 +252,15 @@ execcmd(
exit( EXITBAD );
}
# else
+# ifdef USE_LOAD_IMAGE
+ int argc = 0;
+ while (argv[argc] != NULL) argc++;
+ if ((pid = load_image(argc, argv, (const char**)environ)) < B_OK) {
+ perror( "load_image" );
+ exit( EXITBAD );
+ }
+ resume_thread(pid);
+# else
# ifdef NO_VFORK
if ((pid = fork()) == 0)
{
@@ -263,6 +281,7 @@ execcmd(
exit( EXITBAD );
}
# endif
+# endif
# endif
/* Save the operation for execwait() to find. */
--
2.30.2
From e1def14deefa73f23d96be96a27865b297775024 Mon Sep 17 00:00:00 2001
From: X512 <danger_mail@list.ru>
Date: Thu, 17 Dec 2020 02:55:22 +0900
Subject: jam: show build progress for each target
---
jam/make.c | 15 ++++-----------
jam/make.h | 11 +++++++++++
jam/make1.c | 4 ++--
3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/jam/make.c b/jam/make.c
index 292beadaf8..9b2550c112 100644
--- a/jam/make.c
+++ b/jam/make.c
@@ -67,17 +67,10 @@
# define max( a,b ) ((a)>(b)?(a):(b))
# endif
-typedef struct {
- int temp;
- int updating;
- int cantfind;
- int cantmake;
- int targets;
- int made;
-} COUNTS ;
+MAKE_COUNTS make_counts[1];
static void make0( TARGET *t, TARGET *p, int depth,
- COUNTS *counts, int anyhow );
+ MAKE_COUNTS *counts, int anyhow );
static TARGETS *make0sort( TARGETS *c );
@@ -118,7 +111,7 @@ make(
int anyhow )
{
int i;
- COUNTS counts[1];
+ MAKE_COUNTS *counts = make_counts;
int status = 0; /* 1 if anything fails */
#ifdef OPT_HEADER_CACHE_EXT
@@ -172,7 +165,7 @@ make0(
TARGET *t,
TARGET *p, /* parent */
int depth, /* for display purposes */
- COUNTS *counts, /* for reporting */
+ MAKE_COUNTS *counts, /* for reporting */
int anyhow ) /* forcibly touch all (real) targets */
{
TARGETS *c, *d, *incs;
diff --git a/jam/make.h b/jam/make.h
index 9fa0b73d06..138e912d69 100644
--- a/jam/make.h
+++ b/jam/make.h
@@ -10,5 +10,16 @@
* 11/04/02 (seiwald) - const-ing for string literals
*/
+typedef struct {
+ int temp;
+ int updating;
+ int cantfind;
+ int cantmake;
+ int targets;
+ int made;
+} MAKE_COUNTS ;
+
+extern MAKE_COUNTS make_counts[1];
+
int make( int n_targets, const char **targets, int anyhow );
int make1( TARGET *t );
diff --git a/jam/make1.c b/jam/make1.c
index 906b41a393..9219b7fda2 100644
--- a/jam/make1.c
+++ b/jam/make1.c
@@ -248,8 +248,8 @@ make1b( TARGET *t )
{
++counts->total;
- if( DEBUG_MAKE && !( counts->total % 100 ) )
- printf( "...on %dth target...\n", counts->total );
+ if( DEBUG_MAKE )
+ printf( "[%d/%d] ", counts->total, make_counts->updating );
pushsettings( t->settings );
t->cmds = (char *)make1cmds( t->actions );
--
2.30.2
From d4a86f4db5d202d24000dfb2e331aa73c9000adb Mon Sep 17 00:00:00 2001
From: X512 <danger_mail@list.ru>
Date: Sat, 29 May 2021 16:20:38 +0900
Subject: defaults: -mno-relax, fno-omit-frame-pointer
Relaxation is currently broken.
Change-Id: Iea9b8fec51adb192052f55cc49a8c1d922e27aa4
---
gcc/gcc/config/haiku.h | 2 +-
gcc/gcc/config/riscv/riscv.opt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/gcc/config/haiku.h b/gcc/gcc/config/haiku.h
index e3a9c7e821..26db28835e 100644
--- a/gcc/gcc/config/haiku.h
+++ b/gcc/gcc/config/haiku.h
@@ -48,7 +48,7 @@ Boston, MA 02111-1307, USA. */
#undef CC1_SPEC
#define CC1_SPEC \
"%{fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE:;:-fPIC} \
- %{!Wmultichar: -Wno-multichar} %(cc1_cpu) %{profile:-p}"
+ %{!Wmultichar: -Wno-multichar} %{!fomit-frame-pointer: -fno-omit-frame-pointer} %(cc1_cpu) %{profile:-p}"
#undef CC1PLUS_SPEC
#define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}"
diff --git a/gcc/gcc/config/riscv/riscv.opt b/gcc/gcc/config/riscv/riscv.opt
index b37ac75d9b..209afa8fc0 100644
--- a/gcc/gcc/config/riscv/riscv.opt
+++ b/gcc/gcc/config/riscv/riscv.opt
@@ -107,7 +107,7 @@ Target Report Mask(EXPLICIT_RELOCS)
Use %reloc() operators, rather than assembly macros, to load addresses.
mrelax
-Target Bool Var(riscv_mrelax) Init(1)
+Target Bool Var(riscv_mrelax) Init(0)
Take advantage of linker relaxations to reduce the number of instructions
required to materialize symbol addresses.
--
2.30.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment