[Prev][Next][Index][Thread]

oskit-19991124 cannot be compiled with binutils-2.9.5.0.x



  Hello,

  I compiled OSKit 19991124 with gcc-2.95.2 and binutils-2.9.5.0.13
(or binutils-2.9.1.0.25) on i586-linux-gnu, but I could not build it
cleanly. There are three distinct problems.

1. 16-bits assembly problem.

"crt/x86/dos.S" has an incorrect instruction. Here is a patch for that:

--- crt/x86/dos.S.orig  Fri Nov 26 07:44:18 1999
+++ crt/x86/dos.S       Fri Nov 26 07:44:43 1999
@@ -114,7 +114,7 @@
 
        /* Start running at the new address.  */
        pushl   $EXT(i16_entry_2)
-       movw    %ax,2(%esp)
+       addr32  movw    %ax,2(%esp)
        lretw
 
 ENTRY(i16_entry_2)

But be careful, since binutils-2.9.1.0.x requires that the prefix
``addr32'' must be separate from the instruction itself like this:

addr32
movw	%ax,2(%esp)

So I'd recommend you to check the requirement in configure. In GNU
GRUB, we are using this macro:


dnl
dnl Later versions of GAS requires that addr32 and data32 prefixes
dnl appear in the same lines as the instructions they modify, while
dnl earlier versions requires that they appear in separate lines.
AC_DEFUN(grub_ASM_PREFIX_REQUIREMENT,
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(dnl
[whether addr32 must be in the same line as the instruction])
AC_CACHE_VAL(grub_cv_asm_prefix_requirement,
[cat > conftest.s <<\EOF
        .code16
l1:     addr32  movb    %al, l1
EOF

if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; the
n
  grub_cv_asm_prefix_requirement=yes
else
  grub_cv_asm_prefix_requirement=no
fi

rm -f conftest*])

if test "x$grub_cv_asm_prefix_requirement" = xyes; then
  grub_tmp_addr32="addr32"
  grub_tmp_data32="data32"
else
  grub_tmp_addr32="addr32;"
  grub_tmp_data32="data32;"
fi

AC_DEFINE_UNQUOTED([ADDR32], $grub_tmp_addr32,
  [Define it to \"addr32\" or \"addr32;\" to make GAS happy])
AC_DEFINE_UNQUOTED([DATA32], $grub_tmp_data32,
  [Define it to \"data32\" or \"data32;\" to make GAS happy])

AC_MSG_RESULT([$grub_cv_asm_prefix_requirement])])


Other bugs are found in "kern/x86/pc/i16". You are using ".code16" in
the C source files, but that is very dangerous, since GCC always
produces 32-bits assembly code. In binutils-2.9.5.0.x, you can use
".code16gcc" instead, but I haven't tested it yet.


2. FreeBSD's wrong code

"freebsd/3.x/src/lib/libc/i386/gen/alloca.S" and
"freebsd/3.x/src/lib/libc/i386/gen/alloca.S" have the same wrong
instructions:

        jmp     %edx            /* "return" */

Obviously, this should be:

        jmp     *%edx            /* "return" */


3. YACC incompatibility

In the directory "security", the following rule is defined:

ext.tab.c ext.tab.h: $(OSKIT_SRCDIR)/security/extension_parse.y
        $(YACC) -b ext -p ext -d $<
        sed -e "/#include </d" -e "/extern void \*realloc/d" ext.tab.c > ext.tab
.c.new
        mv ext.tab.c.new ext.tab.c

But you forget that not all yacc variants accept the options. In fact,
my yacc does not know the option "-p" at all:

izzy@oskit-19991124% yacc -h
usage: yacc [-dlrtv] [-b file_prefix] filename

Probably configure should find bison first, as bison accepts all of
the options "-b", "-p" and "-d".

----------------------------------------------------------------------
OKUJI Yoshinori  <okuji@kuicr.kyoto-u.ac.jp>           ^o-o^
http://duff.kuicr.kyoto-u.ac.jp/~okuji (in English)     m /

Follow-Ups: