Chetan, Am Freitag 30 Januar 2009 06:07:19 schrieb Chetan Murthy: > I am having trouble getting my application that is statically linked > against a rendering library to work on an ARM platform running uclinux. > After some searching and debugging, I isolated the problem to be due some > missing ctor symbols.
Ah, yes. This is a long-lasting bug in uCLinux. Global static constructors are initialized from uClibc, at programm startup time, with a weak reference symbol. The code is in crtbegin.o and crtend.o. crtbegin must be the FIRST object in the list of linked files. At the end of crtbegin, a section with the list of global constructor is opened. crtend.o must be the LAST object in the list of linked files/libs. At the beginning of crtend, the section is closed with an end marker. Each object/library which has static constructors adds an entry to this list, and crtbegin and crtend do the embracement magic. The linking of crtbegin and crtend is disabled with --no-stdlibs. In the "old" uClinux distributions, this switch is embedded in ucfront. The quick fix is to include these files per hand like this: # Definitions for the inclusion of static constructors CRTBEGIN := $(shell $(CXX) $(CXXFLAGS) -print-file-name=crtbegin.o) CRTEND := $(shell $(CXX) $(CXXFLAGS) -print-file-name=crtend.o) # This is the rule that builds(links) the executable. # CXX: name of the c++ compiler, set by environment # CRTBEGIN/CRTEND: enclosure for inclusion of static constructors. # CRTBEGIN must be the first link object # CRTEND must be the last link object # LDFLAGS: common flags for the linker # CXXLIBS: needed libraries for C++ programs, including uClibc++ # LDLIBS: standard c libraries $(EXEC): $(OBJS) $(CXX) -o $@ $(CRTBEGIN) $(LDFLAGS) $(OBJS) $(CXXLIBS) $(LDLIBS) $(CRTEND) regards Wolfgang -- Wahre Worte sind nicht schön. Schöne Worte sind nicht wahr. (Laotse) _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev