Hi All,
I am creating a dynamic library with options --linux, --pic=far --dbst. While compiling if i add a linker command file along with the build the elf file generated is not a valid one. it has the following errors
- One of the program headers PT_LOAD has memory size as 0 and file size as non-zero number
- The dynamic symbol table offset (DT_SYMTAB) present in the dynamic header is set to 0
- The values of the offset in the section headers though are the correct ones.
All of these errors goes away as soon as i exclude the linker.cmd file from the build. The 2 generated elf files are compared using ofd6x.exe, there is a lot of difference between them including the program headers. The elf file generated without linker.cmd has the PT_INTERP & PT_PHDR sections which is missing in the elf file generated with the linker.cmd. I have attached the main.c that i am trying to compile along with the linker.cmd.
#include <stdio.h>
__declspec(dllexport) int AnalyticsProcess (int* , void* b);
__declspec(dllexport) int AnalyticsCreate (int**, void* );
__declspec(dllexport) int AnalyticsDestruct(void*);
__declspec(dllexport) int AnalyticsControl (void*, int, void*);
int AnalyticsProcess(int* handle, void* buffer)
{
printf("In AnalyticsProcess \n ");
return 0;
}
int AnalyticsCreate(int** handle, void* param)
{
printf("In AnalyticsCreate \n ");
return 0;
}
int AnalyticsDestruct(void* handle)
{
printf("In AnalyticsDestruct \n ");
return 0;
}
int AnalyticsControl(void* handle, int cmd_id, void* buf)
{
printf("In AnalyticsControl \n ");
return 0;
}
MEMORY
{
HDVICP: o = 0x00400000 l = 0x00040000 // 256kB HDVICP SL2
DSPL2RAM: o = 0x00800000 l = 0x00040000 // 256kB DSP L2 RAM
DSPL1PRAM: o = 0x00E00000 l = 0x00008000 // 32kB DSP L1 Program RAM
DSPL1DRAM: o = 0x00F00000 l = 0x00008000 // 32kB DSP L1 Data RAM
DDR3: o = 0x85000000 l = 0x04000000 // 64MB DDR3
}
SECTIONS
{
GROUP
{
.dsbt
.got
.neardata
}>DSPL2RAM
}
/*
SECTIONS
{
.text > DSPL2RAM
.stack > DSPL2RAM
//.bss > DSPL2RAM
.cio > DSPL2RAM
.const > DSPL2RAM
.data > DSPL2RAM
.switch > DSPL2RAM
.sysmem > DDR3
.far > DSPL2RAM
.args > DSPL2RAM
.ppinfo > DSPL2RAM
.ppdata > DSPL2RAM
.heap > DDR3
GROUP
{
.dsbt
.got
// .bss
.neardata
// .rodata
}>DSPL2RAM
// TI-ABI or COFF sections
.pinit > DSPL2RAM
.cinit > DSPL2RAM
// EABI sections
.binit > DSPL2RAM
.init_array > DSPL2RAM
//.neardata > DSPL2RAM
.fardata > DSPL2RAM
//.rodata > DSPL2RAM
.c6xabi.exidx > DSPL2RAM
.c6xabi.extab > DSPL2RAM
.plt > DSPL2RAM
}
*/
command lines options are
"C:/Tools/TI/ccsv5/tools/compiler/c6000_7.4.4/bin/cl6x" -mv6740 --abi=eabi -g --dsbt --pic=far --linux -z -i"C
:/Tools/TI/ccsv5/tools/compiler/c6000_7.4.4/lib" -i"C:/Tools/TI/ccsv5/tools/compiler/c6000_7.4.4/include" --export=AnalyticsProcess --export=AnalyticsCreate --export=AnalyticsControl --export=AnalyticsDestruct --bind_now --dynamic=lib -o "DynamicLib.dll" "./main.obj" "../linker.cmd"
Can anyone shed some light on why the linker.cmd file is causing the compiler to generate such different elf files ? Please note I need the linker cmd file for grouping various DATA_SECTIONS present in the code. I am on 8127 and with complier version 7.4.4
Regards
Krishna