NetBSD Problem Report #55594

From www@netbsd.org  Thu Aug 20 07:49:01 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 705111A923D
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 20 Aug 2020 07:49:01 +0000 (UTC)
Message-Id: <20200820074900.35BD91A923E@mollari.NetBSD.org>
Date: Thu, 20 Aug 2020 07:49:00 +0000 (UTC)
From: rajeev_v_pillai@yahoo.com
Reply-To: rajeev_v_pillai@yahoo.com
To: gnats-bugs@NetBSD.org
Subject: Error creating shared library using gcc-7.5.0 on NetBSD 9.0_STABLE
X-Send-Pr-Version: www-1.0

>Number:         55594
>Category:       toolchain
>Synopsis:       Error creating shared library using gcc-7.5.0 on NetBSD 9.0_STABLE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 20 07:50:00 +0000 2020
>Closed-Date:    Thu Aug 20 11:23:56 +0000 2020
>Last-Modified:  Thu Aug 27 05:40:01 +0000 2020
>Originator:     Rajeev Pillai
>Release:        NetBSD 9.0_STABLE
>Organization:
>Environment:
NetBSD x202e.localdomain 9.0_STABLE NetBSD 9.0_STABLE (GENERIC) #0: Mon Aug 17 14:38:32 UTC 2020  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
ld(1) from GCC 7.5.0 on NetBSD 9.0_STABLE (GENERIC) #0: Mon Aug 17 14:38:32 UTC 2020 fails to link a shared library (libncurses) with this error:

 ld: /usr/lib/crt0.o: in function `__start':
(.text+0x29): undefined reference to `__fini_array_start'
ld: /usr/lib/crt0.o: relocation R_X86_64_PC32 against undefined hidden symbol `__fini_array_start' can not be used when making a shared object
ld: final link failed: bad value
*** Error code 1

$ echo $CC
gcc

$ echo $CFLAGS
-Wall -O2 -flto -fpie -fstack-protector-all -fstack-protector-strong -march=native -pipe

$ echo $LDFLAGS
-pie -s

$ $CC --version
gcc (nb4 20200810) 7.5.0

>How-To-Repeat:
1. Download ncurses from https://invisible-mirror.net/archives/ncurses/current/ncurses-6.2-20200817.tgz

2. Untar, configure.
   ./configure --prefix=/opt/ncurses --with-shared

3. make
...OUTPUT ELIDED...
ld: /usr/lib/crt0.o: in function `__start':
(.text+0x29): undefined reference to `__fini_array_start'
ld: /usr/lib/crt0.o: relocation R_X86_64_PC32 against undefined hidden symbol `__fini_array_start' can not be used when making a shared object
ld: final link failed: bad value
*** Error code 1

>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Thu, 20 Aug 2020 10:53:07 +0200

 Please quote the full compiler / linker invocation that fails, and ideally
 repeat it with -v added and show full output.

 Martin

From: "Rajeev V. Pillai" <rajeev_v_pillai@yahoo.com>
To: "toolchain-manager@netbsd.org" <toolchain-manager@netbsd.org>, 
	"gnats-admin@netbsd.org" <gnats-admin@netbsd.org>, 
	"netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>, 
	"gnats-bugs@netbsd.org" <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Thu, 20 Aug 2020 10:08:37 +0000 (UTC)

  On Thursday, 20 August 2020, 14:25:05 GMT+5:30, Martin Husemann <martin@du=
 skware.de> wrote:=20

  > Please quote the full compiler / linker invocation that fails, and ideal=
 ly
  > repeat it with -v added and show full output.


 ---OUTPUT STARTS---
 linking ../lib/libncurses.so
 gcc -v -pie -s -Wall -O2 -fpie -fstack-protector-all -fstack-protector-stro=
 ng -march=3Dnative -pipe --param max-inline-insns-single=3D1200 -Wl,-shared=
  -Wl,-Bshareable -o ../lib/libncurses.so ../obj_s/hardscroll.o=C2=A0=C2=A0.=
 ./obj_s/hashmap.o=C2=A0=C2=A0../obj_s/lib_addch.o=C2=A0=C2=A0../obj_s/lib_a=
 ddstr.o=C2=A0=C2=A0../obj_s/lib_beep.o=C2=A0=C2=A0../obj_s/lib_bkgd.o=C2=A0=
 =C2=A0../obj_s/lib_box.o=C2=A0=C2=A0../obj_s/lib_chgat.o=C2=A0=C2=A0../obj_=
 s/lib_clear.o=C2=A0=C2=A0../obj_s/lib_clearok.o=C2=A0=C2=A0../obj_s/lib_clr=
 bot.o=C2=A0=C2=A0../obj_s/lib_clreol.o=C2=A0=C2=A0../obj_s/lib_color.o=C2=
 =A0=C2=A0../obj_s/lib_colorset.o=C2=A0=C2=A0../obj_s/lib_delch.o=C2=A0=C2=
 =A0../obj_s/lib_delwin.o=C2=A0=C2=A0../obj_s/lib_echo.o=C2=A0=C2=A0../obj_s=
 /lib_endwin.o=C2=A0=C2=A0../obj_s/lib_erase.o=C2=A0=C2=A0../obj_s/lib_flash=
 .o=C2=A0=C2=A0../obj_s/lib_gen.o=C2=A0=C2=A0../obj_s/lib_getch.o=C2=A0=C2=
 =A0../obj_s/lib_getstr.o=C2=A0=C2=A0../obj_s/lib_hline.o=C2=A0=C2=A0../obj_=
 s/lib_immedok.o=C2=A0=C2=A0../obj_s/lib_inchstr.o=C2=A0=C2=A0../obj_s/lib_i=
 nitscr.o=C2=A0=C2=A0../obj_s/lib_insch.o=C2=A0=C2=A0../obj_s/lib_insdel.o=
 =C2=A0=C2=A0../obj_s/lib_insnstr.o=C2=A0=C2=A0../obj_s/lib_instr.o=C2=A0=C2=
 =A0../obj_s/lib_isendwin.o=C2=A0=C2=A0../obj_s/lib_leaveok.o=C2=A0=C2=A0../=
 obj_s/lib_mouse.o=C2=A0=C2=A0../obj_s/lib_move.o=C2=A0=C2=A0../obj_s/lib_mv=
 cur.o=C2=A0=C2=A0../obj_s/lib_mvwin.o=C2=A0=C2=A0../obj_s/lib_newterm.o=C2=
 =A0=C2=A0../obj_s/lib_newwin.o=C2=A0=C2=A0../obj_s/lib_nl.o=C2=A0=C2=A0../o=
 bj_s/lib_overlay.o=C2=A0=C2=A0../obj_s/lib_pad.o=C2=A0=C2=A0../obj_s/lib_pr=
 intw.o=C2=A0=C2=A0../obj_s/lib_redrawln.o=C2=A0=C2=A0../obj_s/lib_refresh.o=
 =C2=A0=C2=A0../obj_s/lib_restart.o=C2=A0=C2=A0../obj_s/lib_scanw.o=C2=A0=C2=
 =A0../obj_s/lib_screen.o=C2=A0=C2=A0../obj_s/lib_scroll.o=C2=A0=C2=A0../obj=
 _s/lib_scrollok.o=C2=A0=C2=A0../obj_s/lib_scrreg.o=C2=A0=C2=A0../obj_s/lib_=
 set_term.o=C2=A0=C2=A0../obj_s/lib_slk.o=C2=A0=C2=A0../obj_s/lib_slkatr_set=
 .o=C2=A0=C2=A0../obj_s/lib_slkatrof.o=C2=A0=C2=A0../obj_s/lib_slkatron.o=C2=
 =A0=C2=A0../obj_s/lib_slkatrset.o=C2=A0=C2=A0../obj_s/lib_slkattr.o=C2=A0=
 =C2=A0../obj_s/lib_slkclear.o=C2=A0=C2=A0../obj_s/lib_slkcolor.o=C2=A0=C2=
 =A0../obj_s/lib_slkinit.o=C2=A0=C2=A0../obj_s/lib_slklab.o=C2=A0=C2=A0../ob=
 j_s/lib_slkrefr.o=C2=A0=C2=A0../obj_s/lib_slkset.o=C2=A0=C2=A0../obj_s/lib_=
 slktouch.o=C2=A0=C2=A0../obj_s/lib_touch.o=C2=A0=C2=A0../obj_s/lib_tstp.o=
 =C2=A0=C2=A0../obj_s/lib_ungetch.o=C2=A0=C2=A0../obj_s/lib_vidattr.o=C2=A0=
 =C2=A0../obj_s/lib_vline.o=C2=A0=C2=A0../obj_s/lib_wattroff.o=C2=A0=C2=A0..=
 /obj_s/lib_wattron.o=C2=A0=C2=A0../obj_s/lib_winch.o=C2=A0=C2=A0../obj_s/li=
 b_window.o=C2=A0=C2=A0../obj_s/nc_panel.o=C2=A0=C2=A0../obj_s/safe_sprintf.=
 o=C2=A0=C2=A0../obj_s/tty_update.o=C2=A0=C2=A0../obj_s/varargs.o=C2=A0=C2=
 =A0../obj_s/vsscanf.o=C2=A0=C2=A0../obj_s/lib_freeall.o=C2=A0=C2=A0../obj_s=
 /expanded.o=C2=A0=C2=A0../obj_s/legacy_coding.o=C2=A0=C2=A0../obj_s/lib_dft=
 _fgbg.o=C2=A0=C2=A0../obj_s/lib_print.o=C2=A0=C2=A0../obj_s/new_pair.o=C2=
 =A0=C2=A0../obj_s/resizeterm.o=C2=A0=C2=A0../obj_s/use_screen.o=C2=A0=C2=A0=
 ../obj_s/use_window.o=C2=A0=C2=A0../obj_s/wresize.o=C2=A0=C2=A0../obj_s/acc=
 ess.o=C2=A0=C2=A0../obj_s/add_tries.o=C2=A0=C2=A0../obj_s/alloc_ttype.o=C2=
 =A0=C2=A0../obj_s/codes.o=C2=A0=C2=A0../obj_s/comp_captab.o=C2=A0=C2=A0../o=
 bj_s/comp_error.o=C2=A0=C2=A0../obj_s/comp_hash.o=C2=A0=C2=A0../obj_s/comp_=
 userdefs.o=C2=A0=C2=A0../obj_s/db_iterator.o=C2=A0=C2=A0../obj_s/doalloc.o=
 =C2=A0=C2=A0../obj_s/entries.o=C2=A0=C2=A0../obj_s/fallback.o=C2=A0=C2=A0..=
 /obj_s/free_ttype.o=C2=A0=C2=A0../obj_s/getenv_num.o=C2=A0=C2=A0../obj_s/ho=
 me_terminfo.o=C2=A0=C2=A0../obj_s/init_keytry.o=C2=A0=C2=A0../obj_s/lib_acs=
 .o=C2=A0=C2=A0../obj_s/lib_baudrate.o=C2=A0=C2=A0../obj_s/lib_cur_term.o=C2=
 =A0=C2=A0../obj_s/lib_data.o=C2=A0=C2=A0../obj_s/lib_has_cap.o=C2=A0=C2=A0.=
 ./obj_s/lib_kernel.o=C2=A0=C2=A0../obj_s/lib_keyname.o=C2=A0=C2=A0../obj_s/=
 lib_longname.o=C2=A0=C2=A0../obj_s/lib_napms.o=C2=A0=C2=A0../obj_s/lib_opti=
 ons.o=C2=A0=C2=A0../obj_s/lib_raw.o=C2=A0=C2=A0../obj_s/lib_setup.o=C2=A0=
 =C2=A0../obj_s/lib_termcap.o=C2=A0=C2=A0../obj_s/lib_termname.o=C2=A0=C2=A0=
 ../obj_s/lib_tgoto.o=C2=A0=C2=A0../obj_s/lib_ti.o=C2=A0=C2=A0../obj_s/lib_t=
 parm.o=C2=A0=C2=A0../obj_s/lib_tputs.o=C2=A0=C2=A0../obj_s/lib_trace.o=C2=
 =A0=C2=A0../obj_s/lib_ttyflags.o=C2=A0=C2=A0../obj_s/lib_twait.o=C2=A0=C2=
 =A0../obj_s/name_match.o=C2=A0=C2=A0../obj_s/names.o=C2=A0=C2=A0../obj_s/ob=
 solete.o=C2=A0=C2=A0../obj_s/read_entry.o=C2=A0=C2=A0../obj_s/read_termcap.=
 o=C2=A0=C2=A0../obj_s/strings.o=C2=A0=C2=A0../obj_s/tries.o=C2=A0=C2=A0../o=
 bj_s/trim_sgr0.o=C2=A0=C2=A0../obj_s/unctrl.o=C2=A0=C2=A0../obj_s/visbuf.o=
 =C2=A0=C2=A0../obj_s/alloc_entry.o=C2=A0=C2=A0../obj_s/captoinfo.o=C2=A0=C2=
 =A0../obj_s/comp_expand.o=C2=A0=C2=A0../obj_s/comp_parse.o=C2=A0=C2=A0../ob=
 j_s/comp_scan.o=C2=A0=C2=A0../obj_s/parse_entry.o=C2=A0=C2=A0../obj_s/write=
 _entry.o=C2=A0=C2=A0../obj_s/define_key.o=C2=A0=C2=A0../obj_s/hashed_db.o=
 =C2=A0=C2=A0../obj_s/key_defined.o=C2=A0=C2=A0../obj_s/keybound.o=C2=A0=C2=
 =A0../obj_s/keyok.o=C2=A0=C2=A0../obj_s/version.o -L../lib
 Using built-in specs.
 COLLECT_GCC=3Dgcc
 COLLECT_LTO_WRAPPER=3D/usr/libexec/lto-wrapper
 Target: x86_64--netbsd
 Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure =
 --target=3Dx86_64--netbsd --enable-long-long --enable-threads --with-bugurl=
 =3Dhttp://www.NetBSD.org/Misc/send-pr.html --with-pkgversion=3D'NetBSD nb4 =
 20200810' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-l=
 ibstdcxx-time=3Drt --enable-libstdcxx-threads --with-diagnostics-color=3Dau=
 to-if-env --with-tune=3Dnocona --with-default-libstdcxx-abi=3Dnew --with-mp=
 c-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpc/lib/libmp=
 c --with-mpfr-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/m=
 pfr/lib/libmpfr --with-gmp-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/ext=
 ernal/lgpl3/gmp/lib/libgmp --with-mpc-include=3D/usr/src/external/lgpl3/mpc=
 /dist/src --with-mpfr-include=3D/usr/src/external/lgpl3/mpfr/dist/src --wit=
 h-gmp-include=3D/usr/src/external/lgpl3/gmp/lib/libgmp/arch/x86_64 --enable=
 -tls --disable-multilib --disable-libstdcxx-pch --build=3Dx86_64--netbsd --=
 host=3Dx86_64--netbsd --with-sysroot=3D/var/obj/mknative/amd64-x86_64/usr/s=
 rc/destdir.amd64
 Thread model: posix
 gcc version 7.5.0 (nb4 20200810)=20
 COMPILER_PATH=3D/usr/libexec/
 LIBRARY_PATH=3D/usr/lib/
 COLLECT_GCC_OPTIONS=3D'-v' '-pie' '-s' '-Wall' '-O2' '-fpie' '-fstack-prote=
 ctor-all' '-fstack-protector-strong' '-march=3Dnative' '-pipe' '--param' 'm=
 ax-inline-insns-single=3D1200' '-o' '../lib/libncurses.so' '-L../lib'
 ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=3D/usr/libexec/lto-wra=
 pper -plugin-opt=3D-fresolution=3D/tmp//cc8HoBJt.res -plugin-opt=3D-pass-th=
 rough=3D-lgcc_s -plugin-opt=3D-pass-through=3D-lgcc -plugin-opt=3D-pass-thr=
 ough=3D-lc -plugin-opt=3D-pass-through=3D-lgcc_s -plugin-opt=3D-pass-throug=
 h=3D-lgcc --eh-frame-hdr -dc -dp -e _start -dynamic-linker /usr/libexec/ld.=
 elf_so -pie -o ../lib/libncurses.so -s /usr/lib/crt0.o /usr/lib/crti.o /usr=
 /lib/crtbeginS.o -L../lib -shared -Bshareable ../obj_s/hardscroll.o ../obj_=
 s/hashmap.o ../obj_s/lib_addch.o ../obj_s/lib_addstr.o ../obj_s/lib_beep.o =
 ../obj_s/lib_bkgd.o ../obj_s/lib_box.o ../obj_s/lib_chgat.o ../obj_s/lib_cl=
 ear.o ../obj_s/lib_clearok.o ../obj_s/lib_clrbot.o ../obj_s/lib_clreol.o ..=
 /obj_s/lib_color.o ../obj_s/lib_colorset.o ../obj_s/lib_delch.o ../obj_s/li=
 b_delwin.o ../obj_s/lib_echo.o ../obj_s/lib_endwin.o ../obj_s/lib_erase.o .=
 ./obj_s/lib_flash.o ../obj_s/lib_gen.o ../obj_s/lib_getch.o ../obj_s/lib_ge=
 tstr.o ../obj_s/lib_hline.o ../obj_s/lib_immedok.o ../obj_s/lib_inchstr.o .=
 ./obj_s/lib_initscr.o ../obj_s/lib_insch.o ../obj_s/lib_insdel.o ../obj_s/l=
 ib_insnstr.o ../obj_s/lib_instr.o ../obj_s/lib_isendwin.o ../obj_s/lib_leav=
 eok.o ../obj_s/lib_mouse.o ../obj_s/lib_move.o ../obj_s/lib_mvcur.o ../obj_=
 s/lib_mvwin.o ../obj_s/lib_newterm.o ../obj_s/lib_newwin.o ../obj_s/lib_nl.=
 o ../obj_s/lib_overlay.o ../obj_s/lib_pad.o ../obj_s/lib_printw.o ../obj_s/=
 lib_redrawln.o ../obj_s/lib_refresh.o ../obj_s/lib_restart.o ../obj_s/lib_s=
 canw.o ../obj_s/lib_screen.o ../obj_s/lib_scroll.o ../obj_s/lib_scrollok.o =
 ../obj_s/lib_scrreg.o ../obj_s/lib_set_term.o ../obj_s/lib_slk.o ../obj_s/l=
 ib_slkatr_set.o ../obj_s/lib_slkatrof.o ../obj_s/lib_slkatron.o ../obj_s/li=
 b_slkatrset.o ../obj_s/lib_slkattr.o ../obj_s/lib_slkclear.o ../obj_s/lib_s=
 lkcolor.o ../obj_s/lib_slkinit.o ../obj_s/lib_slklab.o ../obj_s/lib_slkrefr=
 .o ../obj_s/lib_slkset.o ../obj_s/lib_slktouch.o ../obj_s/lib_touch.o ../ob=
 j_s/lib_tstp.o ../obj_s/lib_ungetch.o ../obj_s/lib_vidattr.o ../obj_s/lib_v=
 line.o ../obj_s/lib_wattroff.o ../obj_s/lib_wattron.o ../obj_s/lib_winch.o =
 ../obj_s/lib_window.o ../obj_s/nc_panel.o ../obj_s/safe_sprintf.o ../obj_s/=
 tty_update.o ../obj_s/varargs.o ../obj_s/vsscanf.o ../obj_s/lib_freeall.o .=
 ./obj_s/expanded.o ../obj_s/legacy_coding.o ../obj_s/lib_dft_fgbg.o ../obj_=
 s/lib_print.o ../obj_s/new_pair.o ../obj_s/resizeterm.o ../obj_s/use_screen=
 .o ../obj_s/use_window.o ../obj_s/wresize.o ../obj_s/access.o ../obj_s/add_=
 tries.o ../obj_s/alloc_ttype.o ../obj_s/codes.o ../obj_s/comp_captab.o ../o=
 bj_s/comp_error.o ../obj_s/comp_hash.o ../obj_s/comp_userdefs.o ../obj_s/db=
 _iterator.o ../obj_s/doalloc.o ../obj_s/entries.o ../obj_s/fallback.o ../ob=
 j_s/free_ttype.o ../obj_s/getenv_num.o ../obj_s/home_terminfo.o ../obj_s/in=
 it_keytry.o ../obj_s/lib_acs.o ../obj_s/lib_baudrate.o ../obj_s/lib_cur_ter=
 m.o ../obj_s/lib_data.o ../obj_s/lib_has_cap.o ../obj_s/lib_kernel.o ../obj=
 _s/lib_keyname.o ../obj_s/lib_longname.o ../obj_s/lib_napms.o ../obj_s/lib_=
 options.o ../obj_s/lib_raw.o ../obj_s/lib_setup.o ../obj_s/lib_termcap.o ..=
 /obj_s/lib_termname.o ../obj_s/lib_tgoto.o ../obj_s/lib_ti.o ../obj_s/lib_t=
 parm.o ../obj_s/lib_tputs.o ../obj_s/lib_trace.o ../obj_s/lib_ttyflags.o ..=
 /obj_s/lib_twait.o ../obj_s/name_match.o ../obj_s/names.o ../obj_s/obsolete=
 .o ../obj_s/read_entry.o ../obj_s/read_termcap.o ../obj_s/strings.o ../obj_=
 s/tries.o ../obj_s/trim_sgr0.o ../obj_s/unctrl.o ../obj_s/visbuf.o ../obj_s=
 /alloc_entry.o ../obj_s/captoinfo.o ../obj_s/comp_expand.o ../obj_s/comp_pa=
 rse.o ../obj_s/comp_scan.o ../obj_s/parse_entry.o ../obj_s/write_entry.o ..=
 /obj_s/define_key.o ../obj_s/hashed_db.o ../obj_s/key_defined.o ../obj_s/ke=
 ybound.o ../obj_s/keyok.o ../obj_s/version.o --as-needed -lgcc_s --no-as-ne=
 eded -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtendS.o =
 /usr/lib/crtn.o
 ld: /usr/lib/crt0.o: in function `__start':
 (.text+0x29): undefined reference to `__fini_array_start'
 ld: /usr/lib/crt0.o: relocation R_X86_64_PC32 against undefined hidden symb=
 ol `__fini_array_start' can not be used when making a shared object
 ld: final link failed: bad value
 *** Error code 1

 Stop.
 make[1]: stopped in /home/rvp/work/ncurses-6.2-20200817/ncurses
 *** Error code 1

 Stop.
 make: stopped in /home/rvp/work/ncurses-6.2-20200817
 ---OUTPUT ENDS---

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@netbsd.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Thu, 20 Aug 2020 13:08:55 +0200

 On Thu, Aug 20, 2020 at 07:50:00AM +0000, rajeev_v_pillai@yahoo.com wrote:
 > $ echo $LDFLAGS
 > -pie -s

 Why are you using -pie for a shared library?

 Joerg

State-Changed-From-To: open->closed
State-Changed-By: joerg@NetBSD.org
State-Changed-When: Thu, 20 Aug 2020 11:23:56 +0000
State-Changed-Why:
Invalid, shared libraries must not be created with -fpie / -pie.


From: "Rajeev V. Pillai" <rajeev_v_pillai@yahoo.com>
To: "toolchain-manager@netbsd.org" <toolchain-manager@netbsd.org>, 
	"gnats-admin@netbsd.org" <gnats-admin@netbsd.org>, 
	"netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>, 
	"gnats-bugs@netbsd.org" <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Thu, 20 Aug 2020 11:44:56 +0000 (UTC)

  On Thursday, 20 August 2020, 16:40:03 GMT+5:30, Joerg Sonnenberger <joerg@=
 bec.de> wrote:

 > Why are you using -pie for a shared library?

 That's a default (and has been removed), and not relevant here, I think.
 There seems to be a difference between passing ``-Wl,-shared'' and passing =
 ``-shared'':
 With ``-shared'', the library is produced without error:

 ---OUTPUT STARTS---
 $ gcc -v -Wall -O2 -fstack-protector-all -fstack-protector-strong -march=3D=
 native -pipe -shared -o ../lib/libtinfow.so ../obj_s/access.o=C2=A0=C2=A0..=
 /obj_s/add_tries.o=C2=A0=C2=A0../obj_s/alloc_ttype.o=C2=A0=C2=A0../obj_s/co=
 des.o=C2=A0=C2=A0../obj_s/comp_captab.o=C2=A0=C2=A0../obj_s/comp_error.o=C2=
 =A0=C2=A0../obj_s/comp_hash.o=C2=A0=C2=A0../obj_s/comp_userdefs.o=C2=A0=C2=
 =A0../obj_s/db_iterator.o=C2=A0=C2=A0../obj_s/doalloc.o=C2=A0=C2=A0../obj_s=
 /entries.o=C2=A0=C2=A0../obj_s/fallback.o=C2=A0=C2=A0../obj_s/free_ttype.o=
 =C2=A0=C2=A0../obj_s/getenv_num.o=C2=A0=C2=A0../obj_s/home_terminfo.o=C2=A0=
 =C2=A0../obj_s/init_keytry.o=C2=A0=C2=A0../obj_s/lib_acs.o=C2=A0=C2=A0../ob=
 j_s/lib_baudrate.o=C2=A0=C2=A0../obj_s/lib_cur_term.o=C2=A0=C2=A0../obj_s/l=
 ib_data.o=C2=A0=C2=A0../obj_s/lib_has_cap.o=C2=A0=C2=A0../obj_s/lib_kernel.=
 o=C2=A0=C2=A0../obj_s/lib_keyname.o=C2=A0=C2=A0../obj_s/lib_longname.o=C2=
 =A0=C2=A0../obj_s/lib_napms.o=C2=A0=C2=A0../obj_s/lib_options.o=C2=A0=C2=A0=
 ../obj_s/lib_raw.o=C2=A0=C2=A0../obj_s/lib_setup.o=C2=A0=C2=A0../obj_s/lib_=
 termcap.o=C2=A0=C2=A0../obj_s/lib_termname.o=C2=A0=C2=A0../obj_s/lib_tgoto.=
 o=C2=A0=C2=A0../obj_s/lib_ti.o=C2=A0=C2=A0../obj_s/lib_tparm.o=C2=A0=C2=A0.=
 ./obj_s/lib_tputs.o=C2=A0=C2=A0../obj_s/lib_trace.o=C2=A0=C2=A0../obj_s/lib=
 _ttyflags.o=C2=A0=C2=A0../obj_s/lib_twait.o=C2=A0=C2=A0../obj_s/name_match.=
 o=C2=A0=C2=A0../obj_s/names.o=C2=A0=C2=A0../obj_s/obsolete.o=C2=A0=C2=A0../=
 obj_s/read_entry.o=C2=A0=C2=A0../obj_s/read_termcap.o=C2=A0=C2=A0../obj_s/s=
 trings.o=C2=A0=C2=A0../obj_s/tries.o=C2=A0=C2=A0../obj_s/trim_sgr0.o=C2=A0=
 =C2=A0../obj_s/unctrl.o=C2=A0=C2=A0../obj_s/visbuf.o=C2=A0=C2=A0../obj_s/al=
 loc_entry.o=C2=A0=C2=A0../obj_s/captoinfo.o=C2=A0=C2=A0../obj_s/comp_expand=
 .o=C2=A0=C2=A0../obj_s/comp_parse.o=C2=A0=C2=A0../obj_s/comp_scan.o=C2=A0=
 =C2=A0../obj_s/parse_entry.o=C2=A0=C2=A0../obj_s/write_entry.o=C2=A0=C2=A0.=
 ./obj_s/define_key.o=C2=A0=C2=A0../obj_s/hashed_db.o=C2=A0=C2=A0../obj_s/ke=
 y_defined.o=C2=A0=C2=A0../obj_s/keybound.o=C2=A0=C2=A0../obj_s/keyok.o=C2=
 =A0=C2=A0../obj_s/version.o -L../lib 2>&1 | tee ~/work/log-ok.txt
 Using built-in specs.
 COLLECT_GCC=3Dgcc
 COLLECT_LTO_WRAPPER=3D/usr/libexec/lto-wrapper
 Target: x86_64--netbsd
 Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure =
 --target=3Dx86_64--netbsd --enable-long-long --enable-threads --with-bugurl=
 =3Dhttp://www.NetBSD.org/Misc/send-pr.html --with-pkgversion=3D'NetBSD nb4 =
 20200810' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-l=
 ibstdcxx-time=3Drt --enable-libstdcxx-threads --with-diagnostics-color=3Dau=
 to-if-env --with-tune=3Dnocona --with-default-libstdcxx-abi=3Dnew --with-mp=
 c-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpc/lib/libmp=
 c --with-mpfr-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/m=
 pfr/lib/libmpfr --with-gmp-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/ext=
 ernal/lgpl3/gmp/lib/libgmp --with-mpc-include=3D/usr/src/external/lgpl3/mpc=
 /dist/src --with-mpfr-include=3D/usr/src/external/lgpl3/mpfr/dist/src --wit=
 h-gmp-include=3D/usr/src/external/lgpl3/gmp/lib/libgmp/arch/x86_64 --enable=
 -tls --disable-multilib --disable-libstdcxx-pch --build=3Dx86_64--netbsd --=
 host=3Dx86_64--netbsd --with-sysroot=3D/var/obj/mknative/amd64-x86_64/usr/s=
 rc/destdir.amd64
 Thread model: posix
 gcc version 7.5.0 (nb4 20200810)=20
 COMPILER_PATH=3D/usr/libexec/
 LIBRARY_PATH=3D/usr/lib/
 COLLECT_GCC_OPTIONS=3D'-v' '-Wall' '-O2' '-fstack-protector-all' '-fstack-p=
 rotector-strong' '-march=3Dnative' '-pipe' '-shared' '-o' '../lib/libtinfow=
 .so' '-L../lib'
 ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=3D/usr/libexec/lto-wra=
 pper -plugin-opt=3D-fresolution=3D/tmp//cchMdIl3.res -plugin-opt=3D-pass-th=
 rough=3D-lgcc_s -plugin-opt=3D-pass-through=3D-lgcc -plugin-opt=3D-pass-thr=
 ough=3D-lc -plugin-opt=3D-pass-through=3D-lgcc_s -plugin-opt=3D-pass-throug=
 h=3D-lgcc --eh-frame-hdr -shared -o ../lib/libtinfow.so /usr/lib/crti.o /us=
 r/lib/crtbeginS.o -L../lib ../obj_s/access.o ../obj_s/add_tries.o ../obj_s/=
 alloc_ttype.o ../obj_s/codes.o ../obj_s/comp_captab.o ../obj_s/comp_error.o=
  ../obj_s/comp_hash.o ../obj_s/comp_userdefs.o ../obj_s/db_iterator.o ../ob=
 j_s/doalloc.o ../obj_s/entries.o ../obj_s/fallback.o ../obj_s/free_ttype.o =
 ../obj_s/getenv_num.o ../obj_s/home_terminfo.o ../obj_s/init_keytry.o ../ob=
 j_s/lib_acs.o ../obj_s/lib_baudrate.o ../obj_s/lib_cur_term.o ../obj_s/lib_=
 data.o ../obj_s/lib_has_cap.o ../obj_s/lib_kernel.o ../obj_s/lib_keyname.o =
 ../obj_s/lib_longname.o ../obj_s/lib_napms.o ../obj_s/lib_options.o ../obj_=
 s/lib_raw.o ../obj_s/lib_setup.o ../obj_s/lib_termcap.o ../obj_s/lib_termna=
 me.o ../obj_s/lib_tgoto.o ../obj_s/lib_ti.o ../obj_s/lib_tparm.o ../obj_s/l=
 ib_tputs.o ../obj_s/lib_trace.o ../obj_s/lib_ttyflags.o ../obj_s/lib_twait.=
 o ../obj_s/name_match.o ../obj_s/names.o ../obj_s/obsolete.o ../obj_s/read_=
 entry.o ../obj_s/read_termcap.o ../obj_s/strings.o ../obj_s/tries.o ../obj_=
 s/trim_sgr0.o ../obj_s/unctrl.o ../obj_s/visbuf.o ../obj_s/alloc_entry.o ..=
 /obj_s/captoinfo.o ../obj_s/comp_expand.o ../obj_s/comp_parse.o ../obj_s/co=
 mp_scan.o ../obj_s/parse_entry.o ../obj_s/write_entry.o ../obj_s/define_key=
 .o ../obj_s/hashed_db.o ../obj_s/key_defined.o ../obj_s/keybound.o ../obj_s=
 /keyok.o ../obj_s/version.o --as-needed -lgcc_s --no-as-needed -lgcc -lc --=
 as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtendS.o /usr/lib/crtn.o
 COLLECT_GCC_OPTIONS=3D'-v' '-Wall' '-O2' '-fstack-protector-all' '-fstack-p=
 rotector-strong' '-march=3Dnative' '-pipe' '-shared' '-o' '../lib/libtinfow=
 .so' '-L../lib'
 ---OUTPUT ENDS---


 With ``-Wl,-shared'', there is an error (it's trying to create an executabl=
 e):
 ---OUTPUT STARTS---
 $ gcc -v -Wall -O2 -fstack-protector-all -fstack-protector-strong -march=3D=
 native -pipe -Wl,-shared -o ../lib/libtinfow.so ../obj_s/access.o=C2=A0=C2=
 =A0../obj_s/add_tries.o=C2=A0=C2=A0../obj_s/alloc_ttype.o=C2=A0=C2=A0../obj=
 _s/codes.o=C2=A0=C2=A0../obj_s/comp_captab.o=C2=A0=C2=A0../obj_s/comp_error=
 .o=C2=A0=C2=A0../obj_s/comp_hash.o=C2=A0=C2=A0../obj_s/comp_userdefs.o=C2=
 =A0=C2=A0../obj_s/db_iterator.o=C2=A0=C2=A0../obj_s/doalloc.o=C2=A0=C2=A0..=
 /obj_s/entries.o=C2=A0=C2=A0../obj_s/fallback.o=C2=A0=C2=A0../obj_s/free_tt=
 ype.o=C2=A0=C2=A0../obj_s/getenv_num.o=C2=A0=C2=A0../obj_s/home_terminfo.o=
 =C2=A0=C2=A0../obj_s/init_keytry.o=C2=A0=C2=A0../obj_s/lib_acs.o=C2=A0=C2=
 =A0../obj_s/lib_baudrate.o=C2=A0=C2=A0../obj_s/lib_cur_term.o=C2=A0=C2=A0..=
 /obj_s/lib_data.o=C2=A0=C2=A0../obj_s/lib_has_cap.o=C2=A0=C2=A0../obj_s/lib=
 _kernel.o=C2=A0=C2=A0../obj_s/lib_keyname.o=C2=A0=C2=A0../obj_s/lib_longnam=
 e.o=C2=A0=C2=A0../obj_s/lib_napms.o=C2=A0=C2=A0../obj_s/lib_options.o=C2=A0=
 =C2=A0../obj_s/lib_raw.o=C2=A0=C2=A0../obj_s/lib_setup.o=C2=A0=C2=A0../obj_=
 s/lib_termcap.o=C2=A0=C2=A0../obj_s/lib_termname.o=C2=A0=C2=A0../obj_s/lib_=
 tgoto.o=C2=A0=C2=A0../obj_s/lib_ti.o=C2=A0=C2=A0../obj_s/lib_tparm.o=C2=A0=
 =C2=A0../obj_s/lib_tputs.o=C2=A0=C2=A0../obj_s/lib_trace.o=C2=A0=C2=A0../ob=
 j_s/lib_ttyflags.o=C2=A0=C2=A0../obj_s/lib_twait.o=C2=A0=C2=A0../obj_s/name=
 _match.o=C2=A0=C2=A0../obj_s/names.o=C2=A0=C2=A0../obj_s/obsolete.o=C2=A0=
 =C2=A0../obj_s/read_entry.o=C2=A0=C2=A0../obj_s/read_termcap.o=C2=A0=C2=A0.=
 ./obj_s/strings.o=C2=A0=C2=A0../obj_s/tries.o=C2=A0=C2=A0../obj_s/trim_sgr0=
 .o=C2=A0=C2=A0../obj_s/unctrl.o=C2=A0=C2=A0../obj_s/visbuf.o=C2=A0=C2=A0../=
 obj_s/alloc_entry.o=C2=A0=C2=A0../obj_s/captoinfo.o=C2=A0=C2=A0../obj_s/com=
 p_expand.o=C2=A0=C2=A0../obj_s/comp_parse.o=C2=A0=C2=A0../obj_s/comp_scan.o=
 =C2=A0=C2=A0../obj_s/parse_entry.o=C2=A0=C2=A0../obj_s/write_entry.o=C2=A0=
 =C2=A0../obj_s/define_key.o=C2=A0=C2=A0../obj_s/hashed_db.o=C2=A0=C2=A0../o=
 bj_s/key_defined.o=C2=A0=C2=A0../obj_s/keybound.o=C2=A0=C2=A0../obj_s/keyok=
 .o=C2=A0=C2=A0../obj_s/version.o -L../lib 2>&1 | tee ~/work/log-fail.txt
 Using built-in specs.
 COLLECT_GCC=3Dgcc
 COLLECT_LTO_WRAPPER=3D/usr/libexec/lto-wrapper
 Target: x86_64--netbsd
 Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure =
 --target=3Dx86_64--netbsd --enable-long-long --enable-threads --with-bugurl=
 =3Dhttp://www.NetBSD.org/Misc/send-pr.html --with-pkgversion=3D'NetBSD nb4 =
 20200810' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-l=
 ibstdcxx-time=3Drt --enable-libstdcxx-threads --with-diagnostics-color=3Dau=
 to-if-env --with-tune=3Dnocona --with-default-libstdcxx-abi=3Dnew --with-mp=
 c-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpc/lib/libmp=
 c --with-mpfr-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/m=
 pfr/lib/libmpfr --with-gmp-lib=3D/var/obj/mknative/amd64-x86_64/usr/src/ext=
 ernal/lgpl3/gmp/lib/libgmp --with-mpc-include=3D/usr/src/external/lgpl3/mpc=
 /dist/src --with-mpfr-include=3D/usr/src/external/lgpl3/mpfr/dist/src --wit=
 h-gmp-include=3D/usr/src/external/lgpl3/gmp/lib/libgmp/arch/x86_64 --enable=
 -tls --disable-multilib --disable-libstdcxx-pch --build=3Dx86_64--netbsd --=
 host=3Dx86_64--netbsd --with-sysroot=3D/var/obj/mknative/amd64-x86_64/usr/s=
 rc/destdir.amd64
 Thread model: posix
 gcc version 7.5.0 (nb4 20200810)=20
 COMPILER_PATH=3D/usr/libexec/
 LIBRARY_PATH=3D/usr/lib/
 COLLECT_GCC_OPTIONS=3D'-v' '-Wall' '-O2' '-fstack-protector-all' '-fstack-p=
 rotector-strong' '-march=3Dnative' '-pipe' '-o' '../lib/libtinfow.so' '-L..=
 /lib'
 ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=3D/usr/libexec/lto-wra=
 pper -plugin-opt=3D-fresolution=3D/tmp//ccFx4JTz.res -plugin-opt=3D-pass-th=
 rough=3D-lgcc_s -plugin-opt=3D-pass-through=3D-lgcc -plugin-opt=3D-pass-thr=
 ough=3D-lc -plugin-opt=3D-pass-through=3D-lgcc_s -plugin-opt=3D-pass-throug=
 h=3D-lgcc --eh-frame-hdr -dc -dp -e _start -dynamic-linker /usr/libexec/ld.=
 elf_so -o ../lib/libtinfow.so /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtb=
 egin.o -L../lib -shared ../obj_s/access.o ../obj_s/add_tries.o ../obj_s/all=
 oc_ttype.o ../obj_s/codes.o ../obj_s/comp_captab.o ../obj_s/comp_error.o ..=
 /obj_s/comp_hash.o ../obj_s/comp_userdefs.o ../obj_s/db_iterator.o ../obj_s=
 /doalloc.o ../obj_s/entries.o ../obj_s/fallback.o ../obj_s/free_ttype.o ../=
 obj_s/getenv_num.o ../obj_s/home_terminfo.o ../obj_s/init_keytry.o ../obj_s=
 /lib_acs.o ../obj_s/lib_baudrate.o ../obj_s/lib_cur_term.o ../obj_s/lib_dat=
 a.o ../obj_s/lib_has_cap.o ../obj_s/lib_kernel.o ../obj_s/lib_keyname.o ../=
 obj_s/lib_longname.o ../obj_s/lib_napms.o ../obj_s/lib_options.o ../obj_s/l=
 ib_raw.o ../obj_s/lib_setup.o ../obj_s/lib_termcap.o ../obj_s/lib_termname.=
 o ../obj_s/lib_tgoto.o ../obj_s/lib_ti.o ../obj_s/lib_tparm.o ../obj_s/lib_=
 tputs.o ../obj_s/lib_trace.o ../obj_s/lib_ttyflags.o ../obj_s/lib_twait.o .=
 ./obj_s/name_match.o ../obj_s/names.o ../obj_s/obsolete.o ../obj_s/read_ent=
 ry.o ../obj_s/read_termcap.o ../obj_s/strings.o ../obj_s/tries.o ../obj_s/t=
 rim_sgr0.o ../obj_s/unctrl.o ../obj_s/visbuf.o ../obj_s/alloc_entry.o ../ob=
 j_s/captoinfo.o ../obj_s/comp_expand.o ../obj_s/comp_parse.o ../obj_s/comp_=
 scan.o ../obj_s/parse_entry.o ../obj_s/write_entry.o ../obj_s/define_key.o =
 ../obj_s/hashed_db.o ../obj_s/key_defined.o ../obj_s/keybound.o ../obj_s/ke=
 yok.o ../obj_s/version.o --as-needed -lgcc_s --no-as-needed -lgcc -lc --as-=
 needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
 ld: /usr/lib/crt0.o: in function `__start':
 (.text+0x29): undefined reference to `__fini_array_start'
 ld: /usr/lib/crt0.o: relocation R_X86_64_PC32 against undefined hidden symb=
 ol `__fini_array_start' can not be used when making a shared object
 ld: final link failed: bad value
 ---OUTPUT ENDS---

 Looks like ``-Wl,-shared'' is not the same as ``-shared''. I thought it was=
 .


 RVP

From: "Rajeev V. Pillai" <rajeev_v_pillai@yahoo.com>
To: "toolchain-manager@netbsd.org" <toolchain-manager@netbsd.org>, 
	"gnats-admin@netbsd.org" <gnats-admin@netbsd.org>, 
	"netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>, 
	"gnats-bugs@netbsd.org" <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Thu, 20 Aug 2020 13:14:58 +0000 (UTC)

  On Thursday, 20 August 2020, 17:14:56 GMT+5:30, Rajeev V. Pillai <rajeev_v_pillai@yahoo.com> wrote: 

 > Looks like ``-Wl,-shared'' is not the same as ``-shared''. I thought it was.

 OK. I've tried gcc-8.3.0 & gcc-10.2.0, clang-8.0.1 & clang-10.0.1. None of them accept ``-Wl,-shared'' as a synonym for ``-shared''.

 I'll report a bug with the ncurses maintainer, instead.

 RVP

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Sun, 23 Aug 2020 09:10:57 +0000

 On Thu, Aug 20, 2020 at 01:40:02PM +0000, Rajeev V. Pillai wrote:
  >> Looks like ``-Wl,-shared'' is not the same as ``-shared''. I
  >> thought it was.
  >  
  > OK. I've tried gcc-8.3.0 & gcc-10.2.0, clang-8.0.1 &
  > clang-10.0.1. None of them accept ``-Wl,-shared'' as a synonym for
  > ``-shared''.
  >  
  >  I'll report a bug with the ncurses maintainer, instead.

 -Wl,-shared means "pass -shared to the linker and do nothing else"
 while -shared means "tell the compiler driver to build a shared
 library", which includes both passing -shared to the linker and also
 doing other things. Without the other things, you'll among other
 things get the wrong crstuff and it won't work.

 -- 
 David A. Holland
 dholland@netbsd.org

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Sun, 23 Aug 2020 09:18:10 +0000

 On Sun, Aug 23, 2020 at 09:15:02AM +0000, David Holland wrote:
  >  -Wl,-shared means "pass -shared to the linker and do nothing else"
  >  while -shared means "tell the compiler driver to build a shared
  >  library", which includes both passing -shared to the linker and also
  >  doing other things. Without the other things, you'll among other
  >  things get the wrong crstuff and it won't work.

 i can english!

 "Without the other things, you'll get the wrong crtstuff and it won't
 work, and maybe there'll be other problems too."

 -- 
 David A. Holland
 dholland@netbsd.org

From: "Rajeev V. Pillai" <rajeev_v_pillai@yahoo.com>
To: "toolchain-manager@netbsd.org" <toolchain-manager@netbsd.org>, 
	"gnats-admin@netbsd.org" <gnats-admin@netbsd.org>, 
	"netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>, 
	"gnats-bugs@netbsd.org" <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Sun, 23 Aug 2020 21:26:02 +0000 (UTC)

  On Sunday, 23 August 2020, 14:45:05 GMT+5:30, David Holland <dholland-bugs@netbsd.org> wrote: 

 > -Wl,-shared means "pass -shared to the linker and do nothing else" while -shared
 > means "tell the compiler driver to build a shared
 > library", which includes both passing -shared to the linker and also
 > doing other things. Without the other things, you'll among other
 > things get the wrong crstuff and it won't work.


 That explains things very well. Thanks.

 RVP

From: "Rajeev V. Pillai" <rajeev_v_pillai@yahoo.com>
To: "toolchain-manager@netbsd.org" <toolchain-manager@netbsd.org>, 
	"gnats-admin@netbsd.org" <gnats-admin@netbsd.org>, 
	"netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>, 
	"gnats-bugs@netbsd.org" <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Wed, 26 Aug 2020 21:04:58 +0000 (UTC)

 On Sunday, 23 August 2020, 14:45:05 GMT+5:30, David Holland <dholland-bugs@=
 netbsd.org> wrote:

 > On Thu, Aug 20, 2020 at 01:40:02PM +0000, Rajeev V. Pillai wrote:
 >=C2=A0=C2=A0> > Looks like ``-Wl,-shared'' is not the same as ``-shared''.=
  I
 >=C2=A0=C2=A0> > thought it was.
 >=C2=A0=C2=A0>
 >=C2=A0=C2=A0> OK. I've tried gcc-8.3.0 & gcc-10.2.0, clang-8.0.1 &
 >=C2=A0=C2=A0> clang-10.0.1. None of them accept ``-Wl,-shared'' as a synon=
 ym
 >=C2=A0=C2=A0> for ``-shared''.
 >=C2=A0=C2=A0>
 >=C2=A0=C2=A0> I'll report a bug with the ncurses maintainer, instead.
 >
 > -Wl,-shared means "pass -shared to the linker and do nothing else"
 > while -shared means "tell the compiler driver to build a shared
 > library", which includes both passing -shared to the linker and also
 > doing other things. Without the other things, you'll among other
 > things get the wrong crstuff and it won't work.

 When discussing this issue with Tom Dickey on the ncurses mailing-list,
 he pointed out that passing ``-Wl,-shared'' instead of ``-shared''
 works on NetBSD-8.0 for creating a shared library. His build log is
 here:

 https://lists.gnu.org/archive/html/bug-ncurses/2020-08/msg00086.html

 I have access to a NetBSD-8.1 system (gcc (nb3 20180905) 5.5.0) and,
 I can confirm that ``-Wl,-shared'' works there, too.

 Seems a bit odd, no? Can you explain what's going on here?

 Thanks,
 RVP

From: Martin Husemann <martin@duskware.de>
To: "Rajeev V. Pillai" <rajeev_v_pillai@yahoo.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: toolchain/55594: Error creating shared library using gcc-7.5.0
 on NetBSD 9.0_STABLE
Date: Thu, 27 Aug 2020 07:39:49 +0200

 On Wed, Aug 26, 2020 at 09:04:58PM +0000, Rajeev V. Pillai wrote:
 > When discussing this issue with Tom Dickey on the ncurses mailing-list,
 > he pointed out that passing ``-Wl,-shared'' instead of ``-shared''
 > works on NetBSD-8.0 for creating a shared library.

 It can work by luck (and presence or abscense of other flags, like 
 -fpie). It still is not the right command.

 Martin

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.