lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] error introduced by commit acb4b60517572094bcd633c7df6f


From: Joel Cunningham
Subject: Re: [lwip-devel] error introduced by commit acb4b60517572094bcd633c7df6fbd90836c4e2d icmp6_param_problem
Date: Tue, 31 Oct 2017 14:40:32 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Stian,

Thanks for posting this, I have also ran into this issue when turning on IPv6 with ARMCC 5, but it's causing me significantly more headache due to some more gotchas about using #pragma pack over __packed structures (which my port was using via PACK_STRUCT_STRUCT)

This page has good details on the different ways to do packing with ARMCC: https://developer.arm.com/products/software-development-tools/compilers/arm-compiler-5/docs/dui0472/latest/compiler-coding-practices/comparisons-of-an-unpacked-struct-a-__packed-struct-and-a-struct-with-individually-__packed-fields-and-of-a-__packed-struct-and-a-pragma-packed-struct

Headaches/notes:

1) ARMCC is only refusing to implicitly cast when it's a pointer to a member of the packed struct.  Passing the entire packed structure to icmp6_param_problem() doesn't produce an error

2) #pragma packed structures can't be mixed with __packed structures because the #pramga version doesn't have the __packed qualifier - ran into this because I have external code using ip4_addr_p_t but was manually using __packed rather than LwIP macros

3) ARMCC GNU extensions need to be enabled for to use #pragma pack.  Now building all LwIP sources and ANY APPLICATIONS that include LwIP headers using a packed structure must have GNU extensions enabled.  Sounds like a small thing, but means I'm going to have to update numerous application Makefiles

Simon/Dirk,

Would you guys be open to explicitly casting to (const void *) in the TWO cases where a member of a packed structure is being passed to icmp6_param_problem?  ARMCC is used often in the embedded environments where LwIP is used and it would be nice to continue using the normal __packed method rather than switching to #pragma pack().

I've attached a patch that introduces an LWIP_PACKED_CAST along side our other special case casts and uses it in two places where pointers to members of packed structures are passed to icmp6_param_problem.

Joel

On 10/12/2017 02:04 PM, Stian Skjelstad wrote:
On Thu, Oct 12, 2017 at 8:51 PM, goldsimon <address@hidden> wrote:


Stian Skjelstad wrote:
>If using  #pragma pack  this error-checking is not performed, but you
>can
>not define a macro to performs #pragma

You can still use the pragma: have a look at the win32 port to see how to use include files to start & end packing.

I totally overlooked PACK_STRUCT_USE_INCLUDES when looking at struct definition, thank you. Posting what seems to be a working setup here, so people can find it when searching the archive.

cc.h:
<snip>
#define PACK_STRUCT_USE_INCLUDES
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_STRUCT 
#define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(x) x
</snip>

bpstruct.h:
#pragma push
#pragma pack(1)

epstruct.h:
#pragma pop

 

--
Stian Skjelstad


_______________________________________________
lwip-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-devel

Attachment: 0001-Introduce-LWIP_PACKED_CAST-to-fix-errors-issues-with.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]