Bug 10178 - valgrind doesn't work when linked with gold instead of ld
Summary: valgrind doesn't work when linked with gold instead of ld
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
Depends on:
Reported: 2009-05-20 20:08 UTC by dank
Modified: 2009-06-24 20:42 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description dank 2009-05-20 20:08:46 UTC
I filed this as a valgrind bug:
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
  valgrind: this can be caused by executables with very large text, data or bss
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.