Bug 206381 - gnu/lib/libgcc builds without debug info
Summary: gnu/lib/libgcc builds without debug info
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: gnu (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-18 21:08 UTC by Ed Maste
Modified: 2017-11-04 21:13 UTC (History)
2 users (show)

See Also:
emaste: mfc-stable10+
emaste: mfc-stable9-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer freebsd_triage 2016-01-18 21:08:21 UTC
For at least 20 years gnu/lib/libgcc/Makefile has included its own set of make rules rather than using share/mk/bsd.lib.mk. As a result it's excluded from common DEBUG_FLAGS / WITH_DEBUG_FILES handling and does not get built with debug info.
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-01-19 03:55:33 UTC
A commit references this bug:

Author: emaste
Date: Tue Jan 19 03:54:38 UTC 2016
New revision: 294308
URL: https://svnweb.freebsd.org/changeset/base/294308

Log:
  Remove local override for .cpp.So rule

  The standard bsd.lib.mk rule is suitable for libgcc_s's C++ source.

  The local rule had the following non-functional argument differences
  or additions:

  1. -DSHARED (rather than -DPIC from bsd.lib.mk)

     The C++ sources don't have an #ifdef for either one.

  2. -fexceptions

     This is enabled by default for C++ so does not need to be set
     explicitly.

  3. -D__GLIBC__=3

     Not used by LLVM libunwind.

  4. -DElfW=__ElfN

     LLVM libunwind provides its own definition.

  PR:		206381
  Differential Revision:	The FreeBSD Foundation

Changes:
  head/gnu/lib/libgcc/Makefile
Comment 2 Ed Maste freebsd_committer freebsd_triage 2016-01-19 04:00:22 UTC
Comparing the C++ build rules, the only functional differences between the current Makefile and bsd.lib.mk are the addition of -fvisibility=hidden and -fPIC in the .o and .po rules. (Other differences have no effect on the LLVM libunwind C++ source, and differences in the .cpp.So rule were entirely non-functional.)
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-01-19 17:41:01 UTC
A commit references this bug:

Author: emaste
Date: Tue Jan 19 17:40:29 UTC 2016
New revision: 294331
URL: https://svnweb.freebsd.org/changeset/base/294331

Log:
  Remove local override for .cpp.o and .cpp.po rules

  The local build rule used to set -fvisibility=hidden and -fPIC, in
  addition to -fexceptions and -D defines that had no effect.

  With -fvisibility=hidden and -fPIC in STATIC_CXXFLAGS the standard
  bsd.lib.mk rules are suitable for libgcc_s's C++ source.

  PR:		206381
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/gnu/lib/libgcc/Makefile
Comment 4 Ed Maste freebsd_committer freebsd_triage 2016-01-19 18:04:04 UTC
This is fixed for the C++ stack unwinder source by using the standard bsd.lib.mk rules, in r294308 and r294331.

For the C source in libgcc_s.so it's a bit awkward as libgcc's Makefile overrides the standard .c.o, .c.po, .c.So rules for each libgcc source file. I suspect the path to addressing this will be to just handle WITH_DEBUG_FILES in gnu/lib/libgcc/Makefile directly.
Comment 5 Ed Maste freebsd_committer freebsd_triage 2016-01-27 20:34:26 UTC
kan fixed the C source in r294935
https://svnweb.freebsd.org/changeset/base/294935
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-05-20 19:06:33 UTC
A commit references this bug:

Author: emaste
Date: Fri May 20 19:05:33 UTC 2016
New revision: 300321
URL: https://svnweb.freebsd.org/changeset/base/300321

Log:
  MFC r294935 (kan): Make .debug file for libgcc_s.so.1 more useful.

  The files compiled into libgcc_s.so.1 did not have -g on
  compiler command line, making generated .debug quite
  pointless.

  PR:		206381

Changes:
_U  stable/10/
  stable/10/gnu/lib/libgcc/Makefile
Comment 7 Pedro F. Giffuni freebsd_committer freebsd_triage 2017-11-04 21:13:51 UTC
Move to GNU.
Appears to be fixed up to 10.x already.