Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Apr 2023 20:02:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        tcltk@FreeBSD.org
Subject:   maintainer-feedback requested: [Bug 270768] lang/tcl86: fails to build WITH_LLVM_BINUTILS (LLVM strip)
Message-ID:  <bug-270768-30738-ga6ZNHYFNM@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-270768-30738@https.bugs.freebsd.org/bugzilla/>
References:  <bug-270768-30738@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-tcltk (Nobody)
<tcltk@FreeBSD.org> for maintainer-feedback:
Bug 270768: lang/tcl86: fails to build WITH_LLVM_BINUTILS (LLVM strip)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D270768



--- Description ---
>From the exp-run in PR258872
https://pkg-status.freebsd.org/gohan05/data/mainamd64PR258872-default/2023-=
04-0
5_14h36m44s/logs/errors/tcl86-8.6.13.log

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Installing libtclstub86.a to
/wrkdirs/usr/ports/lang/tcl86/work/stage/usr/local/lib/
strip: error:
'/wrkdirs/usr/ports/lang/tcl86/work/stage/usr/local/lib/_inst.91375_': not
stripping symbol '.L.str.1' because it is named in a relocation
*** Error code 1

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

error can be reproduced in isolation:

# strip -o /dev/null -x tclStubLib.o=20
strip: error: 'tclStubLib.o': not stripping symbol '.L.str.1' because it is
named in a relocation

in this case .L.str.1 is a local symbol:

# readelf -s tclStubLib.o=20

Symbol table '.symtab' contains 12 entries:
   Num:    Value	  Size Type    Bind   Vis	Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT	UND=20
     1: 0000000000000000     0 FILE    LOCAL  DEFAULT	ABS tclStubLib.c
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT	  2 .text
     3: 0000000000000031     4 OBJECT  LOCAL  DEFAULT	  5 .L.str.1
     4: 0000000000000000    49 OBJECT  LOCAL  DEFAULT	  5 .L.str
     5: 0000000000000000   475 FUNC    GLOBAL HIDDEN	  2 Tcl_InitStubs
     6: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT	UND __stack_chk_guard
     7: 0000000000000000     8 OBJECT  GLOBAL HIDDEN	  4 tclStubsPtr
     8: 0000000000000008     8 OBJECT  GLOBAL HIDDEN	  4 tclPlatStubsPtr
     9: 0000000000000010     8 OBJECT  GLOBAL HIDDEN	  4 tclIntStubsPtr
    10: 0000000000000018     8 OBJECT  GLOBAL HIDDEN	  4 tclIntPlatStubsPtr
    11: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT	UND __stack_chk_fail

tcl's build has asked to strip all non-global symbols (strip -x), but .L.st=
r.1
is referenced by relocations:

# readelf -r tclStubLib.o | grep .L.str.1
000000000000004e  0000000300000002 R_X86_64_PC32	  0000000000000031
.L.str.1 - 4
00000000000000f3  0000000300000002 R_X86_64_PC32	  0000000000000031
.L.str.1 - 4
0000000000000153  0000000300000002 R_X86_64_PC32	  0000000000000031
.L.str.1 - 4

Both GNU strip and ELF Tool Chain strip silently handle this case (and just
retain the local symbol), but LLVM strip is stricter and emits an error upon
request to strip a non-removable local symbol.

There is an LLVM ticket open for this at
https://github.com/llvm/llvm-project/issues/47468. It may make sense for LL=
VM
strip to behave the same as GNU and ELF Tool Chain strip, but I think tcl
should just not use strip -x when there are symbols that cannot be stripped=
. My
suggestion would be to just avoid stripping the .a altogether.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-270768-30738-ga6ZNHYFNM>