http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55033



--- Comment #2 from Sebastian Huber <sebastian.hu...@embedded-brains.de> 
2012-10-23 15:03:37 UTC ---

#0  default_elf_select_section (decl=0x7ffff72b92d0, reloc=0, align=32) at

/home/sh/archive/gcc-git/gcc/varasm.c:6251

#1  0x0000000000c57d4e in get_constant_section (align=<optimized out>,

exp=0x7ffff72b92d0) at /home/sh/archive/gcc-git/gcc/varasm.c:3021

#2  build_constant_desc (exp=0x7ffff72b92d0) at

/home/sh/archive/gcc-git/gcc/varasm.c:3091

#3  0x0000000000c5c3f0 in tree_output_constant_def (exp=0x7ffff72b92d0) at

/home/sh/archive/gcc-git/gcc/varasm.c:3282

#4  0x00000000008fe0a4 in gimplify_init_constructor (expr_p=0x7fffffffd108,

pre_p=0x7fffffffd2e8, post_p=0x7fffffffd088, want_value=false,

notify_temp_creation=false) at /home/sh/archive/gcc-git/gcc/gimplify.c:4085

#5  0x00000000008feb16 in gimplify_modify_expr_rhs (expr_p=0x7fffffffd108,

from_p=0x7ffff68ed110, to_p=0x7ffff68ed108, pre_p=0x7fffffffd2e8,

post_p=0x7fffffffd088, want_value=false) at

/home/sh/archive/gcc-git/gcc/gimplify.c:4530

#6  0x00000000009010ef in gimplify_modify_expr (want_value=false,

post_p=0x7fffffffd088, pre_p=0x7fffffffd2e8, expr_p=0x7fffffffd108) at

/home/sh/archive/gcc-git/gcc/gimplify.c:4840

#7  gimplify_expr (expr_p=0x7fffffffd108, pre_p=0x7fffffffd2e8,

post_p=0x7fffffffd088, gimple_test_f=0x8f7b70 <is_gimple_stmt(tree)>,

fallback=0) at /home/sh/archive/gcc-git/gcc/gimplify.c:7167

#8  0x0000000000907429 in gimplify_stmt (stmt_p=<optimized out>,

seq_p=0x7fffffffd2e8) at /home/sh/archive/gcc-git/gcc/gimplify.c:5700

#9  0x0000000000908fe3 in gimplify_and_add (t=0x7ffff68ed0f0, seq_p=<optimized

out>) at /home/sh/archive/gcc-git/gcc/gimplify.c:371

#10 0x000000000090a0c0 in gimplify_decl_expr (stmt_p=<optimized out>,

seq_p=0x7fffffffd2e8) at /home/sh/archive/gcc-git/gcc/gimplify.c:1484

#11 0x00000000008ffcd1 in gimplify_expr (expr_p=0x7ffff68bebf8,

pre_p=0x7fffffffd2e8, post_p=0x7fffffffd228, gimple_test_f=0x8f7b70

<is_gimple_stmt(tree)>, fallback=0) at

/home/sh/archive/gcc-git/gcc/gimplify.c:7334

#12 0x0000000000907429 in gimplify_stmt (stmt_p=<optimized out>,

seq_p=0x7fffffffd2e8) at /home/sh/archive/gcc-git/gcc/gimplify.c:5700

#13 0x0000000000908c88 in gimplify_cleanup_point_expr (expr_p=0x7ffff72b93d0,

pre_p=0x7fffffffd5e8) at /home/sh/archive/gcc-git/gcc/gimplify.c:5477

#14 0x00000000008ffa71 in gimplify_expr (expr_p=0x7ffff72b93d0,

pre_p=0x7fffffffd5e8, post_p=0x7fffffffd408, gimple_test_f=0x8f7b70

<is_gimple_stmt(tree)>, fallback=0) at

/home/sh/archive/gcc-git/gcc/gimplify.c:7504

#15 0x0000000000907429 in gimplify_stmt (stmt_p=<optimized out>,

seq_p=0x7fffffffd5e8) at /home/sh/archive/gcc-git/gcc/gimplify.c:5700

#16 0x00000000008ff98c in gimplify_statement_list (pre_p=0x7fffffffd5e8,

expr_p=0x7ffff656d8f0) at /home/sh/archive/gcc-git/gcc/gimplify.c:1537

