[PATCH 1/1] usb: avoid -Werror=address-of-packed-member

Marek Vasut marex at denx.de
Tue Dec 17 12:19:37 CET 2019


On 12/17/19 12:14 PM, Heinrich Schuchardt wrote:
> On 12/17/19 11:00 AM, Marek Vasut wrote:
>> On 12/17/19 10:27 AM, Heinrich Schuchardt wrote:
>>> With GCC 9.2.1 errors of type -Werror=address-of-packed-member occur
>>> when
>>> passing a member of a packed structure to le16_to_cpus() on a big endian
>>> system (e.g. P2041RDB_defconfig).
>>>
>>> Replace le16_to_cpus() by get_unaligned_le16(). Check
>>> defined(__BIG_ENDIAN)
>>> to avoid the introduction of unnecessary instructions on little endian
>>> systems as seen on aarch64.
>>
>> I would expect the compiler would optimize such stuff out ?
>> Can we do without the ifdef ?
> 
> When compiling qemu_arm64_defconfig without the #ifdef the GCC 9.2.1
> adds assembler instructions:

Why ?


More information about the U-Boot mailing list