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

Tests fail when ntohl contains inline assembly #29

Closed
wuruoyu opened this issue Oct 12, 2020 · 2 comments
Closed

Tests fail when ntohl contains inline assembly #29

wuruoyu opened this issue Oct 12, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@wuruoyu
Copy link

wuruoyu commented Oct 12, 2020

Hi,

When building and checking with ninja check, it shows that 8 cases fail. It is weird since it works perfectly months ago and I follow the exact same building script. Could you help me check the possible issue?

I build the symcc with these commands and outputs:

CC=clang-10 CXX=clang++-10 cmake -G Ninja -DQSYM_BACKEND=OFF . 

-- The C compiler identification is Clang 10.0.0
-- The CXX compiler identification is Clang 10.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-10 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++-10 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LLVM 10.0.0
-- Using LLVMConfig.cmake from /usr/lib/llvm-10/cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ruoyu/third_lib/symcc

And then ninja check:
ninja check output.txt

Thank you in advance!

@sebastianpoeplau
Copy link
Collaborator

Hi @wuruoyu,

I think this is the same issue as the one we had with the Dockerfile (#22). The tl;dr is that the tests have been adjusted to work on big-endian systems, which unfortunately makes them fail on some little-endian ones. But it's only the tests - most normal code shouldn't be affected. (Your system's version of the ntohl function, which is used in the tests, likely translates to inline assembly, which SymCC doesn't understand. We should really find a better way to make the tests work independently of endianness...)

Hope this helps :)

@sebastianpoeplau sebastianpoeplau added the bug Something isn't working label Oct 13, 2020
@sebastianpoeplau sebastianpoeplau changed the title Error on ninja check Tests fail when ntohl contains inline assembly Oct 13, 2020
@wuruoyu
Copy link
Author

wuruoyu commented Oct 14, 2020

I notice that ntohl function in the test case.
Thank you!

@wuruoyu wuruoyu closed this as completed Oct 14, 2020
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Sep 10, 2021
This fixes issue eurecom-s3#29 and ensures that tests pass.

The issue was that the GNU netinet/in.h header files replaces ntohl with
a byteswap macro when optimizations are enabled. Thus, we check if ntohl
is defined as a macro, and if it is, undefine the macro to ensure that
the function is used (and hence symbolized).
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Sep 10, 2021
This pass exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Sep 12, 2021
This pass exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Sep 12, 2021
This pass exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Sep 12, 2021
This pass exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Sep 12, 2021
This pass exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Sep 12, 2021
This pass exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Mar 5, 2022
This pass exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
adrianherrera added a commit to adrianherrera/symcc that referenced this issue Mar 5, 2022
This pass exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
sebastianpoeplau pushed a commit to adrianherrera/symcc that referenced this issue Feb 16, 2023
This change exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
sebastianpoeplau pushed a commit to adrianherrera/symcc that referenced this issue Feb 16, 2023
This change exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue eurecom-s3#29
and does away with the hacks made in PR eurecom-s3#75
sebastianpoeplau pushed a commit that referenced this issue Feb 16, 2023
This change exploits LLVM's target lowering and its ability to expand
inline assembly into explicit LLVM code.

Importantly, this expansion includes lifting `bswap` instructions to the
`bswap` intrinsic, which can be symbolized with symcc. This fixes issue #29
and does away with the hacks made in PR #75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants