Bug 248701

Summary: devel/binutils: Fails to link: ld: error: duplicate symbol: program_name
Product: Ports & Packages Reporter: O. Hartmann <ohartmann>
Component: Individual Port(s)Assignee: Baptiste Daroussin <bapt>
Status: Closed FIXED    
Severity: Affects Many People CC: dim, kbowling, zeising
Priority: --- Keywords: needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (bapt)
koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 248756    
Attachments:
Description Flags
fix binutils build with -fno-common zeising: maintainer-approval?

Description O. Hartmann 2020-08-17 13:22:58 UTC
On recent CURRENT (FreeBSD 13.0-CURRENT #15 r364297: Mon Aug 17 14:39:06 CEST 2020 amd64), rebuilding of port devel/binutils fails to build with a linker error shown below:
[...]
/bin/sh ./libtool  --tag=CC   --mode=link cc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow  -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing   -fstack-protector-strong  -o coffdump coffdump.o coffgrok.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a /usr/local/lib/libintl.so -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib
libtool: link: cc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fstack-protector-strong -o coffdump coffdump.o coffgrok.o bucomm.o version.o filemode.o /usr/local/lib/libintl.so -Wl,-rpath -Wl,/usr/local/lib  ../bfd/.libs/libbfd.a -L/usr/local/lib -lz ../libiberty/libiberty.a
ld: error: duplicate symbol: program_name
>>> defined at coffdump.c
>>>            coffdump.o:(program_name)
>>> defined at bucomm.c
>>>            bucomm.o:(.bss+0x0)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[6]: *** [Makefile:891: coffdump] Error 1
Comment 1 Niclas Zeising freebsd_committer freebsd_triage 2020-08-18 15:12:35 UTC
Created attachment 217313 [details]
fix binutils build with -fno-common

O. Hartmann, can you try this patch for binutils?  It works for me.

bapt, does this look OK to commit?
Comment 2 Niclas Zeising freebsd_committer freebsd_triage 2020-08-18 23:31:26 UTC
*** Bug 248735 has been marked as a duplicate of this bug. ***
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-08-19 17:11:07 UTC
A commit references this bug:

Author: zeising
Date: Wed Aug 19 17:11:00 UTC 2020
New revision: 545440
URL: https://svnweb.freebsd.org/changeset/ports/545440

Log:
  devel/binutils: fix build with -fno-common

  Add a patch from upstream to fix the build of devel/binutils when compiled
  with -fno-common, which is the default with llvm 11.

  PR:		248701
  MFH:		2020Q3

Changes:
  head/devel/binutils/files/patch-0b398d6.diff
Comment 4 Niclas Zeising freebsd_committer freebsd_triage 2020-08-19 17:12:57 UTC
Committed.

Without fixing binutils, a lot of the ports tree was failing.
Comment 5 commit-hook freebsd_committer freebsd_triage 2020-08-20 19:23:42 UTC
A commit references this bug:

Author: zeising
Date: Thu Aug 20 19:23:31 UTC 2020
New revision: 545552
URL: https://svnweb.freebsd.org/changeset/ports/545552

Log:
  MFH: r545440

  devel/binutils: fix build with -fno-common

  Add a patch from upstream to fix the build of devel/binutils when compiled
  with -fno-common, which is the default with llvm 11.

  PR:		248701

  Approved by:	ports-secteam (joenum)

Changes:
_U  branches/2020Q3/
  branches/2020Q3/devel/binutils/files/patch-0b398d6.diff
Comment 6 Niclas Zeising freebsd_committer freebsd_triage 2020-08-20 21:01:57 UTC
All done and merged.