-
Notifications
You must be signed in to change notification settings - Fork 0
a-rubini/povacca
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a trivial RPN calculator. It is meant to explain ELF sections (or named sections in general). when ==== It was born as code to be written during a lesson, and the first commit here is actually what I wrote on 2009-05-20 while teaching. who === Me for my students why === Because I needed something horribly simple to show the use of named sections. The name is an Italian joke on "polish", I'd better keep it unchanged as most of my students are Italian anyways. what ==== An RPN calculator for the command line: "./povacca 4 5 +". It knows the following operators: "+" and "add" (synonyms) from poadd.c "*" and "mul" (synonyms) from pomul.c "pop" from popop.c how (whow?) =========== Using named sections. Definitions of operators live in a separate .oper section, so the linker juxtaposes all of them in the output file. A linker script (bigobj.lds) is used to merge this section in the .data section, and to add named symbols for the start and end of the .oper array. The net effect is that you can drop new files in the source directory to add new operators (you'll need to add the object names to Makefile too). You'll never need to change pomain.c in order to add operators. what's next? =========== Nothing. Small examples should remain small. Thanks to Emilio Garcia Cota for adding "make clean" and ".gitignore", but that's all. Well... I must add a way to compile this under Windows, as named sections are useful in a number of contexts. The solution is simple but it took a while to find, as "ld -r" alone is complaining with gcc for windows. Marco Pizzamiglio documented the procedure (in Italian) and I'm too lazy to include it here. Please ask if interested.
About
an RPL calculator to show ELF sections
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published