mirror of
https://review.haiku-os.org/buildtools
synced 2026-02-05 00:13:15 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a75ceffb4 | ||
|
|
403ef65902 | ||
|
|
2a516d7eb9 |
@@ -38,6 +38,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define S_IXOTH 0001 /* Execute by others. */
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
static unsigned char _bfdio_files[OPEN_MAX+1];
|
||||
#endif
|
||||
|
||||
file_ptr
|
||||
real_ftell (FILE *file)
|
||||
{
|
||||
@@ -53,6 +57,9 @@ real_ftell (FILE *file)
|
||||
int
|
||||
real_fseek (FILE *file, file_ptr offset, int whence)
|
||||
{
|
||||
#ifdef __BEOS__
|
||||
_bfdio_files[fileno(file)] = 1;
|
||||
#endif
|
||||
#if defined (HAVE_FSEEKO64)
|
||||
return fseeko64 (file, offset, whence);
|
||||
#elif defined (HAVE_FSEEKO)
|
||||
@@ -175,7 +182,44 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
|
||||
return size;
|
||||
}
|
||||
|
||||
#if defined __BEOS__
|
||||
{
|
||||
FILE *f;
|
||||
f = bfd_cache_lookup (abfd);
|
||||
if (_bfdio_files[fileno(f)] == 1)
|
||||
{
|
||||
file_ptr eof;
|
||||
file_ptr pos;
|
||||
|
||||
pos = ftell (f);
|
||||
fseek (f, 0L, SEEK_END);
|
||||
eof = ftell(f);
|
||||
|
||||
if (eof < pos)
|
||||
{
|
||||
file_ptr diff;
|
||||
static char zeros[512];
|
||||
|
||||
diff = pos - eof;
|
||||
|
||||
while (diff >= sizeof (zeros))
|
||||
{
|
||||
fwrite(zeros, sizeof (zeros), 1, f);
|
||||
diff -= sizeof (zeros);
|
||||
}
|
||||
if (diff > 0)
|
||||
fwrite(zeros, diff, 1, f);
|
||||
}
|
||||
else
|
||||
fseek (f, pos, SEEK_SET);
|
||||
|
||||
_bfdio_files[fileno(f)] = 0;
|
||||
}
|
||||
nwrote = fwrite (ptr, 1, (size_t) size, f);
|
||||
}
|
||||
#else
|
||||
nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
|
||||
#endif
|
||||
if (nwrote != (size_t) -1)
|
||||
abfd->where += nwrote;
|
||||
if (nwrote != size)
|
||||
|
||||
2
binutils/bfd/configure
vendored
2
binutils/bfd/configure
vendored
@@ -919,7 +919,7 @@ fi
|
||||
|
||||
PACKAGE=bfd
|
||||
|
||||
VERSION=2.15
|
||||
VERSION=2.15-beos-041025
|
||||
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@section
|
||||
ELF backends
|
||||
@section ELF backends
|
||||
|
||||
BFD support for ELF formats is being worked on.
|
||||
Currently, the best supported back ends are for sparc and i386
|
||||
|
||||
@@ -2311,10 +2311,32 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
/* r_symndx will be zero only for relocs against symbols
|
||||
from removed linkonce sections, or sections discarded by
|
||||
a linker script. */
|
||||
if (r_symndx == 0
|
||||
|| (input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
{
|
||||
bfd_boolean skip, relocate;
|
||||
skip = FALSE;
|
||||
relocate = FALSE;
|
||||
|
||||
/* [zooey]: the dynamic loader of newer BeOS versions (BONE,Dano,Zeta)
|
||||
is broken to such an extent that crashes when it encounters
|
||||
a R_386_NONE reloc entry with a zero offset. In order to
|
||||
circumvent this bug, I changed the skip-handling below
|
||||
such that it keeps the original offset (of the now defunct
|
||||
relocation target) in place. This way, the loader
|
||||
accepts it (and ignores this reloc entry, as it should). */
|
||||
if (r_symndx == 0)
|
||||
skip = TRUE;
|
||||
#if 0
|
||||
if (r_symndx == 0)
|
||||
{
|
||||
/* Zero the section contents as a hint to unwinders and
|
||||
other consumers of exception handling info that this
|
||||
entry is invalid. */
|
||||
bfd_put_32 (input_bfd, 0, contents + rel->r_offset);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if ((input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
if ((info->shared
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
@@ -2335,16 +2357,12 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_byte *loc;
|
||||
bfd_boolean skip, relocate;
|
||||
asection *sreloc;
|
||||
|
||||
/* When generating a shared object, these relocations
|
||||
are copied into the output file to be resolved at run
|
||||
time. */
|
||||
|
||||
skip = FALSE;
|
||||
relocate = FALSE;
|
||||
|
||||
outrel.r_offset =
|
||||
_bfd_elf_section_offset (output_bfd, info, input_section,
|
||||
rel->r_offset);
|
||||
@@ -2356,7 +2374,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
+ input_section->output_offset);
|
||||
|
||||
if (skip)
|
||||
memset (&outrel, 0, sizeof outrel);
|
||||
outrel.r_info = ELF32_R_INFO (0, R_386_NONE);
|
||||
else if (h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& (r_type == R_386_PC32
|
||||
@@ -2388,7 +2406,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case R_386_TLS_IE:
|
||||
if (info->shared)
|
||||
{
|
||||
|
||||
@@ -7813,6 +7813,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
{
|
||||
default:
|
||||
continue;
|
||||
/* BeOS (R5) doesn't know about DT_RELCOUNT, so we avoid using it */
|
||||
#ifndef __BEOS__
|
||||
case DT_NULL:
|
||||
if (relativecount > 0 && dyncon + bed->s->sizeof_dyn < dynconend)
|
||||
{
|
||||
@@ -7827,7 +7829,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
|
||||
#endif
|
||||
case DT_INIT:
|
||||
name = info->init_function;
|
||||
goto get_sym;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -386,6 +386,10 @@ static int verbose;
|
||||
static FILE *output_def;
|
||||
static FILE *base_file;
|
||||
|
||||
#ifdef DLLTOOL_BEOS
|
||||
static const char *mname = "beos";
|
||||
#endif
|
||||
|
||||
#ifdef DLLTOOL_ARM
|
||||
#ifdef DLLTOOL_ARM_EPOC
|
||||
static const char *mname = "arm-epoc";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -301,7 +301,8 @@ main (int argc, char **argv)
|
||||
link_info.notice_all = FALSE;
|
||||
link_info.nocopyreloc = FALSE;
|
||||
link_info.new_dtags = FALSE;
|
||||
link_info.combreloc = TRUE;
|
||||
/* disable combreloc by default for BeOS: */
|
||||
link_info.combreloc = FALSE;
|
||||
link_info.eh_frame_hdr = FALSE;
|
||||
link_info.strip_discarded = TRUE;
|
||||
link_info.strip = strip_none;
|
||||
|
||||
@@ -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;
|
||||
@@ -985,7 +999,12 @@ parse_args (unsigned argc, char **argv)
|
||||
/* When creating a shared library, the default
|
||||
behaviour is to ignore any unresolved references. */
|
||||
if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET)
|
||||
#ifdef __BEOS__
|
||||
/* BeOS uses -shared for apps, but wants to report undefined symbols for them */
|
||||
link_info.unresolved_syms_in_objects = how_to_report_unresolved_symbols;
|
||||
#else
|
||||
link_info.unresolved_syms_in_objects = RM_IGNORE;
|
||||
#endif
|
||||
if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET)
|
||||
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
|
||||
}
|
||||
@@ -1224,6 +1243,10 @@ parse_args (unsigned argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __BEOS__
|
||||
set_thread_priority (find_thread(NULL), priority);
|
||||
#endif
|
||||
|
||||
if (ingroup)
|
||||
lang_leave_group ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user