From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: pmdinfogen issues: cross compilation for ARM fails with older host compiler Date: Mon, 14 Nov 2016 02:29:24 +0530 Message-ID: <20161113205924.GA11392@localhost.localdomain> References: Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Cc: Neil Horman , "dev@dpdk.org" , "users@dpdk.org" , "Jacob, Jerin" , Jan Viktorin To: Hemant Agrawal Return-path: Content-Disposition: inline In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Nov 11, 2016 at 10:34:39AM +0000, Hemant Agrawal wrote: > Hi Neil, > Pmdinfogen compiles with host compiler. It usages rte_byteorder.h of the target platform. > However, if the host compiler is older than 4.8, it will be an issue during cross compilation for some platforms. > e.g. if we are compiling on x86 host for ARM, x86 host compiler will not understand the arm asm instructions. > > /* fix missing __builtin_bswap16 for gcc older then 4.8 */ > #if !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) > static inline uint16_t rte_arch_bswap16(uint16_t _x) > { > register uint16_t x = _x; > asm volatile ("rev16 %0,%1" > : "=r" (x) > : "r" (x) > ); > return x; > } > #endif > > One easy solution is that we add compiler platform check in this code section of rte_byteorder.h > e.g > #if !(defined __arm__ || defined __aarch64__) > static inline uint16_t rte_arch_bswap16(uint16_t _x) > { > return (_x >> 8) | ((_x << 8) & 0xff00); > } > #else …. > > Is there a better way to fix it? IMO, It is a HOST build infrastructure issue. If a host app is using the dpdk service then it should compile and link against HOST target(in this specific case, build/x86_64-native-linuxapp-gcc). I think, introducing the HOSTTARGET kind of scheme is a clean solution. /Jerin