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 15:21:43 +0100	[thread overview]
Message-ID: <498C4777.8050801@domain.hid> (raw)
In-Reply-To: <4B3F8896E1733D4787DDB0EA1C7FF91F70443C@ukmail.uk.wirelessworld.airvananet.com>

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.

> 
> While I'm not familiar with the internals of Xenomai, I'd have thought
> that intercepting the internal call would be inefficient, but not
> harmful.  Presumably we end up in the normal pthread lib because the
> calling thread has no Xenomai context.  When the wrapper is called from
> pthread internally, it should always find there is no Xenomai-thread
> context for the caller and hence go back into the normal pthread lib.
> FWIW the compiled test app runs and produces the expected behaviour,
> although is too trivial to be a thorough test.  
> 

An internal uclibc call to grab e.g. a regular mutex from a Xenomai thread would
likely be an issue though.

>> Here is a trivial Makefile I have just used to produce an executable
>> against 2008-r1.5-rc3 and 2.4.1, without any problem. Obviously this 
>> also depends on the references dragged in by your example code; mine
>> was pulling condvar, mutex and thread support through the common 
>> pthread_* calls. If this simple Makefile does not work with a properly
> 
>> built Xenomai userland support, I'd be interested to see your example 
>> code. TIA,
>>
>> X := /usr/xenomai/blackfin
>> CFLAGS := $(shell $(X)/bin/xeno-config --posix-cflags)
>> LDFLAGS := $(shell $(X)/bin/xeno-config --posix-ldflags)
>> CC :=  $(shell $(X)/bin/xeno-config --cc)
>>
>> all: hello
>>
>> hello: hello.c
>> 	$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
>>
>> clean:
>> 	$(RM) hello
>>
> 
> Unfortunately this does not link either (note I added -Wl,-elf2flt).
> Here's the program I am trying to compile, the compile output, and the
> xeno-config output:
> 

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.

> #include <stdio.h>
> #include <sys/mman.h>
> #include <pthread.h>
> 

-- 
Philippe.


  reply	other threads:[~2009-02-06 14:21 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 [this message]
2009-02-06 15:21       ` Mike McTernan
2009-02-06 16:13         ` Philippe Gerum
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=498C4777.8050801@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.