View | Details | Raw Unified | Return to bug 16625 | Differences between
and this patch

Collapse All | Expand All

(-)gcc-3.4.6.orig/gcc/config/arm/arm.c (-1 / +15 lines)
Lines 13150-13161 static void Link Here
13150
arm_elf_asm_named_section (const char *name, unsigned int flags)
13150
arm_elf_asm_named_section (const char *name, unsigned int flags)
13151
{
13151
{
13152
  char flagchars[10], *f = flagchars;
13152
  char flagchars[10], *f = flagchars;
13153
  const char *section_name = NULL, *group_name = NULL;
13153
13154
13155
#if !HAVE_GAS_COMDAT_GROUP
13154
  if (! named_section_first_declaration (name))
13156
  if (! named_section_first_declaration (name))
13155
    {
13157
    {
13156
      fprintf (asm_out_file, "\t.section\t%s\n", name);
13158
      fprintf (asm_out_file, "\t.section\t%s\n", name);
13157
      return;
13159
      return;
13158
    }
13160
    }
13161
#endif
13159
13162
13160
  if (!(flags & SECTION_DEBUG))
13163
  if (!(flags & SECTION_DEBUG))
13161
    *f++ = 'a';
13164
    *f++ = 'a';
Lines 13171-13179 arm_elf_asm_named_section (const char *n Link Here
13171
    *f++ = 'S';
13174
    *f++ = 'S';
13172
  if (flags & SECTION_TLS)
13175
  if (flags & SECTION_TLS)
13173
    *f++ = 'T';
13176
    *f++ = 'T';
13177
#if HAVE_GAS_COMDAT_GROUP
13178
  if (elf_comdat_group (name, &section_name, &group_name))
13179
    *f++ = 'G';
13180
#endif
13174
  *f = '\0';
13181
  *f = '\0';
13175
13182
13176
  fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
13183
  if (section_name)
13184
    fprintf (asm_out_file, "\t.section\t%s,\"%s\"", section_name,
13185
	     flagchars);
13186
  else
13187
    fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
13177
13188
13178
  if (!(flags & SECTION_NOTYPE))
13189
  if (!(flags & SECTION_NOTYPE))
13179
    {
13190
    {
Lines 13189-13194 arm_elf_asm_named_section (const char *n Link Here
13189
      if (flags & SECTION_ENTSIZE)
13200
      if (flags & SECTION_ENTSIZE)
13190
	fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
13201
	fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
13191
    }
13202
    }
13203
13204
  if (group_name)
13205
    fprintf (asm_out_file, ",%s,comdat", group_name);
13192
13206
13193
  putc ('\n', asm_out_file);
13207
  putc ('\n', asm_out_file);
13194
}
13208
}
(-)gcc-3.4.6.orig/gcc/config/sparc/sparc.c (-1 / +5 lines)
Lines 163-170 static void sparc_flat_save_restore (FIL Link Here
163
static void sparc_nonflat_function_epilogue (FILE *, HOST_WIDE_INT, int);
163
static void sparc_nonflat_function_epilogue (FILE *, HOST_WIDE_INT, int);
164
static void sparc_nonflat_function_prologue (FILE *, HOST_WIDE_INT, int);
164
static void sparc_nonflat_function_prologue (FILE *, HOST_WIDE_INT, int);
165
#ifdef OBJECT_FORMAT_ELF
165
#ifdef OBJECT_FORMAT_ELF
166
#ifdef NEED_SPARC_ELF_ASM_NAMED_SECTION
166
static void sparc_elf_asm_named_section (const char *, unsigned int);
167
static void sparc_elf_asm_named_section (const char *, unsigned int);
167
#endif
168
#endif
169
#else
170
#undef NEED_SPARC_ELF_ASM_NAMED_SECTION
171
#endif
168
static void sparc_aout_select_section (tree, int, unsigned HOST_WIDE_INT)
172
static void sparc_aout_select_section (tree, int, unsigned HOST_WIDE_INT)
169
     ATTRIBUTE_UNUSED;
173
     ATTRIBUTE_UNUSED;
170
static void sparc_aout_select_rtx_section (enum machine_mode, rtx,
174
static void sparc_aout_select_rtx_section (enum machine_mode, rtx,
Lines 8685-8691 sparc_profile_hook (int labelno) Link Here
8685
  emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lab, Pmode);
8689
  emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lab, Pmode);
8686
}
8690
}
8687
8691
8688
#ifdef OBJECT_FORMAT_ELF
8692
#ifdef NEED_SPARC_ELF_ASM_NAMED_SECTION
8689
static void
8693
static void
8690
sparc_elf_asm_named_section (const char *name, unsigned int flags)
8694
sparc_elf_asm_named_section (const char *name, unsigned int flags)
8691
{
8695
{
(-)gcc-3.4.6.orig/gcc/config/sparc/sysv4.h (+5 lines)
Lines 150-158 do { ASM_OUTPUT_ALIGN ((FILE), Pmode == Link Here
150
#undef DTORS_SECTION_ASM_OP
150
#undef DTORS_SECTION_ASM_OP
151
#define DTORS_SECTION_ASM_OP    "\t.section\t\".dtors\",#alloc,#write"
151
#define DTORS_SECTION_ASM_OP    "\t.section\t\".dtors\",#alloc,#write"
152
152
153
/* COMDAT group cannot be expressed in SPARC's section attributes
154
   encoding style.  */
155
#if !HAVE_GAS_COMDAT_GROUP
153
/* Switch into a generic section.  */
156
/* Switch into a generic section.  */
154
#undef TARGET_ASM_NAMED_SECTION
157
#undef TARGET_ASM_NAMED_SECTION
155
#define TARGET_ASM_NAMED_SECTION  sparc_elf_asm_named_section
158
#define TARGET_ASM_NAMED_SECTION  sparc_elf_asm_named_section
159
#define NEED_SPARC_ELF_ASM_NAMED_SECTION
160
#endif
156
161
157
#undef ASM_OUTPUT_ALIGNED_BSS
162
#undef ASM_OUTPUT_ALIGNED_BSS
158
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
163
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
(-)gcc-3.4.6.orig/gcc/configure.ac (-4 / +36 lines)
Lines 1891-1898 changequote(,)dnl Link Here
1891
	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
1891
	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
1892
	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p' \
1892
	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p' \
1893
	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p' \
1893
	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p' \
1894
	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p'`
1894
	-e 's,^.*[ 	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ 	].*$,\1,p' \
1895
	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p'`
1895
    ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
1896
    ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
1897
    ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
1898
    ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
1899
    ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
1896
    if test 0"$ld_date" -lt 20020404; then
1900
    if test 0"$ld_date" -lt 20020404; then
1897
      if test -n "$ld_date"; then
1901
      if test -n "$ld_date"; then
1898
	# If there was date string, but was earlier than 2002-04-04, fail
1902
	# If there was date string, but was earlier than 2002-04-04, fail
Lines 1901-1909 changequote(,)dnl Link Here
1901
	# If there was no date string nor ld version number, something is wrong
1905
	# If there was no date string nor ld version number, something is wrong
1902
	gcc_cv_ld_hidden=no
1906
	gcc_cv_ld_hidden=no
1903
      else
1907
      else
1904
	ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
1905
	ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
1906
	ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
1907
	test -z "$ld_vers_patch" && ld_vers_patch=0
1908
	test -z "$ld_vers_patch" && ld_vers_patch=0
1908
	if test "$ld_vers_major" -lt 2; then
1909
	if test "$ld_vers_major" -lt 2; then
1909
	  gcc_cv_ld_hidden=no
1910
	  gcc_cv_ld_hidden=no
Lines 2037-2042 gcc_GAS_CHECK_FEATURE(section merging su Link Here
2037
AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
2038
AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
2038
  [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
2039
  [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
2039
[Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
2040
[Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
2041
2042
gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group,
2043
 [elf,2,16,0], [--fatal-warnings],
2044
 [.section .text,"axG",@progbits,.foo,comdat])
2045
if test $gcc_cv_as_comdat_group = yes; then
2046
  gcc_cv_as_comdat_group_percent=no
2047
else
2048
 gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent,
2049
   [elf,2,16,0], [--fatal-warnings],
2050
   [.section .text,"axG",%progbits,.foo,comdat])
2051
fi
2052
if test $in_tree_ld != yes && test x"$ld_vers$ld_date" != x; then
2053
  comdat_group=yes
2054
  if test 0"$ld_date" -lt 20050308; then
2055
    if test -n "$ld_date"; then
2056
      # If there was date string, but was earlier than 2005-03-08, fail
2057
      comdat_group=no
2058
    elif test "$ld_vers_major" -lt 2; then
2059
      comdat_group=no
2060
    elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
2061
      comdat_group=no
2062
    fi
2063
  fi
2064
  if test $comdat_group = no; then
2065
    gcc_cv_as_comdat_group=no
2066
    gcc_cv_as_comdat_group_percent=no
2067
  fi
2068
fi
2069
AC_DEFINE_UNQUOTED(HAVE_GAS_COMDAT_GROUP,
2070
  [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`],
2071
[Define 0/1 if your assembler and linker support COMDAT groups.])
2040
2072
2041
# Thread-local storage - the check is heavily parametrized.
2073
# Thread-local storage - the check is heavily parametrized.
2042
conftest_s=
2074
conftest_s=
(-)gcc-3.4.6.orig/gcc/final.c (+5 lines)
Lines 1881-1887 final_scan_insn (rtx insn, FILE *file, i Link Here
1881
		{
1881
		{
1882
		  int log_align;
1882
		  int log_align;
1883
1883
1884
#if HAVE_GAS_COMDAT_GROUP
1885
		  readonly_data_section_in_function_group
1886
		    (current_function_decl);
1887
#else
1884
		  readonly_data_section ();
1888
		  readonly_data_section ();
1889
#endif
1885
1890
1886
#ifdef ADDR_VEC_ALIGN
1891
#ifdef ADDR_VEC_ALIGN
1887
		  log_align = ADDR_VEC_ALIGN (NEXT_INSN (insn));
1892
		  log_align = ADDR_VEC_ALIGN (NEXT_INSN (insn));
(-)gcc-3.4.6.orig/gcc/output.h (+3 lines)
Lines 475-480 extern void no_asm_to_stream (FILE *); Link Here
475
#define SECTION_NOTYPE	 0x80000	/* don't output @progbits */
475
#define SECTION_NOTYPE	 0x80000	/* don't output @progbits */
476
#define SECTION_MACH_DEP 0x100000	/* subsequent bits reserved for target */
476
#define SECTION_MACH_DEP 0x100000	/* subsequent bits reserved for target */
477
477
478
extern const char *elf_comdat_group (const char *, const char **,
479
				     const char **);
480
extern void readonly_data_section_in_function_group (tree);
478
extern unsigned int get_named_section_flags (const char *);
481
extern unsigned int get_named_section_flags (const char *);
479
extern bool set_named_section_flags (const char *, unsigned int);
482
extern bool set_named_section_flags (const char *, unsigned int);
480
extern void named_section_flags (const char *, unsigned int);
483
extern void named_section_flags (const char *, unsigned int);
(-)gcc-3.4.6.orig/gcc/varasm.c (-1 / +122 lines)
Lines 259-264 data_section (void) Link Here
259
    }
259
    }
260
}
260
}
261
261
262
#if HAVE_GAS_COMDAT_GROUP
263
264
/* Tell assembler to switch to read-only data section in the same
265
   comdat group as DECL.  */
266
267
void
268
readonly_data_section_in_function_group (tree decl)
269
{
270
  if (decl == NULL_TREE || !DECL_P (decl))
271
    abort ();
272
273
  if (DECL_SECTION_NAME (decl) == NULL_TREE || ! DECL_ONE_ONLY (decl))
274
    readonly_data_section ();
275
  else
276
    {
277
      char *rodata;
278
      const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
279
280
      if (strncmp (name, ".gnu.linkonce.t.", 16) != 0)
281
	abort ();
282
283
      rodata = xstrdup (name);
284
      rodata [14] = 'r';
285
      named_section_flags (rodata, 0);
286
      free (rodata);
287
    }
288
}
289
#endif
290
262
/* Tell assembler to switch to read-only data section.  This is normally
291
/* Tell assembler to switch to read-only data section.  This is normally
263
   the text section.  */
292
   the text section.  */
264
293
Lines 4711-4726 default_no_named_section (const char *na Link Here
4711
  abort ();
4740
  abort ();
4712
}
4741
}
4713
4742
4743
/* Extract section name and group name from the linkonce section
4744
   name.  */
4745
4746
const char *
4747
elf_comdat_group (const char *name, const char **section,
4748
		  const char **group)
4749
{
4750
  const char *p;
4751
  const char *sec = NULL;
4752
  static const char *one [] = 
4753
    {
4754
      ".bss",		/* 'b'  */
4755
      NULL,		/* 'c'  */
4756
      ".data",		/* 'd'  */
4757
      NULL,		/* 'e'  */
4758
      NULL,		/* 'f'  */
4759
      NULL,		/* 'q'  */
4760
      NULL,		/* 'h'  */
4761
      NULL,		/* 'i'  */
4762
      NULL,		/* 'j'  */
4763
      NULL,		/* 'k'  */
4764
      NULL,		/* 'l'  */
4765
      NULL,		/* 'm'  */
4766
      NULL,		/* 'n'  */
4767
      NULL,		/* 'o'  */
4768
      NULL,		/* 'p'  */
4769
      NULL,		/* 'q'  */
4770
      ".rodata",	/* 'r'  */
4771
      ".sdata",		/* 's'  */
4772
      ".text"		/* 't'  */
4773
    };
4774
  
4775
  if (strncmp (name, ".gnu.linkonce.", 14) != 0)
4776
    return sec;
4777
4778
  p = name + 14;
4779
  if (p [1] == '.')
4780
    {
4781
      if (p [0] > 'a' && p [0] < 'u')
4782
	sec = one [p [0] - 'b'];
4783
4784
      if (sec)
4785
	*group = p + 1;
4786
    }
4787
  else if (p [2] == '.')
4788
    {
4789
      if (p [0] == 's')
4790
	{
4791
	  if (p [1] == '2')
4792
	    sec = ".sdata2";
4793
	  else if (p [1] == 'b')
4794
	    sec = ".sbss";
4795
	}
4796
      else if (p [0] == 't')
4797
	{
4798
	  if (p [1] == 'b')
4799
	    sec = ".tbss";
4800
	  else if (p [1] == 'd')
4801
	    sec = ".tdata";
4802
	}
4803
      else if (p [0] == 'w' && p [1] == 'i')
4804
	sec = ".debug_info";
4805
4806
      if (sec)
4807
	*group = p + 2;
4808
    }
4809
  else if (strncmp (p, "sb2.", 4) == 0)
4810
    {
4811
      sec = ".sbss2";
4812
      *group = p + 3;
4813
    }
4814
4815
  if (sec)
4816
    *section = sec;
4817
4818
  return sec;
4819
}
4820
4714
void
4821
void
4715
default_elf_asm_named_section (const char *name, unsigned int flags)
4822
default_elf_asm_named_section (const char *name, unsigned int flags)
4716
{
4823
{
4717
  char flagchars[10], *f = flagchars;
4824
  char flagchars[10], *f = flagchars;
4825
  const char *section_name = NULL, *group_name = NULL;
4718
4826
4827
#if !HAVE_GAS_COMDAT_GROUP
4719
  if (! named_section_first_declaration (name))
4828
  if (! named_section_first_declaration (name))
4720
    {
4829
    {
4721
      fprintf (asm_out_file, "\t.section\t%s\n", name);
4830
      fprintf (asm_out_file, "\t.section\t%s\n", name);
4722
      return;
4831
      return;
4723
    }
4832
    }
4833
#endif
4724
4834
4725
  if (!(flags & SECTION_DEBUG))
4835
  if (!(flags & SECTION_DEBUG))
4726
    *f++ = 'a';
4836
    *f++ = 'a';
Lines 4736-4744 default_elf_asm_named_section (const cha Link Here
4736
    *f++ = 'S';
4846
    *f++ = 'S';
4737
  if (flags & SECTION_TLS)
4847
  if (flags & SECTION_TLS)
4738
    *f++ = 'T';
4848
    *f++ = 'T';
4849
#if HAVE_GAS_COMDAT_GROUP
4850
  if (elf_comdat_group (name, &section_name, &group_name))
4851
    *f++ = 'G';
4852
#endif
4739
  *f = '\0';
4853
  *f = '\0';
4740
4854
4741
  fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
4855
  if (section_name)
4856
    fprintf (asm_out_file, "\t.section\t%s,\"%s\"", section_name,
4857
	     flagchars);
4858
  else
4859
    fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
4742
4860
4743
  if (!(flags & SECTION_NOTYPE))
4861
  if (!(flags & SECTION_NOTYPE))
4744
    {
4862
    {
Lines 4754-4759 default_elf_asm_named_section (const cha Link Here
4754
      if (flags & SECTION_ENTSIZE)
4872
      if (flags & SECTION_ENTSIZE)
4755
	fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
4873
	fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
4756
    }
4874
    }
4875
4876
  if (group_name)
4877
    fprintf (asm_out_file, ",%s,comdat", group_name);
4757
4878
4758
  putc ('\n', asm_out_file);
4879
  putc ('\n', asm_out_file);
4759
}
4880
}

Return to bug 16625