add new option -priority=<prio>, the default is now 5 (B_LOW_PRIORITY)

git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9575 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2004-10-28 18:09:54 +00:00
parent 403ef65902
commit 3a75ceffb4
3 changed files with 61 additions and 1 deletions

View File

@ -51,6 +51,12 @@
#define BUFSIZE 8192
#ifdef __BEOS__
#include <OS.h>
/* the thread priority used for all gcc-tools */
static int priority = B_LOW_PRIORITY;
#endif
/* Kludge declaration from BFD! This is ugly! FIXME! XXX */
struct ar_hdr *
@ -404,7 +410,17 @@ main (int argc, char **argv)
else
print_version ("ar");
}
#ifdef __BEOS__
else if (!strncmp (argv[1], "-priority=", 10))
{
priority = atol (argv[1] + 10);
}
#endif
}
#ifdef __BEOS__
set_thread_priority (find_thread(NULL), priority);
#endif
START_PROGRESS (program_name, 0);

View File

@ -60,6 +60,12 @@ extern PTR sbrk ();
#endif
#endif
#ifdef __BEOS__
#include <OS.h>
/* the thread priority used for all gcc-tools */
static int priority = B_LOW_PRIORITY;
#endif
#ifdef USING_CGEN
/* Perform any cgen specific initialisation for gas. */
extern void gas_cgen_begin (void);
@ -301,6 +307,8 @@ Options:\n\
fprintf (stream, _("\
-o OBJFILE name the object-file output OBJFILE (default a.out)\n"));
fprintf (stream, _("\
-priority=<prio> specify thread-priority to use (1-10, default is 5)\n"));
fprintf (stream, _("\
-R fold data section into text section\n"));
fprintf (stream, _("\
--statistics print various measured statistics from execution\n"));
@ -415,6 +423,10 @@ parse_args (int * pargc, char *** pargv)
OPTION_EXECSTACK,
OPTION_NOEXECSTACK,
OPTION_WARN_FATAL
#ifdef __BEOS__
,
OPTION_PRIORITY
#endif
};
static const struct option std_longopts[] =
@ -458,6 +470,10 @@ parse_args (int * pargc, char *** pargv)
{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK},
#endif
{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
#ifdef __BEOS__
,
{"priority", required_argument, NULL, OPTION_PRIORITY}
#endif
/* When you add options here, check that they do not collide with
OPTION_MD_BASE. See as.h. */
};
@ -540,6 +556,12 @@ parse_args (int * pargc, char *** pargv)
show_usage (stdout);
exit (EXIT_SUCCESS);
#ifdef __BEOS__
case OPTION_PRIORITY:
priority = atol (optarg);
break;
#endif
case OPTION_NOCPP:
break;
@ -813,6 +835,10 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
*pargc = new_argc;
*pargv = new_argv;
#ifdef __BEOS__
set_thread_priority (find_thread(NULL), priority);
#endif
#ifdef md_after_parse_args
md_after_parse_args ();
#endif

View File

@ -40,6 +40,12 @@
#include "ldemul.h"
#include "demangle.h"
#ifdef __BEOS__
#include <OS.h>
/* the thread priority used for all gcc-tools */
static int priority = B_LOW_PRIORITY;
#endif
#ifndef PATH_SEPARATOR
#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__))
#define PATH_SEPARATOR ';'
@ -142,7 +148,8 @@ enum option_values
OPTION_PIE,
OPTION_UNRESOLVED_SYMBOLS,
OPTION_WARN_UNRESOLVED_SYMBOLS,
OPTION_ERROR_UNRESOLVED_SYMBOLS
OPTION_ERROR_UNRESOLVED_SYMBOLS,
OPTION_PRIORITY
};
/* The long options. This structure is used for both the option
@ -235,6 +242,8 @@ static const struct ld_option ld_options[] =
'o', N_("FILE"), N_("Set output file name"), EXACTLY_TWO_DASHES },
{ {NULL, required_argument, NULL, '\0'},
'O', NULL, N_("Optimize output file"), ONE_DASH },
{ {"priority", required_argument, NULL, OPTION_PRIORITY},
'\0', N_("PRIO"), N_("Set thread priority to PRIO"), ONE_DASH },
{ {"Qy", no_argument, NULL, OPTION_IGNORE},
'\0', NULL, N_("Ignored for SVR4 compatibility"), ONE_DASH },
{ {"emit-relocs", no_argument, NULL, 'q'},
@ -627,6 +636,11 @@ parse_args (unsigned argc, char **argv)
else
einfo (_("%P%F: unrecognized -assert option `%s'\n"), optarg);
break;
#ifdef __BEOS__
case OPTION_PRIORITY:
priority = atol (optarg);
break;
#endif
case 'A':
ldfile_add_arch (optarg);
break;
@ -1229,6 +1243,10 @@ parse_args (unsigned argc, char **argv)
}
}
#ifdef __BEOS__
set_thread_priority (find_thread(NULL), priority);
#endif
if (ingroup)
lang_leave_group ();