public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27950]  New: [4.2 regression] undefined reference when compiling valgrind 3.2.0
@ 2006-06-08  9:47 gcc at pdoerfler dot com
  2006-06-08 11:32 ` [Bug c/27950] " gcc at pdoerfler dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gcc at pdoerfler dot com @ 2006-06-08  9:47 UTC (permalink / raw)
  To: gcc-bugs

if /usr/local/4.2/bin/gcc4.2.0 -DHAVE_CONFIG_H -I. -I. -I..  -I../include
-I../VEX/pub -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1   -m32
-mpreferred-stack-boundary=2 -O -g -Wmissing-prototypes -Winline -Wall -Wshadow
-Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -O2 -Wno-long-long
-Wno-pointer-sign -Wdeclaration-after-statement -save-temps -v -MT
memcheck_x86_linux-mc_main.o -MD -MP -MF ".deps/memcheck_x86_linux-mc_main.Tpo"
-c -o memcheck_x86_linux-mc_main.o `test -f 'mc_main.c' || echo './'`mc_main.c;
\
then mv -f ".deps/memcheck_x86_linux-mc_main.Tpo"
".deps/memcheck_x86_linux-mc_main.Po"; else rm -f
".deps/memcheck_x86_linux-mc_main.Tpo"; exit 1; fi
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2-svn/configure --enable-languages=c,c++
--prefix=/usr/local/4.2 --program-suffix=4.2.0
Thread model: posix
gcc version 4.2.0 20060603 (experimental)
 /usr/local/4.2/libexec/gcc/i686-pc-linux-gnu/4.2.0/cc1 -E -quiet -v -I. -I.
-I.. -I../include -I../VEX/pub -MD memcheck_x86_linux-mc_main.d -MF
.deps/memcheck_x86_linux-mc_main.Tpo -MP -MT memcheck_x86_linux-mc_main.o -MQ
memcheck_x86_linux-mc_main.o -DHAVE_CONFIG_H -DVGA_x86=1 -DVGO_linux=1
-DVGP_x86_linux=1 mc_main.c -m32 -mpreferred-stack-boundary=2 -mtune=generic
-Wmissing-prototypes -Winline -Wall -Wshadow -Wpointer-arith
-Wstrict-prototypes -Wmissing-declarations -Wno-long-long -Wno-pointer-sign
-Wdeclaration-after-statement -fworking-directory -O -O2 -fpch-preprocess -o
mc_main.i
ignoring nonexistent directory
"/usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../i686-pc-linux-gnu/include"
ignoring duplicate directory "."
#include "..." search starts here:
#include <...> search starts here:
 .
 ..
 ../include
 ../VEX/pub
 /usr/local/include
 /usr/local/4.2/include
 /usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0/include
 /usr/include
End of search list.
 /usr/local/4.2/libexec/gcc/i686-pc-linux-gnu/4.2.0/cc1 -fpreprocessed
mc_main.i -quiet -dumpbase mc_main.c -m32 -mpreferred-stack-boundary=2
-mtune=generic -auxbase-strip memcheck_x86_linux-mc_main.o -g -O -O2
-Wmissing-prototypes -Winline -Wall -Wshadow -Wpointer-arith
-Wstrict-prototypes -Wmissing-declarations -Wno-long-long -Wno-pointer-sign
-Wdeclaration-after-statement -version -o mc_main.s
GNU C version 4.2.0 20060603 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.2.0 20060603 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: a42b76558fd6d6863486421b7e5252eb
 as -V -Qy -o memcheck_x86_linux-mc_main.o mc_main.s
GNU assembler version 2.16.91.0.2 (i586-suse-linux) using BFD version
2.16.91.0.2 20050720 (SuSE Linux)
/usr/local/4.2/bin/gcc4.2.0  -Wno-long-long -Wno-pointer-sign
-Wdeclaration-after-statement -save-temps -v   -o memcheck-x86-linux -static
-Wl,-defsym,valt_load_address=0x38000000 -nodefaultlibs -nostartfiles -u _start
-m32 -Wl,-T,../valt_load_address_x86_linux.lds
memcheck_x86_linux-mc_leakcheck.o memcheck_x86_linux-mc_malloc_wrappers.o
memcheck_x86_linux-mc_main.o memcheck_x86_linux-mc_translate.o
../coregrind/libcoregrind_x86_linux.a ../VEX/libvex_x86_linux.a -lgcc
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2-svn/configure --enable-languages=c,c++
--prefix=/usr/local/4.2 --program-suffix=4.2.0
Thread model: posix
gcc version 4.2.0 20060603 (experimental)
 /usr/local/4.2/libexec/gcc/i686-pc-linux-gnu/4.2.0/collect2 -m elf_i386
-static -o memcheck-x86-linux -u _start
-L/usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0
-L/usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0/../../.. -defsym
valt_load_address=0x38000000 -T ../valt_load_address_x86_linux.lds
memcheck_x86_linux-mc_leakcheck.o memcheck_x86_linux-mc_malloc_wrappers.o
memcheck_x86_linux-mc_main.o memcheck_x86_linux-mc_translate.o
../coregrind/libcoregrind_x86_linux.a ../VEX/libvex_x86_linux.a -lgcc
memcheck_x86_linux-mc_main.o:(.debug_info+0x9d50): undefined reference to
`hacky_auxmaps'
collect2: ld returned 1 exit status


