# Static library paths
CRT0 = $(KLIBOBJ)/crt0.o
KLIBC = $(KLIBOBJ)/libc.a
-LIBGCC = $(shell $(CC) --print-libgcc)
+LIBGCC = $(shell $(CC) $(REQFLAGS) $(OPTFLAGS) --print-libgcc)
# Shared library paths
CRTSHARED = $(KLIBOBJ)/interp.o
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
- set -xe ; for d in linux asm-$(ARCH) asm-generic $(ASMARCH); do \
+ set -xe ; for d in linux scsi asm-$(ARCH) asm-generic $(ASMARCH); do \
mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \
for r in $(KRNLSRC)/include $(KRNLOBJ)/include $(KRNLOBJ)/include2 ; do \
[ ! -d $$r/$$d ] || \
/* How to declare a function that *must* be inlined */
#ifdef __GNUC__
-# if __GNUC_MAJOR__ >= 3
+# if __GNUC__ >= 3
# define __must_inline static __inline__ __attribute__((always_inline))
# else
# define __must_inline extern __inline__
#endif
/* malloc() function (returns unaliased pointer) */
-#if defined(__GNUC__) && (__GNUC_MAJOR__ >= 3)
+#if defined(__GNUC__) && (__GNUC__ >= 3)
# define __mallocfunc __attribute__((malloc))
#else
# define __mallocfunc
#endif
/* likely/unlikely */
-#if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95))
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define __likely(x) __builtin_expect((x), 1)
# define __unlikely(x) __builtin_expect((x), 0)
#else
return system(@_);
}
+#
+# Initialization
+#
+open(NULL, '+<', '/dev/null') or die "$0: cannot open /dev/null\n";
+
#
# Begin parsing options.
#
}
}
+ # Get the libgcc pathname for the *current* gcc
+ open(LIBGCC, '-|', $CC, @ccopt, '-print-libgcc-file-name')
+ or die "$0: cannot get libgcc filename\n";
+ $libgcc = <LIBGCC>;
+ chomp $libgcc;
+ close(LIBGCC);
+
if ( $shared ) {
- $rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs, @sharedlib);
+ $rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs, @sharedlib, $libgcc);
} else {
- $rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs, @staticlib);
+ $rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs, @staticlib, $libgcc);
}
unlink(@rmobjs);
# accordingly.
#
-OPTFLAGS = -Os
+OPTFLAGS = -Os -m32 -mptr32
BITSIZE = 32
# Extra linkflags when building the shared version of the library
arch/$(ARCH)/umul.o \
arch/$(ARCH)/setjmp.o \
arch/$(ARCH)/syscall.o \
- arch/$(ARCH)/sysfork.o
+ arch/$(ARCH)/sysfork.o \
+ libgcc/__divdi3.o \
+ libgcc/__moddi3.o \
+ libgcc/__udivdi3.o \
+ libgcc/__umoddi3.o \
+ libgcc/__udivmoddi4.o
arch/$(ARCH)/sdiv.S: arch/$(ARCH)/divrem.m4
@echo 'building $@ from $^'
#define TARGET_PTR_SIZE 32
-#include "arch/sparc/crt0i.S"
+#include "crt0i.S"