Opened 10 months ago

Closed 9 months ago

#14894 closed bug (fixed)

HEAD fails to build with -g1

Reported by: niteria Owned by:
Priority: normal Milestone: 8.4.2
Component: Compiler Version: 8.5
Keywords: Cc: simonmar, bgamari
Operating System: Unknown/Multiple Architecture: x86_64 (amd64)
Type of failure: Debugging information is incorrect Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by niteria)

I wanted to see how -g1 vs -g2 impact compile speed. Unfortunately I get linking errors trying to build GHC with -g1.

Steps:

  1. Add:
GhcLibHcOpts += -g1
GhcRtsHcOpts += -g1

to mk/build.mk. I used devel2 flavor.

  1. ./boot && ./configure && make -j
  1. Observe failure

The failure (trimmed):

/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x1c94): error: undefined refe
rence to '.LcbG2_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x1cc7): error: undefined refe
rence to '.LcbGL_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x1cfa): error: undefined refe
rence to '.LcbI0_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x1d2d): error: undefined refe
rence to '.LcbIh_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x21a4): error: undefined refe
rence to '.LcbSn_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x21d1): error: undefined refe
rence to '.LcbTc_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x234f): error: undefined refe
rence to '.Lcc18_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2c76): error: undefined refe
rence to '.Lccmj_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2dff): error: undefined refe
rence to '.LccsV_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2e2f): error: undefined refe
rence to '.Lcct6_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2f38): error: undefined refe
rence to '.Lccv1_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2f66): error: undefined refe
rence to '.Lccve_die'

Change History (6)

comment:1 Changed 10 months ago by niteria

Description: modified (diff)

comment:2 Changed 10 months ago by niteria

Description: modified (diff)

comment:3 Changed 10 months ago by niteria

Actually, building GHC is overkill. This reproduces on many tests when -g1 is used.

For example:

=====> simplCore.oneShot(optasm) 1 of 1 [0, 0, 0]
cd "./prog003/simplCore.oneShot.run" &&  "/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-validate/inplace/test   spaces/ghc-stage2" --make -o simplCore.oneShot OneShot2 -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -g1 -dno-debug-output  -O -fasm -v0
Compile failed (exit code 1) errors were:
OneShot2.o(.debug_info+0x1bb): error: undefined reference to '.Lc5rU_die'
OneShot2.o(.debug_info+0x1e3): error: undefined reference to '.Lc5rU_die'
OneShot2.o(.debug_info+0x291): error: undefined reference to '.Lc5w8_die'
OneShot2.o(.debug_info+0x2b9): error: undefined reference to '.Lc5wf_die'
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

*** unexpected failure for simplCore.oneShot(optasm)

comment:4 Changed 10 months ago by bgamari

Oh dear; we should add a test to ensure that at least "hello world" is compiled with -g when the testsuite is run.

comment:5 Changed 9 months ago by Ben Gamari <ben@…>

In 0cbb13b3/ghc:

Don't refer to blocks in debug info when -g1

-g1 removes block information, but it turns out that procs can
refer to block information through parents.
Note [Splitting DebugBlocks] explains the parentage relationship.

Test Plan:
* ./validate
* added a new test

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14894

Differential Revision: https://phabricator.haskell.org/D4496

comment:6 Changed 9 months ago by bgamari

Milestone: 8.4.2
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.