Bug 10178

Summary: valgrind doesn't work when linked with gold instead of ld
Product: binutils Reporter: dank
Component: goldAssignee: Ian Lance Taylor <ian>
Status: RESOLVED WONTFIX    
Severity: normal CC: bug-binutils
Priority: P2    
Version: 2.19   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description dank 2009-05-20 20:08:46 UTC
I filed this as a valgrind bug:
https://bugs.kde.org/show_bug.cgi?id=193413
but figured it was worth mentioning here, too.

Any version of valgrind (e.g. the latest release, or from svn)
fails with a message like
  valgrind: mmap(0x8048000, 90112) failed in UME with error 22 (Invalid
argument).
  valgrind: this can be caused by executables with very large text, data or bss
segments.
if valgrind was linked using gold instead of ld.

This happens very quickly, before any other output, and happens even with 
--tool=none.  No other output is shown even with -v.

This was on Ubuntu Hardy on plain old intel hardware.
Comment 1 dank 2009-05-20 20:09:54 UTC
This was with gold built from the binutils-2.19.1 source tarball.
Comment 2 Ian Lance Taylor 2009-06-24 20:42:59 UTC
The core issue is that valgrind runs the linker with --verbose to extract the
linker script.  It then seds the linker script to adjust the start address of
the text segment.  This works OK with the GNU linker, but it fails with gold,
since gold does not have a default linker script.

With gold it ought to work to simply use the -Ttext option.

In any case, gold will never have a default linker script, so this is not
something that can be fixed in gold.