-- 
           Summary: [4.2 regression] undefined reference when compiling
                    valgrind 3.2.0
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at pdoerfler dot com
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c/27950] [4.2 regression] undefined reference when compiling valgrind 3.2.0
  2006-06-08  9:47 [Bug c/27950] New: [4.2 regression] undefined reference when compiling valgrind 3.2.0 gcc at pdoerfler dot com
@ 2006-06-08 11:32 ` gcc at pdoerfler dot com
  2006-06-08 14:46 ` [Bug middle-end/27950] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gcc at pdoerfler dot com @ 2006-06-08 11:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from gcc at pdoerfler dot com  2006-06-08 11:00 -------
Created an attachment (id=11633)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11633&action=view)
preprocessed source

Preprocessed source of the file that contains declaration of hacky_auxmaps.
Probably, this is not enough to reproduce the failure.

valgrind-3.2.0 is available from valgrind.org

./configure
make
to reproduce at least on x86


-- 


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


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

* [Bug middle-end/27950] [4.2 regression] undefined reference when compiling valgrind 3.2.0
  2006-06-08  9:47 [Bug c/27950] New: [4.2 regression] undefined reference when compiling valgrind 3.2.0 gcc at pdoerfler dot com
  2006-06-08 11:32 ` [Bug c/27950] " gcc at pdoerfler dot com
@ 2006-06-08 14:46 ` pinskia at gcc dot gnu dot org
  2006-06-23 18:32 ` seongbae dot park at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-08 14:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-06-08 14:42 -------
Related to PR 27657, though this is not an unused variable as far as I can
tell.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |27657
          Component|c                           |middle-end
           Keywords|                            |link-failure
   Target Milestone|---                         |4.2.0


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


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

* [Bug middle-end/27950] [4.2 regression] undefined reference when compiling valgrind 3.2.0
  2006-06-08  9:47 [Bug c/27950] New: [4.2 regression] undefined reference when compiling valgrind 3.2.0 gcc at pdoerfler dot com
  2006-06-08 11:32 ` [Bug c/27950] " gcc at pdoerfler dot com
  2006-06-08 14:46 ` [Bug middle-end/27950] " pinskia at gcc dot gnu dot org
@ 2006-06-23 18:32 ` seongbae dot park at gmail dot com
  2006-06-23 18:44 ` seongbae dot park at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: seongbae dot park at gmail dot com @ 2006-06-23 18:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from seongbae dot park at gmail dot com  2006-06-23 18:26 -------
I'm able to reproduce the problem with 4.2.0 on linux/x86.

valgrind-3.2.0/memcheck/mc_main.c has 

    359 static AuxMapEnt  hacky_auxmaps[N_AUXMAPS];
...
    362 static AuxMapEnt* auxmap      = &hacky_auxmaps[0];

There's no direct use of hacky_auxmaps except through auxmap.

Anyway, 4.2 leaves the relocation:

# readelf -s ./bad.o | grep aux
   323: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND hacky_auxmaps
# readelf -r ./bad.o | grep aux
00009c87  00014301 R_386_32          00000000   hacky_auxmaps
#

which obviously can not be resolved. 
The bad relocation is in .rel.debug_info section.

I'll try to trace back why the bad relocation is generated.


-- 


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


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

* [Bug middle-end/27950] [4.2 regression] undefined reference when compiling valgrind 3.2.0
  2006-06-08  9:47 [Bug c/27950] New: [4.2 regression] undefined reference when compiling valgrind 3.2.0 gcc at pdoerfler dot com
                   ` (2 preceding siblings ...)
  2006-06-23 18:32 ` seongbae dot park at gmail dot com
@ 2006-06-23 18:44 ` seongbae dot park at gmail dot com
  2006-06-23 23:59 ` seongbae dot park at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: seongbae dot park at gmail dot com @ 2006-06-23 18:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from seongbae dot park at gmail dot com  2006-06-23 18:43 -------
The problem is causedby the extra DW_AT_const_value.
4.1.0 generates the following dwarf entry for auxmap:

 <1><a30c>: Abbrev Number: 31 (DW_TAG_variable)
     DW_AT_name        : (indirect string, offset: 0x35e): auxmap
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 362
     DW_AT_type        : <a318>
 <1><a318>: Abbrev Number: 26 (DW_TAG_const_type)

whereas 4.2.0 generates:
 <1><9c6e>: Abbrev Number: 70 (DW_TAG_variable)
     DW_AT_name        : (indirect string, offset: 0x16dd): auxmap_used
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 361
     DW_AT_type        : <9c69>
     DW_AT_const_value : 0

and the bad relocation is the value of DW_AT_const_value.
In the asembly:
        .uleb128 0x48
        .long   .LASF367
        .byte   0x1
        .value  0x16a
        .long   0x9c8b
        .long   hacky_auxmaps
        .uleb128 0x1b

Looks like the new feature to note the constant value of a symbol 
(auxmap is initialized to &hacky_auxmaps[0] as shown above)
causes the relocation to be left against a static symbol.


-- 

seongbae dot park at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |seongbae dot park at gmail
                   |                            |dot com


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


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

* [Bug middle-end/27950] [4.2 regression] undefined reference when compiling valgrind 3.2.0
  2006-06-08  9:47 [Bug c/27950] New: [4.2 regression] undefined reference when compiling valgrind 3.2.0 gcc at pdoerfler dot com
                   ` (3 preceding siblings ...)
  2006-06-23 18:44 ` seongbae dot park at gmail dot com
@ 2006-06-23 23:59 ` seongbae dot park at gmail dot com
  2006-06-26  0:24 ` steven at gcc dot gnu dot org
  2006-06-29 19:22 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: seongbae dot park at gmail dot com @ 2006-06-23 23:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from seongbae dot park at gmail dot com  2006-06-23 23:55 -------
Looks like this indeed is a duplicate of 27657.

In toplev.c:
   1013   cgraph_varpool_assemble_pending_decls ();
...
   1040   (*debug_hooks->finish) (main_input_filename);

dwarf2 finish ends up calling final.c:output_address w/ SYMREF to hacky_auxmap,
which calls mark_decl_referenced() for hacky_auxmap declaration
and is added to the pending list of varpool decls to be emitted.
However, there's no call to cgraph_varpool_assemble_pending_decls() 
so even though hacky_auxmap is marked as needed, it won't get output.

Calling 
cgraph_varpool_assemble_pending_decls() 
after debug hook finish can alleviate the linking problem
by forcing the emission of hacky_auxmap (which seems 
unused except for debug information purpose,
after uncalled static function elimination).

However, the real cause is having const value marking for an unused 
(and hence removed) static variable - gcc seems to determine
that auxmap is not used, after some removal of unused static functions
and the analysis looks correct (though I didn't try hard to verify that).


-- 


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


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

* [Bug middle-end/27950] [4.2 regression] undefined reference when compiling valgrind 3.2.0
  2006-06-08  9:47 [Bug c/27950] New: [4.2 regression] undefined reference when compiling valgrind 3.2.0 gcc at pdoerfler dot com
                   ` (4 preceding siblings ...)
  2006-06-23 23:59 ` seongbae dot park at gmail dot com
@ 2006-06-26  0:24 ` steven at gcc dot gnu dot org
  2006-06-29 19:22 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-06-26  0:24 UTC (permalink / raw)
  To: gcc-bugs



