Chinaunix首页 | 论坛 | 博客
  • 博客访问: 588898
  • 博文数量: 169
  • 博客积分: 2656
  • 博客等级: 少校
  • 技术积分: 1685
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-30 13:03
文章分类

全部博文(169)

文章存档

2011年(1)

2010年(135)

2009年(33)

我的朋友

分类: 嵌入式

2010-05-14 13:03:45

编译VxWorks时,正常;编译bootrom.bin时,提示如下:

d:\Tornado2.2_ppc\target/lib/ppc/PPC860/gnu\libcplus.a(cplusXtors.o): In functio

n `cplusCtorsLink':

cplusXtors.o(.text+0x22): undefined reference to `_ctors'

cplusXtors.o(.text+0x26): undefined reference to `_ctors'

d:\Tornado2.2_ppc\target/lib/ppc/PPC860/gnu\libcplus.a(cplusXtors.o): In functio

n `cplusDtorsLink':

cplusXtors.o(.text+0x56): undefined reference to `_dtors'

cplusXtors.o(.text+0x5a): undefined reference to `_dtors'

make: *** [bootrom.Z.s] Error 0x1

cd ..\..\..\runfiles


原因是我调用了函数:


   moduleLibInit ();           /* support library for the target-based loader. */

   loadElfInit();               /* target loader */


hModule=loadModule(fd,LOAD_ALL_SYMBOLS);


但我在Config.h中加了如下组件:还是有同样的问题,如何能编译通过?

#define INCLUDE_CTORS_DTORS

#define INCLUDE_STAT_SYM_TBL    /* create user-readable error status */

#define INCLUDE_NET_SYM_TBL     /* load symbol table from network */

#define SYM_TBL_HASH_SIZE_LOG2        8        /* 256 entry hash table symbol table */

#define INCLUDE_SYM_TBL
#define INCLUDE_SYM_TBL_INIT
#define INCLUDE_SYM_TBL_SHOW
#define INCLUDE_SYM_TBL_SYNC
#define INCLUDE_STANDALONE_SYM_TBL /* compiled-in symbol table */

#define INCLUDE_MODULE_MANAGER /* compiled-in symbol table */

#define INCLUDE_LOADER          /* object module loading */
 
 
请做如下修改:
BootConfig.c
  
#if defined (INCLUDE_CPLUS) && defined (INCLUDE_CPLUS_MIN)
#error Define only one of INCLUDE_CPLUS or INCLUDE_CPLUS_MIN, not both
#endif
  
#if defined (INCLUDE_CPLUS) || defined (INCLUDE_CPLUS_MIN)
#ifndef INCLUDE_CTORS_DTORS
#define INCLUDE_CTORS_DTORS
#endif
#endif
  
#ifdef  INCLUDE_CTORS_DTORS
/*
  * call compiler generated init functions (usually - but not necessarily -
  * C++ related)
  */
  cplusCtorsLink ();
#endif
  
#ifdef INCLUDE_CPLUS   /* all standard C++ runtime support */
   cplusLibInit ();
#endif
  
#ifdef INCLUDE_CPLUS_MIN  /* minimal C++ runtime support */
   cplusLibMinInit ();
#endif
  
#ifdef INCLUDE_CPLUS_DEMANGLER
   cplusDemanglerInit ();
#endif
  
rules.bsp
  
  
bootrom.Z.s : depend.$(BSP_NAME) bootConfig.o $(MACH_DEP) $(LDDEPS) \
  $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB)
- @ $(RM) $@
- @ $(RM) tmp.o
- @ $(RM) tmp.out
- @ $(RM) tmp.Z
- @ $(RM) version.o
$(CC) $(OPTION_OBJECT_ONLY) $(CFLAGS) -o version.o \
    $(CONFIG_ALL)/version.c
$(NM) version.o | $(MUNCH) > ctdt.c
$(MAKE) CC_COMPILER="$(OPTION_DOLLAR_SYMBOLS)" ctdt.o
$(LD) -o tmp.o $(LDFLAGS) $(ROM_LDFLAGS) $(LD_ENTRY_OPT) $(USR_ENTRY) \
    $(LD_HIGH_FLAGS) bootConfig.o version.o ctdt.o $(MACH_DEP) $(CC_LIB) \
    $(LD_START_GROUP) $(LD_LINK_PATH) $(LIBS) $(LD_END_GROUP) \
    $(CC_LIB) $(LD_SCRIPT_RAM)
$(LDOUT_HOST) tmp.o
$(EXTRACT_BIN) tmp.o tmp.out
$(COMPRESS) < tmp.out > tmp.Z
$(BINTOASM) tmp.Z >bootrom.Z.s
- @ $(RM) tmp.o
- @ $(RM) tmp.out
- @ $(RM) tmp.Z
阅读(1689) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~