g++ and link once sections.

knk@dde.dk knk@dde.dk
Mon Apr 3 06:45:00 GMT 2000


Hi,
   Thanks for the help. I have been working on the same issue for the
past few days.

Martin v. Loewis wrote:
> 
> > But when I i compiled a couple of object files having template code  the
> > resulting .o files do not have these sections . Am I missing out any
> > other macros that are related to this ??
> 
> A number, including SUPPORTS_ONE_ONLY, SUPPORTS_WEAK, as well as the
> setting of flag_weak. I'd really recommend to analyse this in a
> debugger; set a breakpoint on supports_one_only, comdat_linkage, and
> make_decl_one_only.
> 

I have a added the following macros too. But I seem to have run into
problems getting errors like this causing a botstrap failure. This is
because of relocation errors for the symbols:

__register_frame_info

__deregister_frame_info

in gencheck.

Here is the ldd ouput.

halfway:1755 [compilers/make-gcc-2.95.2-April3/gcc] ldd -d gencheck
dynamic linker: gencheck: file loaded: /usr/lib/libc.so.patch
dynamic linker: gencheck: file loaded: /usr/lib/libc.so.1
ld.so: gencheck: relocation error: symbol not found:
__register_frame_info
ld.so: gencheck: relocation error: symbol not found:
__deregister_frame_info

As I came to know that gcc is set up so that the frame information is
only pulled in if some code tries to catch an exception.  If no code
catches an exception, then there is no need to register frames.

The object files crtbegin.o and crtend.o have these symbols defined
weak. 

objdump -t crtbegin.o | grep register

00000000  w      *UND*  00000000 __deregister_frame_info
00000000  w      *UND*  00000000 __register_frame_info


objdump -t crtend.o | grep register

00000000  w      *UND*  00000000 __deregister_frame_info
00000000  w      *UND*  00000000 __register_frame_info


These are actually present in libgcc.a

objdump -t libgcc.a | grep register

00000f2c g     F .text  0000004c __register_frame_info
00000f78 g     F .text  00000070 __register_frame
00000fe8 g     F .text  0000004c __register_frame_info_table
00001034 g     F .text  00000070 __register_frame_table
000010a4 g     F .text  000000c4 __deregister_frame_info
00001168 g     F .text  00000060 __deregister_frame


I am in a fix trying to understand why these symbols are not pulled from
the archive . Or if at all is there  a need to register frames ??
Could someone calrify this to me.


Here is something from my target definitons file (not in full).
____________________________________________________________________


#undef DWARF2_UNWIND_INFO
#undef DWARF2_FRAME_INFO /* I just added this recently, but no change */


/* Debugging support */

#undef DBX_DEBUGGING_INFO
#undef SDB_DEBUGGING_INFO
#undef MIPS_DEBUGGING_INFO
#undef DWARF_DEBUGGING_INFO
#undef DWARF2_DEBUGGING_INFO

/* Enable the following debugging types */

#define DBX_DEBUGGING_INFO
#define SDB_DEBUGGING_INFO
#define MIPS_DEBUGGING_INFO
#define DWARF_DEBUGGING_INFO

/* Let this be the default */

#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG

#undef SUPPORTS_ONE_ONLY
#define SUPPORTS_ONE_ONLY       1

#undef SUPPORTS_WEAK
#define SUPPORTS_WEAK           1

#undef ASM_OUTPUT_SECTION_NAME
#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
do {                                                            \
  extern FILE *asm_out_text_file;                               \
  if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)              \
    fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n",
(NAME)); \
  else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC))       \
    fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME));     \
  else                                                          \
    fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME));    \
} while (0)

#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
#undef  UNIQUE_SECTION_P
#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
#define UNIQUE_SECTION(DECL, RELOC)                             \
  do                                                            \
    {                                                           \
      int len;                                                  \
      int sec;                                                  \
      char *name;  

.................
..................

      }

____________________________________________________________________

I hope these are O.K ?. Any pointers on the problem that I am facing
will be helpful.

With best regards

koundinya


More information about the Gcc mailing list