add support for BeOS-target

git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9573 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2004-10-28 18:08:46 +00:00
parent 0d415dc8a4
commit 2a516d7eb9
7 changed files with 60 additions and 5 deletions

View File

@ -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)

View File

@ -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; }

View File

@ -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

View File

@ -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;

View File

@ -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";

View File

@ -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;

View File

@ -985,7 +985,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;
}