-
Notifications
You must be signed in to change notification settings - Fork 13.3k
different sketch MD5 if built from different locations #4520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
using the strings command on a compiled binary shows some occurrence of the source path of the core, it would be nice if this could be avoided. |
If it's about |
There's a GCC patch from Debian which can be used for this purpose:
https://lists.alioth.debian.org/pipermail/reproducible-builds/Week-of-Mon-20170814/009124.html
…On Thu, Mar 15, 2018, 20:03 david gauchard ***@***.***> wrote:
If it's about __FILE__ gcc macro related, then I'd like to have to
solution too.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4520 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEJcei-jH7x29EYYgMGHi63B5UGJ0Ol2ks5telilgaJpZM4Sr5bq>
.
|
The use of ESP.getSketchMD5() is interesting to me as well, so after running strings on my binaries I saw the long absolute paths being stored. Since I compile my projects on Linux using makeEspArduino.mk makefile instead of the Arduino IDE, it was trivial to edit my config.mk from:
to be:
Then, I compiled my current project on two different machines where the working directory is different, and the resulting md5sums matched. That's cool! However, the more interesting result for me was that my binary size was now smaller: I'm always working to save a byte here and there, so this was a nice gift for very little effort. Edit: And yes, running strings now shows all the paths stored are relative. |
Not to threadjack, but if we do rebuild gcc please add in the "#define JUMP_TABLES_IN_TEXT 1" change, too, to save extra heap at the same time. Where is the actual patch referenced in the email thread? I can't seem to find the changes themselves. |
In my comment just above yours I put a link to the changes
|
@d-a-v The links themselves go to the mailing list archive, which talks about the patch. But where are the actual patch files they proposed? I'm not seeing any link to it. |
@earlephilhower in the bottom of the link in my comment, reproduced here: |
Thanks, @d-a-v . I saw the links but for some reason didn't see the actual changes. I'll see if they can apply to the GCC toolchain I think we're using now: https://github.com/jcmvbkbc/gcc-xtensa . |
There are several branches on this repo. |
@d-a-v -flto, unfortunately, is not only a matter of rebuilding the toolchain. For simple programs it works pretty well, but for larger programs where you assign certain function to specific sections (like, put some stuff into IRAM and some into flash), LTO has problems tracking the correct sections to use. |
I can't quantify flto benefit. I guess it could be huge especially for us. |
FWIW when testing the JUMP_TABLES_IN_ROM setting I was able to build and replace all the gcc executables dir using branch call0-4.8.2. Everything "just worked." Whether that is, or is not, the branch being distributed I can't really say. However, if you wanted to do FLTO tests, @d-a-v , it seems like it would be a safe starting point. |
@d-a-v It looks like the GCC patch could be applied by hand, with probably only minor mods, to the GCC-4.x in the repo. The meat of the change is in libcpp/macro.c which seems to not have undergone much editing from gcc4 to gcc7 (case BT_FILE:). Edit the local Whether this is worth the grief, considering you'd need to rebuild the toolchain(this is a libcpp.so file) and use it on all supported platforms, is a question above my pay grade. --edit--
|
I will apply the patch when building the new GCC version. CI builds for all platforms are set up (including ARM), just need to prepare the patch set. |
Hi |
Now that we have GDB support (or will once the pull is merged), I don't think the GCC patch listed above is a good idea as it replaces the file path everywhere (including debug info). I don't think you'd be able to run GDB with symbols w/o serious manual effort remapping the files back to proper paths. Remapping In GCC/gcc/final.c there's a BUILT_IN_FILE accessor we can patch using the same ideas as the above. |
This patch actually works, unlike the prior one, to strip paths from
|
Latest git head has this patch in it (2.5.0-4 toolchain). Built same sources, one in ~/sketch_jul21b, one in ~/Arduino/sketch_jul21b. Same bins
|
I am using ESP.getSketchMD5() to manage software releases.
I have noticed that if I use the same Arduino IDE, but in a different place in the filesystem the sketch MD5 is different.
I have used a portable version of the IDE to be sure that the same files are used.
For example loading a sketch that prints MD5 shows this behaviour.
Is this a known thing?
The text was updated successfully, but these errors were encountered: