Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/1] openpgm: disable on AVR32
Date: Sat, 2 Nov 2013 12:26:18 +0100	[thread overview]
Message-ID: <20131102122618.18eb2f00@skate> (raw)
In-Reply-To: <CAHt8ZCO2OEtWe8NrDYSTkmu7uqQGpQbWjAEJg+jHVGzsWsF9Mg@mail.gmail.com>

Dear Simon Dawson,

On Sat, 2 Nov 2013 08:03:51 +0000, Simon Dawson wrote:
> Hi Alexander.
> 
> On 1 November 2013 20:21, Alexander Lukichev
> <alexander.lukichev@gmail.com> wrote:
> > The compiler (that particular toolchain) has those intrinsic functions but
> > is able to generate them only if the exact CPU sub architecture is
> > specified, not just AVR32 (their implementations differ for each of the two
> > sub architectures). This is impossible to specify unless we introduce it in
> > the buildroot configuration system (like several flavors of ARM). And this,
> > in turn, seems too much to make just one package happy.
> 
> I might be wrong, but is it not the case that only one of the two
> micro-architectures --- specifically, avr32b as used by the ap7 core
> --- is relevant for Buildroot? (I'm not aware of a Linux port for the
> avr32a architecture, as used by the uc3 core.)
> 
> If so, then it seems to me that it would be well worth calling the
> compiler with the precise micro-architecture specified. This might be
> expected to have a positive impact beyond just the openpgm package.

I did a minimal test case, and even by specifying -march and -mpart,
sync_add_and_fetch_2 remains an undefined symbol. Interestingly, if you
use sync_add_and_fetch() on a pointer to a 4 bytes value, there's no
problem, but if it's a pointer to a 2 bytes value, then the intrinsics
uses sync_add_and_fetch_2, which doesn't work.

Test case with a pointer to a 4 bytes value
===========================================

$ cat toto.c 
int foo(void) {
	unsigned int *ptr;
	return __sync_add_and_fetch(ptr, 2);
}
$ avr32-linux-gcc -march=ap -mpart=ap7200 -fPIC -c toto.c 
$ avr32-linux-gcc -march=ap -mpart=ap7200 -fPIC -shared -Wl,-soname,libtoto.so.1 -o libtoto.so.1 toto.o 
$ avr32-linux-readelf -a libtoto.so.1 | grep sync_add
$

 => no problem

Test case with a pointer to a 2 bytes value
===========================================

$ cat toto.c 
int foo(void) {
	unsigned short *ptr;
	return __sync_add_and_fetch(ptr, 2);
}
$ avr32-linux-gcc -march=ap -mpart=ap7200 -fPIC -c toto.c 
$ avr32-linux-gcc -march=ap -mpart=ap7200 -fPIC -shared -Wl,-soname,libtoto.so.1 -o libtoto.so.1 toto.o 
$ avr32-linux-readelf -a libtoto.so.1 | grep sync_add
0000149c  00000b29 R_AVR32_GLOB_DAT  00000000   __sync_add_and_fetch_2 + 0
    11: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __sync_add_and_fetch_2
    43: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __sync_add_and_fetch_2
$

 => unresolved symbol

Any idea?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2013-11-02 11:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 18:12 [Buildroot] [PATCH v2 1/1] openpgm: disable on AVR32 Alexander Lukichev
2013-11-01 18:20 ` Thomas Petazzoni
2013-11-01 20:21   ` Alexander Lukichev
2013-11-02  7:16     ` Alexander Lukichev
2013-11-02  8:03     ` Simon Dawson
2013-11-02 11:26       ` Thomas Petazzoni [this message]
2013-11-02 16:51         ` Simon Dawson
2013-11-03 11:24           ` Alexander Lukichev
2013-11-06 17:27           ` Alexander Lukichev
2013-11-06 17:39             ` Thomas Petazzoni
2013-11-06 18:21               ` Alexander Lukichev
2013-11-06 18:29                 ` Thomas Petazzoni
2013-11-06 19:18               ` Simon Dawson

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=20131102122618.18eb2f00@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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