-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-06-25 23:05:26
               date|                            |


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


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

* [Bug middle-end/27950] [4.2 regression] undefined reference when compiling valgrind 3.2.0
  2006-06-08  9:47 [Bug c/27950] New: [4.2 regression] undefined reference when compiling valgrind 3.2.0 gcc at pdoerfler dot com
                   ` (5 preceding siblings ...)
  2006-06-26  0:24 ` steven at gcc dot gnu dot org
@ 2006-06-29 19:22 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-29 19:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-06-29 19:21 -------
I just looked more into this and this is a dup of bug 27657.

*** This bug has been marked as a duplicate of 27657 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2006-06-29 19:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-08  9:47 [Bug c/27950] New: [4.2 regression] undefined reference when compiling valgrind 3.2.0 gcc at pdoerfler dot com
2006-06-08 11:32 ` [Bug c/27950] " gcc at pdoerfler dot com
2006-06-08 14:46 ` [Bug middle-end/27950] " pinskia at gcc dot gnu dot org
2006-06-23 18:32 ` seongbae dot park at gmail dot com
2006-06-23 18:44 ` seongbae dot park at gmail dot com
2006-06-23 23:59 ` seongbae dot park at gmail dot com
2006-06-26  0:24 ` steven at gcc dot gnu dot org
2006-06-29 19:22 ` pinskia at gcc dot gnu dot org

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).