[cfe-dev] Compiling xv6 with Clang

Ahmad Nouralizadeh Khorrami via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 8 15:07:56 PST 2018


Hi David,
The problem is still there. The sequence of commands to build the bootblock
(for gcc) is as follows:
gcc -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb
-m32 -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pic -O
-nostdinc -I. -c bootmain.c
gcc -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb
-m32 -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pic
-nostdinc -I. -c bootasm.S
ld -m    elf_i386 -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o
bootmain.o
objdump -S bootblock.o > bootblock.asm
objcopy -S -O binary -j .text bootblock.o bootblock
./sign.pl bootblock
There are two files (one assembly file and one C file that are linked to
generate the boot block). Any help is appreciated.
Regards.

On Sun, 4 Nov 2018 at 19:28, David Blaikie <dblaikie at gmail.com> wrote:

> Hard to say without more info - it's possible that Clang doesn't produce
> as compact code as GCC in some cases. You can try compiling with
> optimization modes that prioritize code size: -Os and -Oz (one of them is
> more agrgessive, I forget which)
>
> On Sun, Nov 4, 2018 at 3:30 AM Ahmad Nouralizadeh Khorrami via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hi.
>> I tried to compile xv6 (a 10000 line teaching operating system from MIT)
>> with Clang instead of GCC, but it led to an error. The compiled
>> bootblock was larger than 1 sector (i.e., 512 bytes). Should I change the
>> compiler options? How?
>> Thanks!
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181109/10ffc6ae/attachment.html>


More information about the cfe-dev mailing list