[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 03/22] plat/kvm: Use the same declaration for _text and _end for Arm64
On 09/11/2018 06:52, Wei Chen (Arm Technology China) wrote: Hi Julien, Hi, Whether the pointers are treated as char * or anything else does not matter here. The problem is the C spec states that comparing 2 pointers belonging to distinct object is undefined (see [1] and [2]).-----Original Message----- From: Julien Grall <julien.grall@xxxxxxx> Sent: 2018年11月8日 20:02 To: Wei Chen (Arm Technology China) <Wei.Chen@xxxxxxx>; minios- devel@xxxxxxxxxxxxxxxxxxxx; simon.kuenzer@xxxxxxxxx Cc: Kaly Xin (Arm Technology China) <Kaly.Xin@xxxxxxx>; nd <nd@xxxxxxx> Subject: Re: [Minios-devel] [UNIKRAFT PATCH 03/22] plat/kvm: Use the same declaration for _text and _end for Arm64 Hi, On 11/8/18 9:51 AM, Wei Chen wrote:We get a warning that _end and _text are differently defined within setup.c and memory.c: warning: type of ‘_end’ does not match original declaration extern char _end[]; ^ note: previously declared here _ctors, _ectors, __bss_start, _end; We should use the same definition in both files and then this warning goes away.That's a call to have the _end and _text defined in an header.Yes, it would be better to have a clean-up patch to do this.Also, keep in mind that you can't compare two pointers that points to aI don't quite understand this comment. We treat all these pointers as char pointers. Why did you think they are different? So check such as "mem_base > (uint64_t)&_text" is undefined because the compiler could see-through the cast. So you have to hide it from the compiler (see __pa_symbol in Linux). different object. So you may want to find a different way to access _end & co.Sorry, what's "co" here? "and company" by that I meant all the other cases similar to _end. Cheers,[1] https://wiki.sei.cmu.edu/confluence/display/c/ARR36-C.+Do+not+subtract+or+compare+two+pointers+that+do+not+refer+to+the+same+array [2] 6.5.8 http://www.dii.uchile.cl/~daespino/files/Iso_C_1999_definition.pdf -- Julien Grall _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |