Linux and mac compatibility#1029
Conversation
…one is not enough to make sure symbols are actually exported on mac
…either avoid it by prefixing with or strip this prefix explicitly
… on linux and mac, to offset addresses accordingly, since the linker script won't work on them (there's probably a more normal way to do this only once)
…s-calculations Return to no-std, use linker symbols to calculate the base address
remove two deps from defmt/Cargo.toml
On macOS, each defmt log statement created a unique section in the .defmt segment. With 200+ logs, this exceeded Mach-O's 255 section limit. Fix: Group logs by severity level instead of unique hash per log.
fix(macos): avoid 255 section-per-segment limit
…y type, instead of the decoding os
Linux and mac compatibility issue fixes
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…ather than the decoding host
Linux and mac compatibility fixes, part 2
… LLVM behavior so I would prefer it for now
This reverts commit 57acf1b.
This reverts commit ba1f9ae.
Linux and mac compatibility fixes3
|
Nice - I'm excited to look through this in detail soon. |
84a3cea to
6b12bee
Compare
…bol by its export name, make it macos-only
|
|
||
| if for_macos { | ||
| sub_section = format!(",{:x}", hash(&sub_section)); | ||
| // Use a single section per severity level instead of unique section per log. |
There was a problem hiding this comment.
I wonder if this has an effect on the linker's ability to garbage collect defmt strings in functions that are not called?
There was a problem hiding this comment.
Would it do much harm if it didn't?
There are some very flash-constrained devices running Linux, but I'm not aware of tiny embedded Mac systems and non-mac targets should be unaffected.
|
I had a trial run with this, but How have you been testing it? |
|
I tested this on Linux and it works well 🥳 Although I still needed to have a custom linker file that collects all interned strings into a single section: Ideally the elf parser could deal with it without the linker file, because the symbols are in the elf file when I print them out. Alternatively modify the provided |
|
I think the best solution is to only put items into the |
I just used the decoder directly, but let me go ahead and change this - added a commit to support Mach-O files in |
|
@knoellle is going to take a look at this one, right after his Robocup competition. |
|
Thank you for your work so far. What is your plan with the linker scripts? As @tomasbarton-stemcell mentioned already, I think we should either include linker scripts for Linux/Mac or adjust the elf parser to work without linker scripts. |
|
Thanks for the PR! As mentioned in the PR description, the location information currently does not work for macOS. |
Mac doesn't have linker scripts, and like @mhatzl said it should work without the need for one. It does mean that things like the default panic handler that's auto-configured by |
The issue is that by default mac location information is scattered across files, and the table parsing doesn't handle this well. Running without split debug info ( |
|
Hi @aimir, looking at the docs for split-debuginfo and the cargo profile docs, the default for macOS is Since the |
I spent some time attempted making the default panic stuff work without linker scripts but didn't find a way without breaking user code. See #1050. Again, I don't have a mac to test with, but if I understand correctly then attempting to use What are your thoughts on requiring a custom panic handler for building for macOS specifically? |
|
I'm curious how you tested the linux compatibility. For embedded platforms, we use flip-link which does a bunch of magic to find linker scripts inside library search paths which other linkers don't do.
How do you build your linux binaries? |
Currently without correct locations in symbol tables on mac, but everything else should work as expected, with no impact on embedded systems