Compiling with a cpp class

Bruno Oliveira bruno.manata.oliveira at gmail.com
Wed Nov 11 14:52:39 UTC 2015


Hello, I am compiling a simple test for my SPARC RTEMS. I have an Init task
(declared with extern "C"), and this is how I compile it (Makefile):

# Compiler
CC=sparc-rtems4.11-g++
BSP=-specs bsp_specs -qrtems
LIBS=-B../../leon3/sparc-rtems4.11/leon3/lib
INCLUDES=-I../../leon3/sparc-rtems4.11/leon3/lib/include
FLAGS=-mcpu=cypress -msoft-float -O0 -g -ffunction-sections -fdata-sections
-Wall
CPPFLAGS=-c -Wall -msoft-float
LDFLAGS=-lm
SOURCESCPP=test.cpp image.cpp init.cpp
OBJECTS=$(SOURCESCPP:.cpp=.o)
EXECUTABLE=image_test.exe

all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
    $(CC) $(LIBS) $(BSP) $(FLAGS) $(OBJECTS) $(LDFLAGS)  -o $@
.cpp.o:
    $(CC) $(INCLUDES) $(FLAGS) $(CPPFLAGS) $< -o $@
clean:
    rm -f *.exe *.o *.d


If I compile and link WITH an image.cpp file , which contains a simple c++
class, my code ends and nothing happens. However, If I DO NOT compile with
that image.cpp class, everything works fine. What might be wrong here?


More information: I debugged this with gdb + tsim and found out that it
ends on *threadglobalconstruction.c*

#if defined(EXECUTE_GLOBAL_CONSTRUCTORS)
  /*
   *  _init could be a weak symbol and we SHOULD test it but it isn't
   *  in any configuration I know of and it generates a warning on every
   *  RTEMS target configuration.  --joel (12 May 2007)
   */
  INIT_NAME();
#endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20151111/a1fd8275/attachment.html>


More information about the users mailing list