This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Compiler/TMS570LC4357: reproducible build
Tool/software: TI C/C++ Compiler
I need cl6x compiler to provide bitwise reproducible output (see also https://reproducible-builds.org.e. multiple compilations of the same source base (done by different users, in their directories) should give exactly the same binary. I am using CGT 7.3.23.
Two issues found:
I've found random bytes changed in a binary. I've found that compiler is creating temporary file, which then compiles, and that temporary file name is included into binary' .symtab section :
$ readelf -s .symtab myobject.obj
Symbol table '.symtab' contains 999 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND1: 00000000 0 FILE LOCAL HIDDEN ABS 07894VfUHkc[...]
How to get rid of this? This entry here is meaningless, as mentioned temporary file is anyway removed after compilation.I did some reverse-engineering, and it seems that compiler is using some sort of gen_tempname function (https://github.molgen.mpg.de/git-mirror/glibc/blob/master/sysdeps/posix/tempname.c)., as I can see getpid and getimeofday syscalls when I execute the compiler (using strace tool). But I am unable to use LD_PRELOAD, as compiler is statically linked...
Build path is included into the binary's debugging symbols. I would like to be able to map vairable string into some arbitrary one. Similarly, GCC provides the following option: -ffile-prefix-map (see description here: https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html
In reply to Bartlomiej Kucharczyk:
Bartlomiej KucharczykI've made a tool which is erasing some of the useless data from the binary
Thank you for the contribution. But I don't see the advantage of this approach over the one used by objdiff. objdiff doesn't erase anything, it just skips over the "useless data".
Thanks and regards,
TI C/C++ Compiler Forum ModeratorPlease click This Resolved My Issue on the best reply to your questionThe CCS Youtube Channel has short how-to videosThe Compiler Wiki answers most common questionsTrack an issue with SDOWP. Enter your bug id in the Search box.
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to George Mock:
In reply to Keith Barkley:
You are right, thanks for pointing that out.
However I do not understand how it is in contradiction with C standard. I haven't said anywhere that "all C source code will be 100% bitwise reproducible".:-)
We simply try to avoid those macros in source code (and other pitfalls that are causing builds to be irreproducible). In case someone is using it, we'll catch that immediately (md5sum will differ even no change in source code/build environment).
But let's go one step back, and ask: do you have any reasons for using variable __DATE__ and __TIME__? Because personally, I cannot see any, so that could be good education for me. ;-)
Maybe that was useful when programming was done by carving rocks, and there was no git. ;-) I don't know... If you use any version control system, revision string can be generated from version control, deterministically. Topic is also discussed here: reproducible-builds.org/.../ reproducible-builds.org/.../
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.