This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gnat 4.9.2 on arm with rtems




On 10/29/2015 5:46 AM, Sebastian Huber wrote:
On 28/10/15 15:22, Jan Sommer wrote:
I got it working. The Set function was always overwriting the address of the previous ATCB, so STPO.Self was always returning the ATCB of the task created last.
It turns out that I was building rtems without the --enable-ada option. The option is not mentioned in configure --help and gnat still builds fine.

Would it be possible to not have the symbol rtems_task_self if the --enable-ada switch is off? Then linking gnat should fail with an undefined reference.
I don't know too much of the rtems internals, but maybe it is as easy as adding ifdefs around the SCORE_EXTERN void *rtems_ada_self in score/threadimpl.h?

Since you work on this area, this task variable should go way, since its
broken on SMP systems. I would replace it

      o with functions, e.g. rtems_ada_get_self() and
rtems_ada_set_self(), or
      o POSIX keys, or
      o thread-local storage.

POSIX keys and thread-local storage would make the --enable-ada option
superfluous. Thread-local storage is more efficient. It is well
supported on ARM, PowerPC and SPARC on RTEMS.

This is the best long term solution and shouldn't add any overhead. Ada
is not supported by all gcc target architectures and I think ARM, PowerPC,
SPARC, and x86 are likely the only architectures anyone will care to use
it on. If that statement is wrong, then they can fix TLS on the next
architecture.

FWIW this has a ticket for RTEMS: https://devel.rtems.org/ticket/2289

Since this is a change against gcc 4.9 and other branches, it should
also have a gcc PR. Both PRs should reference each other.

Having an RTEMS PR makes it appropriate to add to the RTEMS 4.11 branch
as well. This shouldn't have a negative impact. The configure magic
will likely be the hardest thing to review since we probably can
drop a configure option (--enable-ada) and tune --enable-ada-tests
or whatever that is. It also may make sense to force --enable-ada-tests
to only build on architectures with real TLS and Ada support.



@Joel: What shall I do about the changes I made to gcc/ada/s-osinte-rtems.ads and newlib/libc/sys/rtems/sys/cpuset.h ? Just send the patches to you or should I  push them to the respective lists with you CC?

Please send them as patches to the corresponding lists and CC
devel@rtems.org.


--joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]