Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[arm-gnu] Problem with linking against RVCT-built libs


  • To: arm-gnu@xxxxxxxxxxxxxxxx
  • Subject: [arm-gnu] Problem with linking against RVCT-built libs
  • From: Dave Poston <dave@xxxxxxxxxxxxxxx>
  • Date: Fri, 10 Oct 2008 17:33:19 +0100

Hi,
There seems to a problem with arm-none-eabi-gcc when linking against RVCT-built libraries. If the libraries contain inline virtual destructors, and --start-group, --end-group is used to link them, then the linker errors with "xxx.a: could not read symbols: Bad value". However linking the library with --whole-archive, or without the --start-group/--end-group works fine. Putting the library's object files on the link line also works fine.

   Here is a repro case for a windows machine.

myclass.h:
class myclass
{
public:
   virtual ~myclass() {}
};


rvct_inline.cpp:
#include "myclass.h"

void rvct_func()
{
   new myclass;
}

gcc_uselib.cpp:
#include "myclass.h"

extern void rvct_func();

void gcc_func()
{
   rvct_func();
   new myclass;
}

build.bat:
REM Compile rvct_inline.cpp with RVCT, 2.x or 3.x makes no difference
armcc -c  rvct_inline.cpp --no-hide-all

REM Make a library, can use either ar or armar
"C:\Program Files\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-ar.exe" -cr librvct.a rvct_inline.o

REM This works fine
"C:\Program Files\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-gcc.exe" gcc_uselib.cpp -L. -lrvct -lc -lm -lstdc++ -shared

REM So does this
"C:\Program Files\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-gcc.exe" gcc_uselib.cpp -L. rvct_inline.o -lc -lm -lstdc++ -shared


REM This fails with 'could not read symbols: bad value'
"C:\Program Files\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-gcc.exe" gcc_uselib.cpp -L. -Wl,--start-group -lrvct -Wl,--end-group -lc -lm -lstdc++ -shared

REM But this works again
"C:\Program Files\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-gcc.exe" gcc_uselib.cpp -L. -Wl,--start-group -Wl,--whole-archive -lrvct -Wl,--no-whole-archive -Wl,--end-group -lc -lm -lstdc++ -shared