Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 22 Jun 2015 08:57:01 +0200
From: Rafał Miłecki <>
Subject: Using __BYTE_ORDER without endian.h


So far we were using uClibc in OpenWrt and my following code was working fine:

#include <byteswap.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define cpu_to_le32(x) bswap_32(x)
#define le32_to_cpu(x) bswap_32(x)
#define cpu_to_le32(x) (x)
#define le32_to_cpu(x) (x)
#error "Unsupported endianness"

Unfortunately is is *silently* broken with musl. When using musl and
not including endian.h directly the condition:
is always true.

Could you fix this?

I expect either:
1) __BYTE_ORDER to be always available & set correctly
2) Compile error because of __BYTE_ORDER being undefined

I think such silent miscompilation is sth that has to be avoided.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.