Skip to contentSkip to conversation

A patch for ELF section symbols

PATCH H . J . Lu 1 participant 1 message Jun 6, 2001 MIPS

lore
Share & tools
lore

H . J . Lu

author
#0 lore raw

On mips, both _gp_disp and _DYNAMIC_LINKING/_DYNAMIC_LINK are explicitly marked as glocal section symbols. We should keep them during objcopy.

H.J.
----
2001-06-06 H.J. Lu <[email protected]>

* elf.c (swap_out_syms): Keep names for global section symbols.

bfd/elf.c renamed from bfd/elf.c.mips +8 -3
@@ -4395,9 +4395,9 @@ swap_out_syms (abfd, sttp, relocatable_p
 	flagword flags = syms[idx]->flags;
 	int type;
 
-	if ((flags & BSF_SECTION_SYM) != 0)
+	if ((flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM)
 	  {
-	    /* Section symbols have no name.  */
+	    /* Local section symbols have no name.  */
 	    sym.st_name = 0;
 	  }
 	else
@@ -4506,7 +4506,12 @@ swap_out_syms (abfd, sttp, relocatable_p
           type = (*bed->elf_backend_get_symbol_type) (&type_ptr->internal_elf_sym, type);
 
 	if (flags & BSF_SECTION_SYM)
-	  sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
+	  {
+	    if (flags & BSF_GLOBAL)
+	      sym.st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+	    else
+	      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
+	  }
 	else if (bfd_is_com_section (syms[idx]->section))
 	  sym.st_info = ELF_ST_INFO (STB_GLOBAL, type);
 	else if (bfd_is_und_section (syms[idx]->section))