PropGCC static library pulls in unused COGC module
DavidZemon
Posts: 2,973
When I compile a certain executable and the related static library does not contain the cogc module, I get a code size of 22,612. If the static library has the cogc module it is 23,064. Looks to me like the cogc module is being included, but I don't know why.
I've looked through CMake's verbose output and condensed it some for easier reading. The include lines were all stripped out, I removed directories in front of file names, and I removed all of CMake's status lines so it's just important business. Here's what it looks like:
This has probably always been going on since I started including adcACpropab.cogc in PropWare's version of Simple, but I don't know for sure. It was brought to my attention a couple days ago because, intermittently, it will throw a "relocation truncated to fit" error.
Why? Is there a fix? Is it simply not possible to include cogc files in libraries?
I've looked through CMake's verbose output and condensed it some for easier reading. The include lines were all stripped out, I removed directories in front of file names, and I removed all of CMake's status lines so it's just important business. Here's what it looks like:
/opt/parallax/bin/propeller-elf-gcc -mcog -xc -r -save-temps -Os -m32bit-doubles -Wall -ffunction-sections -fdata-sections -std=c99 -I"A whole ton of include lines here" -o adcACpropab.cogc.cog adcACpropab.cogc /opt/parallax/bin/propeller-elf-objcopy --localize-text --rename-section .text=adcACpropab.cogc.cog adcACpropab.cogc.cog /opt/parallax/bin/propeller-elf-ar cr libSimple.a tons_of_files.c.obj adcACpropab.cogc.cog tons_more_files.c.obj /opt/parallax/bin/propeller-elf-ar r libSimple.a some_more_files_because_there_are_too_many_for_one_line.c.obj /opt/parallax/bin/propeller-elf-ranlib libSimple.a /opt/parallax/bin/propeller-elf-gcc -save-temps -Os -m32bit-doubles -Wall -ffunction-sections -fdata-sections -std=c99 -mlmm -Wl,--gc-sections -oFileReader_Demo.elf FileReader_Demo.cpp.obj libPropWare.a libLibpropeller.a libSimple.a
This has probably always been going on since I started including adcACpropab.cogc in PropWare's version of Simple, but I don't know for sure. It was brought to my attention a couple days ago because, intermittently, it will throw a "relocation truncated to fit" error.
Why? Is there a fix? Is it simply not possible to include cogc files in libraries?
Comments
I'll take another look at the feature available in 3.3 and see if I really need it. Maybe I'll back it down to 3.0.
That sounds like a very reasonable guess, I'll try it out tonight. Thanks
Perfect! I can make that happen
Are you referring to the binary blob that spin2cpp produces from the DAT section of a Spin file or something else?
Oh ok - that makes sense. They're certainly easier to deal with from a build-system perspective, but not so much from a "i need to make a small change" perspective
Oh, I was under the assumption the original source code wouldn't be distributed. I'm not sure why I assumed that... seems silly now.
Anyway, I think it's really cool that the cogc/cogcpp option exists. Being able to write beautiful, high-level, object-oriented code that still executes with native speed via cogcpp is fantastic. Combining that with a few (~60) lines of inline assembly and I was able to create a really cool stepper motor driver used in a Pick-n-Place machine for a client half a year ago. I would have liked (and originally tried) to use fcache for that drivers, but broke the 64-instruction limit in fcache and had to switch to either cogcpp or full assembly... and full assembly was not appealing!
Time to see how many more I can add.