#17 gimplify_expr (expr_p=0x7ffff656d8f0, pre_p=0x7fffffffd5e8,

post_p=0x7fffffffd558, gimple_test_f=0x8f7b70 <is_gimple_stmt(tree)>,

fallback=0) at /home/sh/archive/gcc-git/gcc/gimplify.c:7556

#18 0x0000000000907429 in gimplify_stmt (stmt_p=<optimized out>,

seq_p=0x7fffffffd5e8) at /home/sh/archive/gcc-git/gcc/gimplify.c:5700

#19 0x0000000000908316 in gimplify_bind_expr (expr_p=0x7ffff62f2b98,

pre_p=0x7fffffffd7f8) at /home/sh/archive/gcc-git/gcc/gimplify.c:1230

#20 0x0000000000900787 in gimplify_expr (expr_p=0x7ffff62f2b98,

pre_p=0x7fffffffd7f8, post_p=0x7fffffffd718, gimple_test_f=0x8f7b70

<is_gimple_stmt(tree)>, fallback=0) at

/home/sh/archive/gcc-git/gcc/gimplify.c:7338

#21 0x0000000000907429 in gimplify_stmt (stmt_p=<optimized out>,

seq_p=0x7fffffffd7f8) at /home/sh/archive/gcc-git/gcc/gimplify.c:5700

#22 0x0000000000907522 in gimplify_body (fndecl=0x7ffff62f2b00, do_parms=true)

at /home/sh/archive/gcc-git/gcc/gimplify.c:8203

#23 0x0000000000907a16 in gimplify_function_tree (fndecl=0x7ffff62f2b00) at

/home/sh/archive/gcc-git/gcc/gimplify.c:8337

#24 0x00000000007adc98 in cgraph_analyze_function (node=0x7ffff679f6f0) at

/home/sh/archive/gcc-git/gcc/cgraphunit.c:643

#25 0x00000000007b0ad7 in cgraph_analyze_functions () at

/home/sh/archive/gcc-git/gcc/cgraphunit.c:928

#26 0x00000000007b1991 in finalize_compilation_unit () at

/home/sh/archive/gcc-git/gcc/cgraphunit.c:2071

#27 0x00000000005d46cc in cp_write_global_declarations () at

/home/sh/archive/gcc-git/gcc/cp/decl2.c:4286

#28 0x0000000000a55b8d in compile_file () at

/home/sh/archive/gcc-git/gcc/toplev.c:560

#29 0x0000000000a577f2 in do_compile () at

/home/sh/archive/gcc-git/gcc/toplev.c:1866

#30 toplev_main (argc=18, argv=0x7fffffffdb28) at

/home/sh/archive/gcc-git/gcc/toplev.c:1942

#31 0x00007ffff761223d in __libc_start_main () from /lib64/libc.so.6

#32 0x00000000004ebbcd in _start () at ../sysdeps/x86_64/elf/start.S:113



The problem is that something in GCC calls default_elf_select_section(decl,

reloc, align) with categorize_decl_for_section(decl, reloc) == SECCAT_SRODATA. 

This in turn calls get_named_section (decl=0x0 == NULL_TREE, name=0x101b0bc

".sdata2", reloc=0) which leads to (gcc/varasm.c):



[...]

unsigned int

default_section_type_flags (tree decl, const char *name, int reloc)

{

  unsigned int flags;



  if (decl && TREE_CODE (decl) == FUNCTION_DECL)

    flags = SECTION_CODE;

  else if (decl)

    {

      enum section_category category

    = categorize_decl_for_section (decl, reloc);

      if (decl_readonly_section_1 (category))

    flags = 0;

      else if (category == SECCAT_DATA_REL_RO

           || category == SECCAT_DATA_REL_RO_LOCAL)

    flags = SECTION_WRITE | SECTION_RELRO;

      else

    flags = SECTION_WRITE;

    }

  else

    {

      flags = SECTION_WRITE;

      if (strcmp (name, ".data.rel.ro") == 0

      || strcmp (name, ".data.rel.ro.local") == 0)

    flags |= SECTION_RELRO;

    }

[...]



Now we have SECTION_WRITE set in flags (this is quite wrong for SECCAT_SRODATA

from my point of view).  Which leads to the section type conflict in the next

call to get_section (name=0x101b0bc ".sdata2", flags=0, decl=0x7ffff65795f0).

Reply via email to