Bug 241439 - csu dynamiclib/init_test:jcr_test does not pass on armv7
Summary: csu dynamiclib/init_test:jcr_test does not pass on armv7
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-arm mailing list
URL: https://reviews.freebsd.org/D22132
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-23 16:44 UTC by Kyle Evans
Modified: 2019-11-08 14:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle Evans freebsd_committer 2019-10-23 16:44:43 UTC
We currently hit the following failure:

dynamiclib/init_test:jcr_test  ->  failed: 
 /usr/src/lib/csu/tests/init_test.c:82: Incorrect pointer passed to _Jv_RegisterClasses  [0.029s]

This test is comparing jcr_ptr to jcr_func_ptr; the former being what's passed to _Jv_RegisterClasses. If I dump them in the ATF_REQUIRE_MSG, jcr_ptr == 12000 and jcr_func_ptr == 20057000; jcr_ptr == 12000 corresponds to this:

$ readelf -a init_test | grep '\.jcr'
...
  [17] .jcr              PROGBITS        00012000 002000 000000 00  WA  0   0  4

The value of jcr_func_ptr is consistent here:

(gdb) print jcr_func_ptr
$3 = (const void *) 0x20057000
(gdb) print &jcr_func
$4 = (func_ptr *) 0x20057000

For completeness:

$ readelf -a libh_csu.so | grep '\.jcr'
...
  [16] .jcr              PROGBITS        00002000 002000 000004 00  WA  0   0  4
Comment 1 Kyle Evans freebsd_committer 2019-10-23 16:45:13 UTC
Kick it over to arm@, perhaps.
Comment 2 commit-hook freebsd_committer 2019-11-08 14:29:18 UTC
A commit references this bug:

Author: kevans
Date: Fri Nov  8 14:28:40 UTC 2019
New revision: 354541
URL: https://svnweb.freebsd.org/changeset/base/354541

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

  .jcr still needs a 0-entry added in crtend, even on !HAVE_CTORS archs, as
  we're still getting .jcr sections added -- presumably due to the reference
  in crtbegin. Without this terminal, the .jcr section (without data) overlaps
  with the next section and register_classes in crtbegin will be examining the
  wrong item.

  PR:		241439
  Reviewed by:	andrew
  Differential Revision:	https://reviews.freebsd.org/D22132

Changes:
  head/lib/csu/common/crtend.c