> Hi Everyone, Hello, > I am working on the GSOC project "Bypass Assembler when generating LTO > object files." My mentors and I have decided to work on the ELF files > first, so I will add .symtab along with the symbol __gnu_lto_slim to > the ELF file as a first step. > When I was going through the simple-object-elf.c: > simple_object_elf_write_to_file(....) I found out that it writes the > following: > /* Write out a complete ELF file. > Ehdr > initial dummy Shdr > user-created Shdrs > .shstrtab Shdr > user-created section data > .shstrtab data */ > and .symtab is missing here. To add the missing symtab I have thought > of these two possible implementations. > 1) Add it in simple-object-elf.c (based on -fbypass-asm flag). > 2) We can add .symtab section in lto-object.cc along with other LTO sections. > I am a bit skeptical about the second one as .symtab with other lto > sections might be confusing. Any comments regarding which one should I > proceed with will be helpful.
I think we need to take into consideration that eventually we want to support also coff/xcoff and macho so writting symtab section directly out of lto-object.cc (which is supposed to be file format agnostic) is hard. On the other hand libiberty knows nothing about internals of LTO implementatoin. I think we want to extend simple-object.c by (simple at first at least) API to add symbols to the symbol table and interface it to simple-object-elf.c via simple_object_functions. That way lto-object.cc (which knows the symbol names but no particular file format) can call generic simple-object.cc API which will in turn call simple-object-elf.c to create the symtab section. Honza > -- > Thanks & Regards > Rishi Raj