All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Mike McTernan <mmcternan@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] lib order fails for xeno-config --posix-ldflags on	Blackfin
Date: Fri, 06 Feb 2009 17:13:40 +0100	[thread overview]
Message-ID: <498C61B4.8040806@domain.hid> (raw)
In-Reply-To: <4B3F8896E1733D4787DDB0EA1C7FF91F7044CD@ukmail.uk.wirelessworld.airvananet.com>

Mike McTernan wrote:
> Philippe Gerum wrote:
>> Mike McTernan wrote:
>>> Philippe Gerum wrote:
>>>> Mike McTernan wrote:
>>>>> Hi,
>>>>>
>>> I think you are using ELF, so maybe you don't see the problem - the
>>> dynamic linker maybe patching up the internal pthread references?
> I'm
>>> using FLAT, which is essentially a static link, so everything has to
> be
>>> fully resolved.
>> Yes, this is where FLAT is biting you. All refs have to be resolved,
> so
>> the linker tries to pick whatever it needs at link time.
> <snip> 
>> This is all due to the FLAT mode. So I guess your next option is
> two-stage
>> linking in you don't want to rely on shared fdpic libs.
> 
> Unfortunately moving away from ZFLAT isn't trivial for us and is an
> unlikely step.
> 
> I think Xenomai should support FLAT though, it's just this link problem,
> right?
>

Yes, Xenomai does not care about the underlying binary format. It is just a
convenience for us to follow the default one uClinux uses on the Blackfin.

> Unless you have some hints as to how the two-stage link is done, I'm
> going to go and try to get this working and report back later.
> 

I was thinking about something along these lines (you probably need the flat
directive to be passed to the linker as well); totally untested, but the idea is
illustrated:

X=/usr/xenomai
CFLAGS= $(shell $(X)/bin/xeno-config --posix-cflags) -g
WRAPPERS := $(X)/lib/posix.wrappers
LDFLAGS_1 = -Bstatic -L$(X)/lib @$(WRAPPERS)
LDFLAGS_2 = -static -L$(X)/lib -lpthread -lrt
CC = $(shell $(X)/bin/xeno-config --cc)
LD = $(shell $(CC) --print-prog-name=ld)

all: hello

hello: hello-stage1.o
	$(CC) -o $@ $< $(LDFLAGS_2)

hello-stage1.o: hello.o $(X)/lib/libpthread_rt.a
	$(LD) -r -o $@ $^ $(LDFLAGS_1)

hello.o: hello.c
	$(CC) -c $< $(CFLAGS)

clean:
	rm -f *.o hello

> Regards,
> 
> Mike
> 


-- 
Philippe.


  reply	other threads:[~2009-02-06 16:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05 16:10 [Xenomai-help] lib order fails for xeno-config --posix-ldflags on Blackfin Mike McTernan
2009-02-06 10:19 ` Philippe Gerum
2009-02-06 12:48   ` Mike McTernan
2009-02-06 14:21     ` Philippe Gerum
2009-02-06 15:21       ` Mike McTernan
2009-02-06 16:13         ` Philippe Gerum [this message]
2009-02-06 18:58           ` Mike McTernan
2009-02-09 14:46             ` Philippe Gerum

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=498C61B4.8040806@domain.hid \
    --to=rpm@xenomai.org \
    --cc=mmcternan@domain.hid \
    --cc=xenomai@xenomai.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.