Ada and name mangling
Posted: Mon Jan 31, 2011 9:37 am
Hello OSDev.org Community!
This is my first post on the forums, but I have been reading these threads for about two years now, give or take a bit. I find this place to be one of my most valuable resources to developing my own OS.
I've been programming for about ten years now, give or take a few again(I know, so vague!). I've experimented with a fairly large number of programming languages, and in the recent years have started researching OS development, and started keeping lots of notes.
I've followed all sorts of tutorials and even just played around with things myself, applying what I know and finding out the results. Learn by doing! That being said, I usually never bother asking anyone else for help, since usually the answer can be found in the error messages, the internet, books, or various other resources.
For the little OS fun I am working on right now, I am using GRUB-legacy and GRUB2 as a bootloader, a few lines of assembly code to get me into my kernel entry function/method/procedure/routine. I use this as a base/template to test out writing kernel code in different languages.
Sorry for all of the background info, here is the real reason I am posting:
I am trying to load an extremely short kernel written in Ada. It is basically an empty for loop.
I used:
to only compile the file.
Since, I like to also snoop around, I automatically checked the resulting object file with:
to view the assembly code, and:
to view the symbols.
I noticed immediately that the symbol that would indicate my kernels start was prefixed with '_ada_'. Which now finally brings me to my question. Is there an option in gcc or gnat to specifiy not using the prefix or keep it from name mangling?
I've read the various documentations for gcc / gnat / gnatmake / gnatbind and such, and I saw no such thing. Also, if there is no way of changing how the compiler outputs the symbol, would it be plausible to write a script to patch the symbol?
Thanks for any ideas or thoughts you might have on the matter!
-Kris
p.s. I've tried my hardest to find info on this and have had no luck. I've also never had to deal much with making sure things like this 'add up'.
This is my first post on the forums, but I have been reading these threads for about two years now, give or take a bit. I find this place to be one of my most valuable resources to developing my own OS.
I've been programming for about ten years now, give or take a few again(I know, so vague!). I've experimented with a fairly large number of programming languages, and in the recent years have started researching OS development, and started keeping lots of notes.
I've followed all sorts of tutorials and even just played around with things myself, applying what I know and finding out the results. Learn by doing! That being said, I usually never bother asking anyone else for help, since usually the answer can be found in the error messages, the internet, books, or various other resources.
For the little OS fun I am working on right now, I am using GRUB-legacy and GRUB2 as a bootloader, a few lines of assembly code to get me into my kernel entry function/method/procedure/routine. I use this as a base/template to test out writing kernel code in different languages.
Sorry for all of the background info, here is the real reason I am posting:
I am trying to load an extremely short kernel written in Ada. It is basically an empty for loop.
I used:
Code: Select all
gcc -c main.adb
Since, I like to also snoop around, I automatically checked the resulting object file with:
Code: Select all
objdump -d main.o
Code: Select all
objdump -t main.o
I noticed immediately that the symbol that would indicate my kernels start was prefixed with '_ada_'. Which now finally brings me to my question. Is there an option in gcc or gnat to specifiy not using the prefix or keep it from name mangling?
I've read the various documentations for gcc / gnat / gnatmake / gnatbind and such, and I saw no such thing. Also, if there is no way of changing how the compiler outputs the symbol, would it be plausible to write a script to patch the symbol?
Thanks for any ideas or thoughts you might have on the matter!
-Kris
p.s. I've tried my hardest to find info on this and have had no luck. I've also never had to deal much with making sure things like this 'add up'.