mirror of
https://review.haiku-os.org/buildtools
synced 2026-02-05 00:13:15 +01:00
Compare commits
4 Commits
btrev43162
...
btrev43166
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ab0fe4d95 | ||
|
|
f4963fa33e | ||
|
|
c8ecfce34c | ||
|
|
51dc302367 |
@@ -17,6 +17,13 @@ OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ;'
|
||||
OTHER_END_SYMBOLS='__end__ = . ;'
|
||||
OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
|
||||
|
||||
# Use the ARM ABI-compliant exception-handling sections.
|
||||
OTHER_READONLY_SECTIONS="
|
||||
.ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) }
|
||||
${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); }
|
||||
.ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) }
|
||||
${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }"
|
||||
|
||||
TEXT_START_ADDR=0x00008000
|
||||
TARGET2_TYPE=got-rel
|
||||
|
||||
|
||||
@@ -22,9 +22,16 @@
|
||||
#ifndef GCC_AARCH64_HAIKU_H
|
||||
#define GCC_AARCH64_HAIKU_H
|
||||
|
||||
#define HAIKU_DYNAMIC_LINKER "/system/runtime_loader"
|
||||
|
||||
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__HAIKU__"); \
|
||||
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
|
||||
builtin_define ("__STDC_ISO_10646__=201103L"); \
|
||||
builtin_assert ("system=haiku"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#if TARGET_BIG_ENDIAN_DEFAULT
|
||||
#define TARGET_LINKER_EMULATION "aarch64haikub"
|
||||
@@ -32,23 +39,6 @@
|
||||
#define TARGET_LINKER_EMULATION "aarch64haiku"
|
||||
#endif
|
||||
|
||||
#undef SUBTARGET_EXTRA_LINK_SPEC
|
||||
#define SUBTARGET_EXTRA_LINK_SPEC " -m" TARGET_LINKER_EMULATION
|
||||
|
||||
#undef HAIKU_TARGET_LINK_SPEC
|
||||
#define HAIKU_TARGET_LINK_SPEC " \
|
||||
%{p:%nconsider using `-pg' instead of `-p' with gprof (1) } \
|
||||
%{v:-V} \
|
||||
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
||||
%{shared:-Bshareable %{h*} %{soname*}} \
|
||||
%{symbolic:-Bsymbolic} \
|
||||
%{static:-Bstatic} \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!shared:-dynamic-linker " HAIKU_DYNAMIC_LINKER " }} \
|
||||
-X" SUBTARGET_EXTRA_LINK_SPEC " \
|
||||
%{mbig-endian:-EB} %{mlittle-endian:-EL}"
|
||||
|
||||
#if TARGET_FIX_ERR_A53_835769_DEFAULT
|
||||
#define CA53_ERR_835769_SPEC \
|
||||
" %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}"
|
||||
@@ -65,20 +55,6 @@
|
||||
" %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}"
|
||||
#endif
|
||||
|
||||
#define LINK_SPEC HAIKU_TARGET_LINK_SPEC \
|
||||
CA53_ERR_835769_SPEC \
|
||||
CA53_ERR_843419_SPEC
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__HAIKU__"); \
|
||||
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
|
||||
builtin_define ("__STDC_ISO_10646__=201103L"); \
|
||||
builtin_assert ("system=haiku"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
|
||||
|
||||
@@ -91,4 +67,9 @@
|
||||
/* Define this to be nonzero if static stack checking is supported. */
|
||||
#define STACK_CHECK_STATIC_BUILTIN 1
|
||||
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{!o*:-o %b} -m " TARGET_LINKER_EMULATION " %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}\
|
||||
%{mbig-endian:-EB} %{mlittle-endian:-EL} " CA53_ERR_835769_SPEC " " CA53_ERR_843419_SPEC " -X"
|
||||
|
||||
#endif /* GCC_AARCH64_HAIKU_H */
|
||||
|
||||
15
jam/Jambase
15
jam/Jambase
@@ -135,7 +135,7 @@
|
||||
|
||||
# for perforce use -- jambase version
|
||||
|
||||
JAMBASEDATE = 2018.11.21 ;
|
||||
JAMBASEDATE = 2020.09.16 ;
|
||||
|
||||
# Initialize variables
|
||||
#
|
||||
@@ -155,7 +155,8 @@ if $(NT) {
|
||||
SUFEXE ?= .exe ;
|
||||
|
||||
if $(MSVC) {
|
||||
AR ?= lib /nologo ;
|
||||
AR ?= lib ;
|
||||
ARFLAGS ?= /nologo ;
|
||||
CC ?= cl /nologo ;
|
||||
CCFLAGS ?= /D \"WIN\" ;
|
||||
C++ ?= $(CC) ;
|
||||
@@ -180,6 +181,7 @@ if $(NT) {
|
||||
local I ; if $(OSPLAT) = IA64 { I = ia64\\ ; } else { I = "" ; }
|
||||
|
||||
AR ?= lib ;
|
||||
ARFLAGS ?= ;
|
||||
AS ?= masm386 ;
|
||||
CC ?= cl /nologo ;
|
||||
CCFLAGS ?= "" ;
|
||||
@@ -205,7 +207,8 @@ if $(NT) {
|
||||
RANLIB ?= "ranlib" ;
|
||||
SUFEXE ?= .exe ;
|
||||
} else if $(OS) = BEOS && $(OSPLAT) = PPC {
|
||||
AR ?= mwld -xml -o ;
|
||||
AR ?= mwld ;
|
||||
ARFLAGS ?= -xml -o ;
|
||||
BINDIR ?= /boot/home/config/bin ;
|
||||
CC ?= mwcc ;
|
||||
CCFLAGS ?= -nosyspath ;
|
||||
@@ -280,6 +283,7 @@ if $(NT) {
|
||||
|
||||
case QNX :
|
||||
AR ?= wlib ;
|
||||
ARFLAGS ?= ;
|
||||
CC ?= cc ;
|
||||
CCFLAGS ?= -Q ; # quiet
|
||||
C++ ?= $(CC) ;
|
||||
@@ -311,7 +315,8 @@ if $(NT) {
|
||||
# General defaults; a lot like UNIX
|
||||
#
|
||||
|
||||
AR ?= ar ru ;
|
||||
AR ?= ar ;
|
||||
ARFLAGS ?= ru ;
|
||||
AS ?= as ;
|
||||
ASFLAGS ?= ;
|
||||
AWK ?= awk ;
|
||||
@@ -1419,7 +1424,7 @@ if $(NT) {
|
||||
|
||||
actions updated together piecemeal Archive
|
||||
{
|
||||
$(AR) $(<) $(>)
|
||||
$(AR) $(ARFLAGS) $(<) $(>)
|
||||
}
|
||||
|
||||
actions As
|
||||
|
||||
22
jam/jam.c
22
jam/jam.c
@@ -141,6 +141,7 @@ struct globs globs = {
|
||||
# else
|
||||
{ 0, 1 }, /* display actions */
|
||||
# endif
|
||||
0, /* output compilation db here */
|
||||
0 /* output commands, not run them */
|
||||
} ;
|
||||
|
||||
@@ -182,7 +183,7 @@ main( int argc, char **argv, char **arg_environ )
|
||||
|
||||
argc--, argv++;
|
||||
|
||||
if( ( n = getoptions( argc, argv, "d:j:f:gs:t:ano:qv", optv ) ) < 0 )
|
||||
if( ( n = getoptions( argc, argv, "d:j:f:gs:t:ano:cqv", optv ) ) < 0 )
|
||||
{
|
||||
printf( "\nusage: jam [ options ] targets...\n\n" );
|
||||
|
||||
@@ -197,6 +198,7 @@ main( int argc, char **argv, char **arg_environ )
|
||||
printf( "-jx Run up to x shell commands concurrently.\n" );
|
||||
printf( "-n Don't actually execute the updating actions.\n" );
|
||||
printf( "-ox Write the updating actions to file x.\n" );
|
||||
printf( "-c Output JSON compilation database to compile_commands.json.\n" );
|
||||
printf( "-q Quit quickly as soon as a target fails.\n" );
|
||||
printf( "-sx=y Set variable x=y, overriding environment.\n" );
|
||||
printf( "-tx Rebuild x, even if it is up-to-date.\n" );
|
||||
@@ -279,6 +281,17 @@ main( int argc, char **argv, char **arg_environ )
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're asked to produce a compilation database, open the file. */
|
||||
if ( ( s = getoptval( optv, 'c', 0 ) ) )
|
||||
{
|
||||
if ( !( globs.comp_db = fopen( "compile_commands.json", "w" ) ) )
|
||||
{
|
||||
printf( "Failed to write to 'compile_commands.json'\n");
|
||||
exit( EXITBAD );
|
||||
}
|
||||
fprintf(globs.comp_db, "[\n");
|
||||
}
|
||||
|
||||
/* Set JAMDATE first */
|
||||
|
||||
{
|
||||
@@ -439,5 +452,12 @@ main( int argc, char **argv, char **arg_environ )
|
||||
if( globs.cmdout )
|
||||
fclose( globs.cmdout );
|
||||
|
||||
/* close compilation database output file */
|
||||
if ( globs.comp_db )
|
||||
{
|
||||
fprintf(globs.comp_db, "]\n");
|
||||
fclose( globs.comp_db );
|
||||
}
|
||||
|
||||
return status ? EXITBAD : EXITOK;
|
||||
}
|
||||
|
||||
@@ -500,6 +500,7 @@ struct globs {
|
||||
int quitquick;
|
||||
int newestfirst; /* build newest sources first */
|
||||
char debug[DEBUG_MAX];
|
||||
FILE *comp_db; /* output compilation db here */
|
||||
FILE *cmdout; /* print cmds, not run them */
|
||||
} ;
|
||||
|
||||
|
||||
89
jam/make1.c
89
jam/make1.c
@@ -62,6 +62,8 @@
|
||||
# include "command.h"
|
||||
# include "execcmd.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static void make1a( TARGET *t, TARGET *parent );
|
||||
static void make1b( TARGET *t );
|
||||
static void make1c( TARGET *t );
|
||||
@@ -73,6 +75,12 @@ static LIST *make1list( LIST *l, TARGETS *targets, int flags,
|
||||
static SETTINGS *make1settings( LIST *vars );
|
||||
static void make1bind( TARGET *t, int warn );
|
||||
|
||||
void out_compile_database(
|
||||
char const * const action,
|
||||
char const * const source,
|
||||
char const * const command
|
||||
);
|
||||
|
||||
/* Ugly static - it's too hard to carry it through the callbacks. */
|
||||
|
||||
static struct {
|
||||
@@ -295,6 +303,17 @@ make1c( TARGET *t )
|
||||
if( globs.cmdout )
|
||||
fprintf( globs.cmdout, "%s", cmd->buf );
|
||||
|
||||
if ( globs.comp_db != NULL )
|
||||
{
|
||||
const char* rule_name = cmd->rule->name;
|
||||
const char* target_name = lol_get( (LOL *)&cmd->args, 0 )->string;
|
||||
const char* source_name = NULL;
|
||||
LIST* sources = lol_get( (LOL *)&cmd->args, 1);
|
||||
if (sources != NULL)
|
||||
source_name = lol_get((LOL *)&cmd->args, 1 )->string;
|
||||
out_compile_database( rule_name, source_name, cmd->buf );
|
||||
}
|
||||
|
||||
if( globs.noexec )
|
||||
{
|
||||
make1d( t, EXEC_CMD_OK );
|
||||
@@ -671,3 +690,73 @@ make1bind(
|
||||
t->binding = t->time ? T_BIND_EXISTS : T_BIND_MISSING;
|
||||
popsettings( t->settings );
|
||||
}
|
||||
|
||||
|
||||
static void out_json(char const* str, FILE* f)
|
||||
{
|
||||
char const* escape_src = "\"\\\b\n\r\t";
|
||||
char const* escape_subst[] = {
|
||||
"\\\"", "\\\\", "\\b", "\\n", "\\r", "\\t"
|
||||
};
|
||||
char buffer[1024];
|
||||
int i = 0;
|
||||
|
||||
/* trim leading whitespace */
|
||||
while (*str != 0 && strchr(" \t\n\r\t", *str) != NULL)
|
||||
++str;
|
||||
|
||||
for (; *str != 0; ++str)
|
||||
{
|
||||
char const* ch;
|
||||
char const* subst;
|
||||
if (i >= sizeof(buffer) - 10)
|
||||
{
|
||||
buffer[i] = 0;
|
||||
fputs(buffer, f);
|
||||
i = 0;
|
||||
}
|
||||
|
||||
/* skip non-printable characters */
|
||||
if ((unsigned)*str < ' ') continue;
|
||||
|
||||
ch = strchr(escape_src, *str);
|
||||
if (ch == NULL)
|
||||
{
|
||||
buffer[i++] = *str;
|
||||
continue;
|
||||
}
|
||||
subst = escape_subst[ch - escape_src];
|
||||
strcpy(&buffer[i], subst);
|
||||
i += strlen(subst);
|
||||
}
|
||||
|
||||
buffer[i] = 0;
|
||||
fputs(buffer, f);
|
||||
}
|
||||
|
||||
|
||||
void out_compile_database
|
||||
(
|
||||
char const * const action,
|
||||
char const * const source,
|
||||
char const * const command
|
||||
)
|
||||
{
|
||||
/* file format defined here:
|
||||
* http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
||||
* we're not interested in link, mkdir, rm or any non-compile action
|
||||
*/
|
||||
if (source
|
||||
&& (strstr(action, "Cc") != NULL || strstr(action, "C++") != NULL))
|
||||
{
|
||||
char buffer[PATH_MAX];
|
||||
fputs("{ \"directory\": \"", globs.comp_db);
|
||||
out_json(getcwd(buffer, sizeof(buffer)), globs.comp_db);
|
||||
fputs("\", \"command\": \"", globs.comp_db);
|
||||
out_json(command, globs.comp_db);
|
||||
fputs("\", \"file\": \"", globs.comp_db);
|
||||
out_json(source, globs.comp_db);
|
||||
fputs("\" },\n", globs.comp_db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user