Skip to content
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

Fix big endian compatibility #7811

Merged
merged 5 commits into from
Jul 24, 2023

Conversation

tautschnig
Copy link
Collaborator

  1. Our simplifications were not as capable for big endian configurations as for little endian ones.
  2. Fix various tests that silently assumed little endian platforms.

Please review commit-by-commit.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@@ -14,6 +14,39 @@ Module: Read ELF

#include <istream>

static void u16_to_native_endian_inplace(bool le_input, uint16_t &input)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no variant of these in the standard library?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is htons, but it's not in the standard library and it doesn't fully cover what is needed here!

We need to start searching from the least or most significant bit, the
position of which depends on endianness.
Values checked for in some tests depend on endianness. Also, don't
hard-code "byte_(extract|update)_little_endian and instead also accept
the big-endian variant thereof.
This is pre-defined by GCC on _some_ platforms. Here, we don't want GCC
pre-defined setting but instead want our own setting to test both little
and big-endian settings.
We previously only supported little-endian architectures for some of the
simplify_byte_update simplification rules.
Converting from integers to char arrays reveals endianness.
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Patch coverage: 71.05% and project coverage change: +0.61 🎉

Comparison is base (63b8b71) 78.13% compared to head (bdd42d3) 78.74%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7811      +/-   ##
===========================================
+ Coverage    78.13%   78.74%   +0.61%     
===========================================
  Files         1698     1698              
  Lines       194027   194123      +96     
===========================================
+ Hits        151600   152861    +1261     
+ Misses       42427    41262    -1165     
Impacted Files Coverage Δ
src/goto-programs/elf_reader.cpp 61.25% <62.92%> (+2.34%) ⬆️
src/util/simplify_expr.cpp 85.60% <100.00%> (+7.77%) ⬆️

... and 50 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tautschnig tautschnig merged commit cdea666 into diffblue:develop Jul 24, 2023
34 of 35 checks passed
@tautschnig tautschnig deleted the bugfixes/big-endian branch July 24, 2023 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants