This is the mail archive of the gcc-patches@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]

spec file help for QNX patch


Hi.

I am working on qnx-nto support, and am currently wrestling with the lib
search paths.  I would like gcc to be able to find the appropriate libs and
objects on the fly, and am not sure how to do that correctly.  I can use "-B"
on the gcc command line, but I would like to automate this.

Any ideas or suggestions?

Our cross development TARGET_SYSTEM_ROOT for a dual-endian target like
arm[be,le] looks like:

   ${TARGET_SYSTEM_ROOT}/usr/include
   ${TARGET_SYSTEM_ROOT}/armle/lib
   ${TARGET_SYSTEM_ROOT}/armle/usr/lib
   ${TARGET_SYSTEM_ROOT}/armbe/lib
   ${TARGET_SYSTEM_ROOT}/armbe/usr/lib

I want to set gcc up to find the necessary search paths, but so far I think my
solution is not quite correct.  I have gcc/config/t-nto, and in there I have:
  T_CPPFLAGS=-DQNX_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"

Then in gcc/config/arm/nto.h I set up my STARTFILE_SPEC, ENDFILE_SPEC and
LIB_SPEC as follows:

#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
  "%{!shared: \
    %{!symbolic: \
     %{pg:" QNX_SYSTEM_ROOT "/arm%{EB:be}%{!EB:le}/lib/mcrt1.o%s} \
     %{!pg:%{p:" QNX_SYSTEM_ROOT "/arm%{EB:be}%{!EB:le}/lib/mcrt1.o%s} \
     %{!p:" QNX_SYSTEM_ROOT "/arm%{EB:be}%{!EB:le}/lib/crt1.o%s}}}} \
   " QNX_SYSTEM_ROOT "/arm%{EB:be}%{!EB:le}/lib/crti.o%s \
     %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"

#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} " QNX_SYSTEM_ROOT
"/arm%{EB:be}%{!EB:le}/lib/crtn.o%s"

#undef LIB_SPEC
#define LIB_SPEC                                                        \
  "-L " QNX_SYSTEM_ROOT "/arm%{EB:be}%{!EB:le}/lib \
   -L " QNX_SYSTEM_ROOT "/arm%{EB:be}%{!EB:le}/usr/lib \
   %{!shared:%{!symbolic:-lc}}"

This sorta works, but "-L" is searched before the gcc "-B" paths, and so xgcc
finds the wrong libs during the build process (for example abi-check finds a
legacy libstdc++.so and so fails).  Also, this ties the specs to a qnx-nto
specific cross development libdir layout.

Anyone?  I will eventually be submitting patches for all qnx-nto targets, and
any advice on doing this correctly is appreciated.

Thanks in advance.
Graeme Peterson
QNX Tools Group


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