diff mbox series

[1/5] pmdinfogen: fix cross compilation for ARM BE

Message ID 1509617335-6354-1-git-send-email-hemant.agrawal@nxp.com
State New
Headers show
Series [1/5] pmdinfogen: fix cross compilation for ARM BE | expand

Commit Message

Hemant Agrawal Nov. 2, 2017, 10:08 a.m. UTC
cross compiling DPDK for BE mode on ARM results into errors

"PMDINFO portal/dpaa2_hw_dpio.o.pmd.c No drivers registered"

Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: stable@dpdk.org

Signed-off-by: Jun Yang <jun.yang@nxp.com>

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 buildtools/pmdinfogen/pmdinfogen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

Comments

Bruce Richardson Dec. 11, 2017, 12:40 p.m. UTC | #1
On Thu, Nov 02, 2017 at 03:38:51PM +0530, Hemant Agrawal wrote:
> cross compiling DPDK for BE mode on ARM results into errors

> 

> "PMDINFO portal/dpaa2_hw_dpio.o.pmd.c No drivers registered"

> 

> Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

> Cc: Neil Horman <nhorman@tuxdriver.com>

> Cc: stable@dpdk.org

> 

> Signed-off-by: Jun Yang <jun.yang@nxp.com>

> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> ---

>  buildtools/pmdinfogen/pmdinfogen.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 


Comment could be a bit more specific about what the problem is and how
changing the hard-coded "32" fixes it.

Haven't tested the cross compilation part myself, but this causes no
errors for 32-bit or 64-bit builds on my system. So, with some more
detail on the specifics of the fix in the commit message:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>


> diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c

> index e73fc76..9119e52 100644

> --- a/buildtools/pmdinfogen/pmdinfogen.c

> +++ b/buildtools/pmdinfogen/pmdinfogen.c

> @@ -181,7 +181,7 @@ static int parse_elf(struct elf_info *info, const char *filename)

>  		sechdrs[i].sh_offset    =

>  			TO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_offset);

>  		sechdrs[i].sh_size      =

> -			TO_NATIVE(endian, 32, sechdrs[i].sh_size);

> +			TO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_size);

>  		sechdrs[i].sh_link      =

>  			TO_NATIVE(endian, 32, sechdrs[i].sh_link);

>  		sechdrs[i].sh_info      =

> -- 

> 2.7.4

>
Neil Horman Dec. 11, 2017, 6:58 p.m. UTC | #2
On Mon, Dec 11, 2017 at 12:40:32PM +0000, Bruce Richardson wrote:
> On Thu, Nov 02, 2017 at 03:38:51PM +0530, Hemant Agrawal wrote:

> > cross compiling DPDK for BE mode on ARM results into errors

> > 

> > "PMDINFO portal/dpaa2_hw_dpio.o.pmd.c No drivers registered"

> > 

> > Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

> > Cc: Neil Horman <nhorman@tuxdriver.com>

> > Cc: stable@dpdk.org

> > 

> > Signed-off-by: Jun Yang <jun.yang@nxp.com>

> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> > ---

> >  buildtools/pmdinfogen/pmdinfogen.c | 2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> > 

> 

> Comment could be a bit more specific about what the problem is and how

> changing the hard-coded "32" fixes it.

> 

> Haven't tested the cross compilation part myself, but this causes no

> errors for 32-bit or 64-bit builds on my system. So, with some more

> detail on the specifics of the fix in the commit message:

> 

> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> 


I'm with Bruce.  I'd like to know exactly whats going on here.  I dont have an
ARM system handy, so could you please post the errors that you are seeing here?
Is ADDR_SIZE not defined on BE for ARM or some such?  That seems like it should
be fixed, rather than this change.

Neil

> > diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c

> > index e73fc76..9119e52 100644

> > --- a/buildtools/pmdinfogen/pmdinfogen.c

> > +++ b/buildtools/pmdinfogen/pmdinfogen.c

> > @@ -181,7 +181,7 @@ static int parse_elf(struct elf_info *info, const char *filename)

> >  		sechdrs[i].sh_offset    =

> >  			TO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_offset);

> >  		sechdrs[i].sh_size      =

> > -			TO_NATIVE(endian, 32, sechdrs[i].sh_size);

> > +			TO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_size);

> >  		sechdrs[i].sh_link      =

> >  			TO_NATIVE(endian, 32, sechdrs[i].sh_link);

> >  		sechdrs[i].sh_info      =

> > -- 

> > 2.7.4

> > 

>
Hemant Agrawal Dec. 13, 2017, 11:52 a.m. UTC | #3
Hi Neil/Bruce,

On 12/12/2017 12:28 AM, Neil Horman wrote:
> On Mon, Dec 11, 2017 at 12:40:32PM +0000, Bruce Richardson wrote:

>> On Thu, Nov 02, 2017 at 03:38:51PM +0530, Hemant Agrawal wrote:

>>> cross compiling DPDK for BE mode on ARM results into errors

>>>

>>> "PMDINFO portal/dpaa2_hw_dpio.o.pmd.c No drivers registered"

>>>

>>> Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

>>> Cc: Neil Horman <nhorman@tuxdriver.com>

>>> Cc: stable@dpdk.org

>>>

>>> Signed-off-by: Jun Yang <jun.yang@nxp.com>

>>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

>>> ---

>>>  buildtools/pmdinfogen/pmdinfogen.c | 2 +-

>>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>>

>>

>> Comment could be a bit more specific about what the problem is and how

