Bug 270962 - sysutils/stressdisk: fails to build when base built WITH_LLVM_BINUTILS
Summary: sysutils/stressdisk: fails to build when base built WITH_LLVM_BINUTILS
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks: 258872
  Show dependency treegraph
 
Reported: 2023-04-20 18:17 UTC by Ed Maste
Modified: 2024-03-26 00:38 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (eduardo)


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 2023-04-20 18:17:34 UTC
From exp-run pr 258872

https://pkg-status.freebsd.org/gohan05/data/mainamd64PR258872-default/2023-04-17_22h40m57s/logs/errors/stressdisk-1.0.12_12.log

===>  Installing stressdisk as /wrkdirs/usr/ports/sysutils/stressdisk/work/stage/usr/local/bin/stressdisk
install  -m 444 /wrkdirs/usr/ports/sysutils/stressdisk/work/github.com/ncw/stressdisk@v1.0.12/README.md /wrkdirs/usr/ports/sysutils/stressdisk/work/stage/usr/local/share/doc/stressdisk
/usr/bin/strip /wrkdirs/usr/ports/sysutils/stressdisk/work/stage/usr/local/bin/stressdisk
/usr/bin/strip: error: SHT_STRTAB string table section [index 3] is non-null terminated
*** Error code 1
Comment 1 Nuno Teixeira freebsd_committer freebsd_triage 2023-04-21 07:10:39 UTC
(In reply to Ed Maste from comment #0)

I found this:

clang-based builds are still broken due to:
llvm/llvm-project#53999

https://github.com/llvm/llvm-project/issues/53999

This PR is still open but I can't find a way to fix it.

Thanks
Comment 2 Ed Maste freebsd_committer freebsd_triage 2023-04-21 18:08:52 UTC
It looks like the binary is corrupt in some way at the time strip runs, possibly from a previous llvm-objcopy or llvm-strip invocation.

$  readelf -S work/stage/usr/local/bin/stressdisk
There are 15 section headers, starting at offset 0x21ece0:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
readelf: warning: 'work/stage/usr/local/bin/stressdisk': SHT_STRTAB string table section [index 3] is non-null terminated
  [ 0] <no-strings>      NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] <no-strings>      PROGBITS        0000000000401000 001000 10445b 00  AX  0   0 32
  [ 2] <no-strings>      PROGBITS        0000000000506000 106000 05c6f9 00   A  0   0 32
  [ 3] <no-strings>      STRTAB          0000000000000000 162700 00008b 00      0   0  1
  [ 4] <no-strings>      PROGBITS        00000000005627c0 1627c0 000978 00   A  0   0 32
  [ 5] <no-strings>      PROGBITS        0000000000563140 163140 0001c8 00   A  0   0 32
  [ 6] <no-strings>      PROGBITS        0000000000563308 163308 000000 00   A  0   0  1
  [ 7] <no-strings>      PROGBITS        0000000000563320 163320 09e908 00   A  0   0 32
  [ 8] <no-strings>      PROGBITS        0000000000602000 202000 000170 00  WA  0   0 16
  [ 9] <no-strings>      PROGBITS        0000000000602180 202180 014d60 00  WA  0   0 32
  [10] <no-strings>      PROGBITS        0000000000616ee0 216ee0 007df0 00  WA  0   0 32
  [11] <no-strings>      NOBITS          000000000061ece0 21ece0 02e840 00  WA  0   0 32
  [12] <no-strings>      NOBITS          000000000064d520 24d520 0038f0 00  WA  0   0 32
  [13] <no-strings>      NOTE            0000000000400fb8 000fb8 000048 00   A  0   0  4
  [14] <no-strings>      NOTE            0000000000400f54 000f54 000064 00   A  0   0  4
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  R (retain), l (large), p (processor specific)
Comment 3 Ed Maste freebsd_committer freebsd_triage 2023-04-21 18:21:25 UTC
Indeed, https://github.com/llvm/llvm-project/issues/53999 seems to be exactly the problem.

Here's stressdisk as built:

# readelf -S work/bin/stressdisk
There are 15 section headers, starting at offset 0x1c8:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        0000000000401000 001000 10445b 00  AX  0   0 32
  [ 2] .rodata           PROGBITS        0000000000506000 106000 05c6f9 00   A  0   0 32
  [ 3] .shstrtab         STRTAB          0000000000000000 162700 0000a2 00      0   0  1
  [ 4] .typelink         PROGBITS        00000000005627c0 1627c0 000978 00   A  0   0 32
  [ 5] .itablink         PROGBITS        0000000000563140 163140 0001c8 00   A  0   0 32
  [ 6] .gosymtab         PROGBITS        0000000000563308 163308 000000 00   A  0   0  1
  [ 7] .gopclntab        PROGBITS        0000000000563320 163320 09e908 00   A  0   0 32
  [ 8] .go.buildinfo     PROGBITS        0000000000602000 202000 000170 00  WA  0   0 16
  [ 9] .noptrdata        PROGBITS        0000000000602180 202180 014d60 00  WA  0   0 32
  [10] .data             PROGBITS        0000000000616ee0 216ee0 007df0 00  WA  0   0 32
  [11] .bss              NOBITS          000000000061ece0 21ece0 02e840 00  WA  0   0 32
  [12] .noptrbss         NOBITS          000000000064d520 24d520 0038f0 00  WA  0   0 32
  [13] .note.tag         NOTE            0000000000400fb8 000fb8 000048 00   A  0   0  4
  [14] .note.go.buildid  NOTE            0000000000400f54 000f54 000064 00   A  0   0  4
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  R (retain), l (large), p (processor specific)

Running strip one time reports no error:

# strip stressdisk
#

but the binary is corrupt:

# readelf -S stressdisk
There are 15 section headers, starting at offset 0x21ece0:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
readelf: warning: 'stressdisk': SHT_STRTAB string table section [index 3] is non-null terminated
  [ 0] <no-strings>      NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] <no-strings>      PROGBITS        0000000000401000 001000 10445b 00  AX  0   0 32
  [ 2] <no-strings>      PROGBITS        0000000000506000 106000 05c6f9 00   A  0   0 32
  [ 3] <no-strings>      STRTAB          0000000000000000 162700 00008b 00      0   0  1
  [ 4] <no-strings>      PROGBITS        00000000005627c0 1627c0 000978 00   A  0   0 32
  [ 5] <no-strings>      PROGBITS        0000000000563140 163140 0001c8 00   A  0   0 32
  [ 6] <no-strings>      PROGBITS        0000000000563308 163308 000000 00   A  0   0  1
  [ 7] <no-strings>      PROGBITS        0000000000563320 163320 09e908 00   A  0   0 32
  [ 8] <no-strings>      PROGBITS        0000000000602000 202000 000170 00  WA  0   0 16
  [ 9] <no-strings>      PROGBITS        0000000000602180 202180 014d60 00  WA  0   0 32
  [10] <no-strings>      PROGBITS        0000000000616ee0 216ee0 007df0 00  WA  0   0 32
  [11] <no-strings>      NOBITS          000000000061ece0 21ece0 02e840 00  WA  0   0 32
  [12] <no-strings>      NOBITS          000000000064d520 24d520 0038f0 00  WA  0   0 32
  [13] <no-strings>      NOTE            0000000000400fb8 000fb8 000048 00   A  0   0  4
  [14] <no-strings>      NOTE            0000000000400f54 000f54 000064 00   A  0   0  4
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  R (retain), l (large), p (processor specific)

and then the second strip run fails with an error:

# strip stressdisk 
strip: error: SHT_STRTAB string table section [index 3] is non-null terminated

I've grabbed the PR back.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2023-04-21 18:22:23 UTC
A copy of the unstripped binary is at https://people.freebsd.org/~emaste//bugs/PR270962/stressdisk
Comment 5 Ed Maste freebsd_committer freebsd_triage 2024-03-26 00:38:22 UTC
Probably the easiest short-term workaround is to have the port use GNU binutils objcopy/strip (until the LLVM issue is fixed).