[Cbe-oss-dev] [PATCH 1/7]MARS/core: Fix host static lib

Yuji Mano yuji.mano at am.sony.com
Thu Oct 30 06:17:38 EST 2008


Kazunori Asayama wrote:
> Yuji Mano wrote:
>> This fixes the problem where mars_kernel_entry symbol is undefined in the static
>> library libmars.a. The problem is the MARS kernel spu embedded object does not
>> get properly included in the static library.
>> 
>> This is a hack so that we can have the MARS kernel embedded spu object included
>> into the static library. The hack forces creation of the .lo object file usually
>> created by libtool. Without the hack there does not seem to be any clean
>> solution for having automake and libtool to create a libtool object from an
>> object file created by some external application such as ppu-embedspu.
>> 
>> Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
>> 
>> ---
>>  core/src/host/lib/Makefile.am   |   21 ++++++++++++++-------
>>  core/src/mpu/kernel/Makefile.am |    2 +-
>>  2 files changed, 15 insertions(+), 8 deletions(-)
>> 
>> --- a/core/src/host/lib/Makefile.am
>> +++ b/core/src/host/lib/Makefile.am
>> @@ -40,7 +40,7 @@ extra_cppflags =
>>  extra_cflags =
>>  extra_ldflags =
>>  
>> -MARS_KERNEL = ${top_builddir}/../mpu/kernel/mars-kernel
>> +MARS_KERNEL = ${top_builddir}/../mpu/kernel/mars_kernel
>>  
>>  if DEBUG
>>   extra_cppflags += "-DDEBUG"
>> @@ -109,7 +109,18 @@ libmars_la_SOURCES = \
>>  	workload_queue.c \
>>  	workload_queue.h
>>  
>> -libmars_la_DEPENDENCIES = mars-kernel.eo
>> +nodist_libmars_la_SOURCES = \
>> +	mars_kernel.eo
>> +
>> +libmars_la_DEPENDENCIES = mars_kernel.eo
>> +
>> +mars_kernel.eo: ${MARS_KERNEL}
>> +	$(EMBEDSPU) $(CFLAGS) mars_kernel_entry  $< $@
>> +
>> +.eo.lo:
>> +	@echo "# Generated by ltmain.sh - GNU libtool" > $@
>> +	@echo "pic_object='"$<"'" >> $@
>> +	@echo "non_pic_object='"$<"'" >> $@
> 
> A non PIC 'mars_kernel.eo' is used for shared library.

I'm assuming you mean that I should generate a separate PIC
object for the pic_object I specify in the .lo?

Something like...

+mars_kernel.eo: ${MARS_KERNEL}
+	$(EMBEDSPU) $(CFLAGS) mars_kernel_entry  $< $@
+	$(EMBEDSPU) $(CFLAGS) -fPIC -DPIC mars_kernel_entry  $< .libs/$@
+
+.eo.lo:
+	@echo "# Generated by ltmain.sh - GNU libtool" > $@
+	@echo "pic_object='"$<"'" >> .libs/$@
+	@echo "non_pic_object='"$<"'" >> $@

But I think the -fPIC -DPIC is meaningless here as ppu-embedspu will
output the same object anyway?

# ppu-nm mars_kernel.eo
00000000 D mars_kernel_entry

Regards,
Yuji




More information about the cbe-oss-dev mailing list