GreenHills链接器在静态库中找不到模块

时间:2019-05-16 08:12:05

标签: c linker linker-scripts linker-warning greenhills

在链接器布局脚本(*.ld)中,我有这样的内容:

.data_Secure align(16) : AT(___IDAT_Secure)
{
    "libBase.a(Csm.o(.data))" "libBase.a(Csm.o(.sdata))" "libBase.a(Csm.o(.zdata))"
    ...
}

但是GHS链接程序不断向我发出警告:

[elxr] (warning) section libBase.a(Csm.o)(.data)  is not being included; module libBase.a(Csm.o) is not part of this link

[elxr] (warning) section libBase.a(Csm.o)(.sdata) is not being included; module libBase.a(Csm.o) is not part of this link

[elxr] (warning) section libBase.a(Csm.o)(.zdata) is not being included; module libBase.a(Csm.o) is not part of this link

我很确定模块Csm.olibBase.a的一部分。当我浏览图书馆时,会看到以下内容:

$ objdump -x libBase.a | grep -A 100 Csm.o | less
Csm.o:     file format elf32-little
rw-rw-rw- 0/0  61304 Apr 30 14:27 2019 Csm.o
architecture: UNKNOWN!, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000030  00000000  00000000  00000034  2**1
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000000  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000000  2**0
                  ALLOC
  3 .debug_info   00000293  00000000  00000000  00000064  2**0
                  CONTENTS, RELOC, READONLY, DEBUGGING
  4 .debug_abbrev 0000008f  00000000  00000000  000002f7  2**0
                  CONTENTS, READONLY, DEBUGGING
  5 .debug_line   00002c8a  00000000  00000000  00000386  2**0
                  CONTENTS, RELOC, READONLY, DEBUGGING
  6 .debug_macinfo 0000aae1  00000000  00000000  00003010  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_frame  000000ac  00000000  00000000  0000daf1  2**0
                  CONTENTS, RELOC, READONLY, DEBUGGING
  8 .note.renesas 00000028  00000000  00000000  0000db9d  2**0
                  CONTENTS, READONLY
  9 .ghsinfo      00000048  00000000  00000000  0000dbc5  2**0
                  CONTENTS, READONLY

如果有什么事,我会期望得到警告:

[elxr] (warning) section libBase.a(Csm.o)(.data) is not being included; section .data appears to be empty

或类似。有没有人有经验为什么链接程序无法在库中找到模块?

0 个答案:

没有答案