Bug 723296 - be64toh usage needs autoconf
Summary: be64toh usage needs autoconf
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: elfutils
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-19 16:25 UTC by Frank Ch. Eigler
Modified: 2011-07-20 17:28 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-20 17:28:35 UTC
Type: ---


Attachments (Terms of Use)

Description Frank Ch. Eigler 2011-07-19 16:25:06 UTC
For the next version of elfutils, commit 725aad5d2f8b7 added a call
to be64toh(3), but neglects to autoconf-detect/assert its presence,
leading to build failures on older libc's.

Comment 1 Mark Wielaard 2011-07-20 12:44:15 UTC
Even very old glibc have bswap_64, so maybe the simplest (untested) fix would be something like:

#ifndef be64toh
#include <byteswap.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define be64toh(x) bswap_64 (x)
#else
#define be64toh(x) (x)
#endif
#endif

Comment 2 Roland McGrath 2011-07-20 16:41:40 UTC
You can do that on the portability branch.
Just observe style with space after # for nested directives.

Comment 3 Mark Wielaard 2011-07-20 17:28:35 UTC
Tested and committed to the portable branch:

commit 878fd6e6184d791ff81cbd6d18fe8d968d3d843e
Author: Mark Wielaard <mjw>
Date:   Wed Jul 20 14:59:02 2011 +0200

    Add fallback for be64toh if not defined.


Note You need to log in before you can comment on or make changes to this bug.