Page MenuHomeFreeBSD

csu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs
ClosedPublic

Authored by kevans on Oct 23 2019, 6:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 9, 2:57 PM
Unknown Object (File)
Sat, Mar 9, 2:57 PM
Unknown Object (File)
Sat, Mar 9, 2:23 PM
Unknown Object (File)
Sat, Mar 9, 2:10 PM
Unknown Object (File)
Dec 27 2023, 1:33 PM
Unknown Object (File)
Dec 26 2023, 7:49 PM
Unknown Object (File)
Dec 20 2023, 3:28 AM
Unknown Object (File)
Nov 4 2023, 6:41 PM
Subscribers

Details

Summary

.jcr still needs a 0-entry added in crtend, even on !HAVE_CTORS archs. Without it, .jcr section, when no data is present here, overlaps with next section and register_classes in crtbegin will be examining the wrong item.

PR: 241439

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kevans retitled this revision from Fix dynamclib/init_test:jcr_test on !HAVE_CTORS archs to csu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs.Oct 23 2019, 7:12 PM

Do you know where the .jcr section is coming from? I don't see it on arm64.

This revision is now accepted and ready to land.Oct 25 2019, 2:09 PM

Do you know where the .jcr section is coming from? I don't see it on arm64.

Hmm... so I downloaded FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-20191018-r353709.img to investigate, and that one seems to have them as well.

armv7 (FreeBSD-13.0-CURRENT-arm-armv7-GENERICSD-20191018-r353709.img):

$ readelf -a /mnt/usr/lib/debug/bin/ls.debug | grep -Ei '__jcr|\.jcr'
  [17] .jcr              NOBITS          00019000 0000a0 000000 00  WA  0   0  4
    20: 0000000000019000     0 OBJECT  LOCAL  DEFAULT   17 __JCR_LIST__

arm64 (FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-20191018-r353709.img):

$ readelf -a /mnt2/usr/lib/debug/bin/ls.debug | grep -Ei '__jcr|\.jcr' -A1
  [16] .jcr              NOBITS           0000000000220000  00000090
       0000000000000000  0000000000000000  WA       0     0     8
--
    44: 0000000000220000     0 OBJECT  LOCAL  DEFAULT   16 __JCR_LIST__
    45: 0000000000210234    52 FUNC    LOCAL  DEFAULT   12 register_classes

(I had to -A1 it so the size was included, and the section at least still exists in /bin/ls)

Given this, I suspect the __JCR_LIST__ reference in crtbegin is creating the 0-sized section. I would think maybe a difference from clang 8 -> 9 since base only moved forward not that long ago, but perhaps you've upgraded beyond that already.