This is the mail archive of the mailing list for the elfutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

--gc-sections not working?

Hello everybody!

I am developing elf linker for the PicoBlaze CPU target using
elfutils-0.152 (see work-in-progress patches in [1]). PicoBlaze is a
primitive 8-bit RISC core for Xilinx FPGA. It has quite a small
program memory - only 1024 instructions. Hence code size is of primary
concern here.
I've discovered that the option --gc-sections does not work as
intended (see test examples in [2] using i386 target instead). I put
each function in its own section (-ffunction-sections), but when a
single function (section from the object file is included
in the output, all the other sections ( are included too. I
also tried linking against an archive: in this case the situation
improves as untouched object files in the archive are not linked in,
but once a function is linked-in, all the other from the same object
file are linked-in too. In [2] I tried it also with GNU binutils and
it works fine.

Some commands from [2] - maybe I am missing an option switch somewhere?
gcc -Wall -O3 -ffunction-sections -m32 -c -o main.o ../src/main.c
elfutils-ld -c elf32-i386.script --gc-sections -L. main.o -lmy -o fin-lib-gc.elf

I very much need the feature to omit unused functions to minimize code size.
Could someone help please?



Space--the final frontier!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]