Hello every one,
I'm ported GCC to my OS with my toolchain i386-haoudos. GCC seems to work correctly( i can use gcc --version in my os).But when i try to compile a file, cc1 throws an invalid opcode because it try to use sse2 instructions.My OS doesn't support sse2, only i387 fpu. How i can disable sse2 instruction for all gcc code?
The invalide opcode is in libcpp/lex.c/search-line-sse2
If you need more informations, don't hesitate to ask me.
Thank you
Sorry for my english but i'm french
Porting gcc :SSE2 problems (invalid opcode): How to disable?
Re: Porting gcc :SSE2 problems (invalid opcode): How to disa
Supporting SSE in your OS probably requires less SLoC than your post. Instead of figuring out how to disable SSE in gcc (and all of its libraries) just enable SSE.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Re: Porting gcc :SSE2 problems (invalid opcode): How to disa
OK. How i can enable SSE and support them (especially for the scheduler) ?
- Mikaku
- Member
- Posts: 43
- Joined: Sat Jun 25, 2016 8:29 am
- Libera.chat IRC: Mikaku
- Location: Catalonia
- Contact:
Re: Porting gcc :SSE2 problems (invalid opcode): How to disa
I was also porting (now already successfully ported) GCC and Binutils to my OS, and I had _exactly_ the same problem, it took me some weeks to fix it.
Indeed the problem is in libcpp/lex.c file, and I solved it just including an exception for my OS (fiwix) in the line 277. I'm using GCC v4.7.1 so if you are using a different version the line number might vary.
Original line:
Patched line which includes my OS:
So now, ported GCC v4.7.1 is able to compile natively in my OS and produce pure i386 executables:
I hope that helped you.
Indeed the problem is in libcpp/lex.c file, and I solved it just including an exception for my OS (fiwix) in the line 277. I'm using GCC v4.7.1 so if you are using a different version the line number might vary.
Original line:
Code: Select all
#if (GCC_VERSION >= 4005) && (defined(__i386__) || defined(__x86_64__)) && !(defined(__sun__) && defined(__svr4__))
Code: Select all
#if (GCC_VERSION >= 4005) && (defined(__i386__) || defined(__x86_64__)) && !(defined(__sun__) && defined(__svr4__)) && !defined(__fiwix__)
Code: Select all
$ gcc -v
Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=./../libexec/gcc/i386-fiwix/4.7.1/lto-wrapper
Target: i386-fiwix
Configured with: ../gcc-4.7.1/configure --host=i386-fiwix --target=i386-fiwix --prefix=/usr --with-arch=i386 -with-buid-sysroot=/home/mikaku/fiwix/sysroot --with-sysroot=/ --with-gmp=/home/mikaku/fiwix/sysroot --with-mpfr=/home/mikaku/fiwix/sysroot --with-mpc=/home/mikaku/fiwix/sysroot --enable-languages=c,c++ --disable-lto --disable-shared --disable-multilib --with-newlib --disable-nls --disable-werror
Thread model: single
gcc version 4.7.1 (GCC)
Last edited by Mikaku on Fri Nov 24, 2017 5:37 pm, edited 1 time in total.
Re: Porting gcc :SSE2 problems (invalid opcode): How to disa
Yes, it's work !! (But i have an another problem ).
Thank you very much
Thank you very much