public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* About addition of .symtab and .strtab sections in simple-object-elf.c
@ 2023-06-07 15:56 Rishi Raj
  2023-06-12  1:15 ` Jan Hubicka
  0 siblings, 1 reply; 2+ messages in thread
From: Rishi Raj @ 2023-06-07 15:56 UTC (permalink / raw)
  To: gcc; +Cc: Martin Jambor, Jan Hubicka, ian

Hi Everyone,
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.
--
Thanks & Regards
Rishi Raj

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: About addition of .symtab and .strtab sections in simple-object-elf.c
  2023-06-07 15:56 About addition of .symtab and .strtab sections in simple-object-elf.c Rishi Raj
@ 2023-06-12  1:15 ` Jan Hubicka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2023-06-12  1:15 UTC (permalink / raw)
  To: Rishi Raj; +Cc: gcc, Martin Jambor, ian

> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-12  1:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 15:56 About addition of .symtab and .strtab sections in simple-object-elf.c Rishi Raj
2023-06-12  1:15 ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).