Skip to content
  • Michal Privoznik's avatar
    33ab5f24
    configure: Avoid using strings binary · 33ab5f24
    Michal Privoznik authored
    When determining the endiandness of the target architecture we're
    building for a small program is compiled, which in an obfuscated
    way declares two strings. Then, we look which string is in
    correct order (using strings binary) and deduct the endiandness.
    But using the strings binary is problematic, because it's part of
    toolchain (strings is just a symlink to
    x86_64-pc-linux-gnu-strings or llvm-strings). And when
    (cross-)compiling, it requires users to set the symlink to the
    correct toolchain.
    
    Fortunately, we have a better alternative anyways. We can mimic
    what compiler.h is already doing: comparing __BYTE_ORDER__
    against values for little/big endiandness.
    
    Bug: https://bugs.gentoo.org/876933
    
    
    Signed-off-by: default avatarMichal Privoznik <mprivozn@redhat.com>
    Message-Id: <d6d9c7043cfe6d976d96694f2b4ecf85cf3206f1.1665732504.git.mprivozn@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    33ab5f24
    configure: Avoid using strings binary
    Michal Privoznik authored
    When determining the endiandness of the target architecture we're
    building for a small program is compiled, which in an obfuscated
    way declares two strings. Then, we look which string is in
    correct order (using strings binary) and deduct the endiandness.
    But using the strings binary is problematic, because it's part of
    toolchain (strings is just a symlink to
    x86_64-pc-linux-gnu-strings or llvm-strings). And when
    (cross-)compiling, it requires users to set the symlink to the
    correct toolchain.
    
    Fortunately, we have a better alternative anyways. We can mimic
    what compiler.h is already doing: comparing __BYTE_ORDER__
    against values for little/big endiandness.
    
    Bug: https://bugs.gentoo.org/876933
    
    
    Signed-off-by: default avatarMichal Privoznik <mprivozn@redhat.com>
    Message-Id: <d6d9c7043cfe6d976d96694f2b4ecf85cf3206f1.1665732504.git.mprivozn@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Loading