GCC 4.0 & C++ ABI
-
ineo
GCC 4.0 & C++ ABI
I guess most of you already know gcc 4.0 is released. Among the changes, the C++ ABI has been updated. For those interested in writing an OS using C++, this might be a great step forward. I have no time yet to read the enhancements, but I had some troubles with it in the past.
In the hope this will be more standard, less hacky...
INeo
In the hope this will be more standard, less hacky...
INeo
-
distantvoices
- Member

- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:GCC 4.0 & C++ ABI
according to some rants on OSNEWS, they've implemented some generalized optimization stuff based on the parsed tree structure of the program - is said to be much more like the program.
Gonna see, how performant and bug save this one is. It shouldn't do too much harm to give it a compile and test run.
Gonna see, how performant and bug save this one is. It shouldn't do too much harm to give it a compile and test run.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
-
AR
Re:GCC 4.0 & C++ ABI
I've already compiled a cross compiler for GCC 4.0.0, I had some minor problems during the build (needed to manually create symbolic links because the relative paths in the makefiles were wrong).
The optimizer is nuts as well, it broke my GDT code (It completely stripped the constructing code for the GDT load descriptor because it was only used as "&gdt" by the inline assembly...). The new optimizations look powerful but I don't recommend this version for kernel development if you want to use optimization [if you only intend to use -O0 or maybe -O1 then it should be fine], should be good for user space apps but watch out for what it does to inline assembly as well.
The optimizer is nuts as well, it broke my GDT code (It completely stripped the constructing code for the GDT load descriptor because it was only used as "&gdt" by the inline assembly...). The new optimizations look powerful but I don't recommend this version for kernel development if you want to use optimization [if you only intend to use -O0 or maybe -O1 then it should be fine], should be good for user space apps but watch out for what it does to inline assembly as well.
Code: Select all
__asm__ ("INVLPG (%0)" : : "g" (Address));
/* Got compiled into... */
INVLPG (-52(%esp))
/* ... which GAS chokes on */- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:GCC 4.0 & C++ ABI
I'd dare to say it wasn't a very wise use of inline assembly... i mean, telling the compiler "put Address in whatever form you want" and then "use that form within a [reference]" ... at least you should have used "invlpg(%0)"::"r"(Address) or even "invlpg %0"::"m"(*(dword*)m)), which was once suggested by Can'tRememberWhomButThatMightBeTimTheGrey.AR wrote: watch out for what it does to inline assembly as well.Code: Select all
__asm__ ("INVLPG (%0)" : : "g" (Address)); /* Got compiled into... */ INVLPG (-52(%esp)) /* ... which GAS chokes on */
-
distantvoices
- Member

- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:GCC 4.0 & C++ ABI
Well .. sometimes one uses a hack and later on discovers a more elegant and nice method to do the same thing. 
I've also heard(read) rumors about gcc 4.0 having build issues in certain spots - which do not hinder it to compile&bind completely. I daresay the developers should give the thing a more proper testing phase ere they publish it as production ready.
re - TimTheGrey: where is he actually? bound in Military Service or just dropped OS Dev outta thin air?
I've also heard(read) rumors about gcc 4.0 having build issues in certain spots - which do not hinder it to compile&bind completely. I daresay the developers should give the thing a more proper testing phase ere they publish it as production ready.
re - TimTheGrey: where is he actually? bound in Military Service or just dropped OS Dev outta thin air?
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
-
AR
Re:GCC 4.0 & C++ ABI
Thanks, I've been having difficulty getting a decent list of all the parameters for inline assembly. I still don't know how to get rid of the first problem without dummy code though.
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:GCC 4.0 & C++ ABI
you could try to make the assembly that uses "&gdt" volatile.
-
AR
Re:GCC 4.0 & C++ ABI
That didn't work but you pointed me in the right direction, I made the variable itself volatile and it is now working properly.
Another thing as well, they've added a new error/warning:This refuses to build (using -Wall -Werror, didn't try without), it requires the internal part be wrapped in brackets:This should help with those accidentally leaving out the second equals bugs.
Another thing as well, they've added a new error/warning:
Code: Select all
if(Mem = Memory::Physical::GetPage())Code: Select all
if( (Mem = Memory::Physical::GetPage()) )- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:GCC 4.0 & C++ ABI
That one has been there in -Wall for long time (iirc, i have it down to 2.95.3 !)AR wrote: This should help with those accidentally leaving out the second equals bugs.
-
AR
Re:GCC 4.0 & C++ ABI
I only found this now as it only just started complaining, I've been using -Wall -Werror on GCC-3.4.3 for ages and it never complained.
Re:GCC 4.0 & C++ ABI
That might've been in -pedantic or something, at least, I've had the message a few times in the past (long time ago, so 3.2 or 2.95.x).