DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Hemant Agrawal <hemant.agrawal@nxp.com>
Cc: Neil Horman <nhorman@tuxdriver.com>,
	"dev@dpdk.org" <dev@dpdk.org>, "users@dpdk.org" <users@dpdk.org>,
	"Jacob, Jerin" <Jerin.Jacob@cavium.com>,
	Jan Viktorin <viktorin@rehivetech.com>
Subject: Re: [dpdk-dev] pmdinfogen issues: cross compilation for ARM fails with older host compiler
Date: Mon, 14 Nov 2016 02:29:24 +0530	[thread overview]
Message-ID: <20161113205924.GA11392@localhost.localdomain> (raw)
In-Reply-To: <DB5PR04MB1605F64CF0D986E0B2B26AF089BB0@DB5PR04MB1605.eurprd04.prod.outlook.com>

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

  parent reply	other threads:[~2016-11-13 20:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11 10:34 Hemant Agrawal
2016-11-11 13:48 ` Jan Viktorin
2016-11-11 19:25   ` Neil Horman
2016-11-13 20:59 ` Jerin Jacob [this message]
2016-11-14 14:48   ` Neil Horman
2016-11-15  9:34     ` Hemant Agrawal
2016-11-15 14:27       ` Neil Horman
2016-11-15 16:33         ` Thomas Monjalon
2016-11-15 15:08       ` Neil Horman
2016-11-18 12:03         ` Hemant Agrawal
2016-11-18 13:50           ` Neil Horman
2016-11-18 16:37             ` Bruce Richardson
2016-11-18 18:39               ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161113205924.GA11392@localhost.localdomain \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=Jerin.Jacob@cavium.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=nhorman@tuxdriver.com \
    --cc=users@dpdk.org \
    --cc=viktorin@rehivetech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).