>> changing the hard-coded "32" fixes it.

>>

>> Haven't tested the cross compilation part myself, but this causes no

>> errors for 32-bit or 64-bit builds on my system. So, with some more

>> detail on the specifics of the fix in the commit message:

>>

>> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

>>

>

> I'm with Bruce.  I'd like to know exactly whats going on here.  I dont have an

> ARM system handy, so could you please post the errors that you are seeing here?

> Is ADDR_SIZE not defined on BE for ARM or some such?  That seems like it should

> be fixed, rather than this change.

>

> Neil

>


The original code hard codes the conversion for sh_size to 32, which is 
incorrect.

The sh_size can be "Elf32_Word    sh_size" for 32 bit and "Elf64_Xword 
sh_size" for 64 bit systems.

This causes the symtab_stop to have reduced size and thus find can fail.
	info->symtab_stop  = RTE_PTR_ADD(hdr, sechdrs[i].sh_offset + 
sechdrs[i].sh_size);

we fixed it by replacing the hardcoded 32 with ADDR_SIZE is better.

I don't have access to Intel BE compiler, so could not check behavior 
there. One of difference in my env is that I am doing cross compilation 
on intel-x86-64 machine.
I used the following BE compiler
https://releases.linaro.org/components/toolchain/binaries/6.4-2017.11/aarch64_be-linux-gnu/gcc-linaro-6.4.1-2017.11-x86_64_aarch64_be-linux-gnu.tar.xz


>>> diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c

>>> index e73fc76..9119e52 100644

>>> --- a/buildtools/pmdinfogen/pmdinfogen.c

>>> +++ b/buildtools/pmdinfogen/pmdinfogen.c

>>> @@ -181,7 +181,7 @@ static int parse_elf(struct elf_info *info, const char *filename)

>>>  		sechdrs[i].sh_offset    =

>>>  			TO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_offset);

>>>  		sechdrs[i].sh_size      =

>>> -			TO_NATIVE(endian, 32, sechdrs[i].sh_size);

>>> +			TO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_size);

>>>  		sechdrs[i].sh_link      =

>>>  			TO_NATIVE(endian, 32, sechdrs[i].sh_link);

>>>  		sechdrs[i].sh_info      =

>>> --

>>> 2.7.4

>>>

>>

>
Neil Horman Dec. 13, 2017, 12:19 p.m. UTC | #4
On Wed, Dec 13, 2017 at 05:22:57PM +0530, Hemant Agrawal wrote:
> Hi Neil/Bruce,

> 

> On 12/12/2017 12:28 AM, Neil Horman wrote:

> > On Mon, Dec 11, 2017 at 12:40:32PM +0000, Bruce Richardson wrote:

> > > On Thu, Nov 02, 2017 at 03:38:51PM +0530, Hemant Agrawal wrote:

> > > > cross compiling DPDK for BE mode on ARM results into errors

> > > > 

> > > > "PMDINFO portal/dpaa2_hw_dpio.o.pmd.c No drivers registered"

> > > > 

> > > > Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

> > > > Cc: Neil Horman <nhorman@tuxdriver.com>

> > > > Cc: stable@dpdk.org

> > > > 

> > > > Signed-off-by: Jun Yang <jun.yang@nxp.com>

> > > > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> > > > ---

> > > >  buildtools/pmdinfogen/pmdinfogen.c | 2 +-

> > > >  1 file changed, 1 insertion(+), 1 deletion(-)

> > > > 

> > > 

> > > Comment could be a bit more specific about what the problem is and how

> > > changing the hard-coded "32" fixes it.

> > > 

> > > Haven't tested the cross compilation part myself, but this causes no

> > > errors for 32-bit or 64-bit builds on my system. So, with some more

> > > detail on the specifics of the fix in the commit message:

> > > 

> > > Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> > > 

> > 

> > I'm with Bruce.  I'd like to know exactly whats going on here.  I dont have an

> > ARM system handy, so could you please post the errors that you are seeing here?

> > Is ADDR_SIZE not defined on BE for ARM or some such?  That seems like it should

> > be fixed, rather than this change.

> > 

> > Neil

> > 

> 

> The original code hard codes the conversion for sh_size to 32, which is

> incorrect.

> 

> The sh_size can be "Elf32_Word    sh_size" for 32 bit and "Elf64_Xword

> sh_size" for 64 bit systems.

> 

> This causes the symtab_stop to have reduced size and thus find can fail.

> 	info->symtab_stop  = RTE_PTR_ADD(hdr, sechdrs[i].sh_offset +

> sechdrs[i].sh_size);

> 

> we fixed it by replacing the hardcoded 32 with ADDR_SIZE is better.

> 

Oh, my bad, you're correct, I thought it was 32 bits for both ABI's

Acked-by: Neil Horman <nhorman@tuxdriver.com>
diff mbox series

Patch

diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c
index e73fc76..9119e52 100644
--- a/buildtools/pmdinfogen/pmdinfogen.c
+++ b/buildtools/pmdinfogen/pmdinfogen.c
@@ -181,7 +181,7 @@  static int parse_elf(struct elf_info *info, const char *filename)
 		sechdrs[i].sh_offset    =
 			TO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_offset);
 		sechdrs[i].sh_size      =
-			TO_NATIVE(endian, 32, sechdrs[i].sh_size);
+			TO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_size);
 		sechdrs[i].sh_link      =
 			TO_NATIVE(endian, 32, sechdrs[i].sh_link);
 		sechdrs[i].sh_info      =