1.\" Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 2.\" Copyright 2026 Oxide Computer Company 3.\" 4.\" CDDL HEADER START 5.\" 6.\" The contents of this file are subject to the terms of the 7.\" Common Development and Distribution License (the "License"). 8.\" You may not use this file except in compliance with the License. 9.\" 10.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11.\" or http://www.opensolaris.org/os/licensing. 12.\" See the License for the specific language governing permissions 13.\" and limitations under the License. 14.\" 15.\" When distributing Covered Code, include this CDDL HEADER in each 16.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17.\" If applicable, add the following below this CDDL HEADER, with the 18.\" fields enclosed by brackets "[]" replaced with your own identifying 19.\" information: Portions Copyright [yyyy] [name of copyright owner] 20.\" 21.\" CDDL HEADER END 22.\" 23.Dd August 27, 2026 24.Dt CHECK_RTIME 1ONBLD 25.Os 26.Sh NAME 27.Nm check_rtime 28.Nd check ELF runtime attributes 29.Sh SYNOPSIS 30.Nm check_rtime 31.Op Fl imosv 32.Op Fl D Ar depfile | Fl d depdir 33.Op Fl E Ar errfile 34.Op Fl e Ar exfile 35.Op Fl f Ar listfile 36.Op Fl I Ar infofile 37.Op Fl j Ar jobs 38.Op Fl w Ar outdir 39.Ar file | dir ... 40.Sh DESCRIPTION 41.Nm check_rtime 42attempts to check a number of ELF runtime attributes 43for consistency with common build rules. 44These checks involve running 45.Xr ldd 1 46and 47.Xr elfdump 1 48against a family of dynamic objects. 49A dynamic object can be defined explicitly as a 50.Ar file 51or multiple dynamic objects can be located under the directory 52.Ar dir . 53.Pp 54.Nm check_rtime 55is typically called from 56.Xr nightly 1ONBLD 57when the 58.Fl r 59option is in effect. 60In this case the objects under 61the associated 62.Em proto area 63.Pq Ev $ROOT 64are checked. 65.Nm check_rtime 66can also be run standalone against any set of objects. 67.Pp 68.Nm check_rtime 69uses 70.Xr ldd 1 71to verify dependencies. 72This implies that by default any object inspected will bind to its dependencies 73as they are found in the 74.Em underlying system . 75Use of the 76.Fl D , 77.Fl d 78option, or the existence of the environment variables 79.Ev $CODEMGR_WS 80or 81.Ev $ROOT 82instruct 83.Nm check_rtime 84to establish an alternative dependency mapping using 85runtime configuration files generated with 86.Xr crle 1 . 87.Pp 88.Nm check_rtime 89uses 90.Xr ldd 1 91to completely relocate any dynamic object and thus detect missing 92dependencies, unsatisfied symbol relocations, unused and unreferenced 93dependencies. 94These checks are carried out for the following reasons: 95.Bl -bullet 96.It 97An object that cannot find its dependencies may fail to load 98at runtime. 99This error condition often goes unnoticed because the existing use of the 100object is as a dependency itself, and the objects' dependencies are already 101satisfied by the caller. 102However, if the object itself is unable to satisfy its dependencies, its use 103in new environments may be compromised. 104.Pp 105A missing or erroneous 106.Em runpath 107is the typical reason why an object can not locate its dependencies. 108Use of the link-editors 109.Fl zdefs 110option when building a shared object ensures required dependencies are 111established. 112This flag is inherited from 113.Dv $(DYNFLAGS) 114in 115.Pa lib/Makefile.lib . 116Missing dependencies are displayed as: 117.Pp 118.Dl foo: bar.so.1 => (file not found) <no -zdefs?> 119.It 120Unsatisfied symbol relocations indicate that some thread of 121execution through the object will fail when it is unable to 122locate a referenced symbol. 123.Pp 124A missing, or mismatched version of a dependency is the typical 125reason for unsatisfied symbol relocations (see missing dependency 126discussion above). Unsatisfied symbol relocations are displayed as: 127.Pp 128.Dl foo: symbol not found: bar <no -zdefs?> 129.Pp 130Note: Shared objects can make reference to symbol definitions 131that are expected to be defined by the caller. 132To indicate that such symbols are not undefined in the usual sense, you must 133specify these symbols in a 134.Em mapfile , 135using the 136.Va EXTERN 137or 138.Va PARENT 139symbol attributes. 140Without these symbol attributes, 141.Xr ldd 1 142is unable to determine the symbols special nature, and 143.Nm check_rtime 144will report these symbols as undefined. 145.It 146Unused dependencies are wasteful at runtime, as they take time to 147load and relocate, but will not be used by the calling object. 148They also result in unnecessary processing at link-edit time. 149.Pp 150Dependency lists (typically defined via 151.Dv $(LDLIBS) ) 152that have been copy and pasted 153between 154.Pa Makefiles 155without verifying their need, are a typical reason why unused dependencies 156exist. 157Unused dependencies are displayed as: 158.Pp 159.Dl foo: unused object=bar.so.1 <remove lib or -zignore?> 160.It 161Unreferenced dependencies are also wasteful at runtime, although not 162to the extent of unused dependencies. 163They also result in unnecessary processing at link-edit time. 164.Pp 165Unreferenced dependency removal guards against a dependency becoming 166unused when combined with 167different objects, or as the other object dependencies evolve. 168Unreferenced dependencies are displayed as: 169.Bd -literal 170foo: unreferenced object=bar.so.1; \\ 171 unused dependency of libfoo.so.1 \\ 172 <remove lib or -zignore?> 173.Ed 174.Pp 175See also the section 176.Sx ENVIRONMENT VARIABLES . 177.It 178Unused search paths are wasteful at runtime. 179Unused search paths are displayed as: 180.Bd -literal 181foo: unused search path=/usr/foo/lib \\ 182 (RUNPATH/RPATH from file libfoo.so.1) \\ 183 <remove search path?> 184.Ed 185.El 186.Pp 187.Nm check_rtime 188uses 189.Xr elfdump 1 190to look for a concatenated relocation section in shared objects, the existence 191of text relocations, whether debugging or symbol table information exists, 192whether applications have a non-executable stack defined, duplicate entries in 193the symbol sorting sections, and for direct bindings. 194These checks are carried out for the following reasons: 195.Bl -bullet 196.It 197A concatenated relocation section 198.Pq Em .SUNW_reloc 199provides optimal symbol table access at runtime, and thus reduces the overhead 200of relocating the shared object. 201In past releases, the link-edit of a dynamic object with the 202.Fl z Ar combreloc 203option was required to generate a combined relocation section. 204However, with the integration of 6642769, this section combination is a 205default behavior of the link-editor. 206.Pp 207In past releases, not inheriting 208.Dv $(DYNFLAGS) 209from 210.Pa lib/Makefile.lib 211was the typical reason for not having a concatenated relocation section. 212The misguided use of the 213.Fl z Ar nocombreloc 214option will also prevent the creation of a concatenated relocation section. 215A missing concatenated relocation section is displayed as: 216.Pp 217.Dl foo: .SUNW_reloc section missing <no -zcombreloc?> 218.It 219Text relocations result in impure text segments. 220As text segments are typically read-only, they can be shared between numerous 221processes. 222If they must be updated as part of the relocation then the updated pages 223become unsharable and swap space must be allocated to back these pages. 224These events consume unnecessary system resources and reduce overall system 225performance. 226.Pp 227Not inheriting the 228.Dv $(PICS) 229rules from 230.Pa lib/Makefile.lib 231is the typical reason for having non-pic code in shared objects. 232Text relocations are displayed as: 233.Pp 234.Dl foo: TEXTREL .dynamic tag <no -fpic?> 235.It 236Debugging information is unnecessary in released objects. 237Although extensive when compiled 238.Fl g , 239small quantities of debugging information are stored in 240.Em .stabs 241sections under normal compilations. 242This debugging information is geared towards aiding debuggers locate 243relocatable objects associated with the dynamic objects being debugged. 244As relocatable objects aren't made available as part of a software release 245this information has no use. 246.Pp 247Not inheriting the correct 248.Dv $(LDFLAGS) 249from 250.Pa cmd/Makefile.cmd 251.Pq which asserts Fl s 252or 253.Dv $(POST_PROCESS_SO) 254.Pq which asserts Ic strip -x 255are typical reasons for not removing debugging information. 256Note, removal of debugging information is only enabled 257for release builds. 258The existence of debugging information is displayed as: 259.Bd -literal 260foo: debugging sections should be deleted \\ 261 <no strip -x?> 262.Ed 263.It 264All objects should retain their full 265.Em .symtab 266symbol table. 267Although this consumes disk space, it provides for more extensive stack 268tracing when debugging user applications. 269.Pp 270Hard coding a 271.Fl s 272flag with 273.Dv $(LDFLAGS) or 274.Dv $(DYNFLAGS) 275is the typical reason for symbol tables being removed. 276Objects that do not contain a symbol table are displayed as: 277.Bd -literal 278foo.so.1: symbol table should not be stripped \\ 279 <remove -s?> 280.Ed 281.It 282Applications should have a non-executable stack defined to make 283them less vulnerable to buffer overflow attacks. 284.Pp 285Not inheriting the 286.Dv $(LDFLAGS) 287macro in 288.Pa cmd/Makefile.cmd 289is the typical reason for not having a non-executable stack definition. 290Applications without this definition are displayed as: 291.Bd -literal 292foo: application requires non-executable stack \\ 293 <no -Mmapfile_noexstk?> 294.Ed 295.It 296x86 applications should have a non-executable data segment defined to make 297them less vulnerable to buffer overflow attacks. 298.Pp 299Not inheriting the 300.Dv $(LDFLAGS) 301macro in 302.Pa cmd/Makefile.cmd 303is the typical reason for not having a non-executable data definition. 304Applications without this definition are displayed as: 305.Bd -literal 306foo: application requires non-executable data \\ 307 <no -Mmapfile_noexdata?> 308.Ed 309.It 310Solaris ELF files contain symbol sort sections used by DTrace to 311map addresses in memory to the related function or variable symbols. 312There are two such sections, 313.Em .SUNW_dynsymsort 314for regular symbols, and 315.Em .SUNW_dyntlssort 316for thread-local symbols. 317To ensure that the best names are shown for each such address, and that the 318same name is given across Solaris releases, 319.Nm check_rtime 320enforces the rule that only one symbol can appear in the sort sections for 321any given address. 322There are two common ways in which multiple symbols 323or a given address occur in the ON distribution. 324The first is from code written in assembly language. 325The second is as a result of using 326.Ic #pragma weak 327in C to create weak symbols. 328The best solution to this situation is to modify the code to avoid symbol 329aliasing. 330Alternatively, the 331.Va NODYNSORT 332mapfile attribute can be used to eliminate the unwanted symbol. 333.Pp 334Duplicate entries in a symbol sort section are 335displayed in one of the following ways, depending on 336whether the section is for regular or thread-local symbols: 337.Bd -literal 338foo: .SUNW_dynsymsort: duplicate ADDRESS: sym1, sym2 339foo: .SUNW_dyntlssort: duplicate OFFSET: sym1, sym2 340.Ed 341.It 342illumos dynamic ELF objects are expected to employ direct bindings whenever 343feasible. 344This runtime binding technique helps to avoid accidental interposition 345problems, and provides a more optimal runtime symbol search model. 346.Pp 347Not inheriting the correct 348.Dv $(LDFLAGS) from 349.Pa cmd/Makefile.cmd , 350or the correct 351.Dv $(DYNFLAGS) 352from 353.Pa lib/Makefile.lib , 354are the typical reasons for not enabling direct bindings. 355Dynamic objects that do not contain direct binding information are displayed 356as: 357.Bd -literal 358foo: object has no direct bindings \\ 359 <no -B direct or -z direct?> 360.Ed 361.El 362.Pp 363.Nm check_rtime 364also 365uses 366.Xr elfdump 1 367to display useful dynamic entry information under the 368.Fl -i 369option. 370This doesn't necessarily indicate an error condition, but 371provides information that is often useful for gatekeepers to track 372changes in a release. 373Presently the information listed is: 374.Bl -bullet 375.It 376Runpaths are printed for any dynamic object. 377This is a historic check to ensure compiler supplied runpaths 378(typically from 379.Nm CC ) 380are not recorded in any objects. 381Runpaths are displayed as: 382.Pp 383.Dl foo: RPATH=/usr/bar/lib 384.It 385Needed dependencies are printed for any dynamic object. 386In the freeware world this often helps the introducer of a new 387shared object discover that an existing binary has become its 388consumer, and thus that binaries package dependencies may require updating. 389Dependencies are printed as: 390.Pp 391.Dl foo: NEEDED=bar.so.1 392.It 393Dependencies may be marked as forbidden 394.Pq see Sx EXCEPTION FILE FORMAT 395this allows the build to warn should people use them accidentally. 396Forbidden dependencies are printed as: 397.Pp 398.Dl foo: NEEDED=bar.so.1 <forbidden dependency, missing -nodefaultlibs?> 399.El 400.Pp 401.Nm check_rtime 402uses 403.Xr mcs 1 404to inspect an object's 405.Em .comment 406section. 407During development, this section contains numerous file identifiers 408marked with the tag 409.Qq @(#) . 410For release builds these sections are deleted and rewritten under control of 411the 412.Dv $(POST_PROCESS) 413macro to produce a common release identifier. 414This identifier typically consists of three lines including a single comment 415starting with the string 416.Qq @(#) SunOS . 417If this common identifier isn't found the following diagnostic is generated: 418.Pp 419.Dl foo: non-conforming mcs(1) comment <no $(POST_PROCESS)?> 420.Pp 421.Nm check_rtime 422uses 423.Xr pvs 1 424to display version definitions under the 425.Fl v 426option. 427Each symbol defined by the object is shown along with the version it belongs to. 428Changes to the symbols defined by an object, or the versions they belong to, 429do not necessarily indicate an error condition, but 430provides information that is often useful for gatekeepers to track 431changes in a release. 432.Pp 433.Nm check_rtime 434uses 435.Xr elfedit 1 436to verify that relocatable objects which seem likely to be kernel modules were 437linked with the 438.Fl z Ar type=kmod 439flag. 440.Sh OPTIONS 441The following options are supported: 442.Bl -tag -width indent 443.It Fl D Ar depfile 444Use 445.Ar depfile 446to generate an alternative dependency mapping. 447.Ar depfile 448must be created by 449.Ic find_elf -r . 450The 451.Fl D 452and 453.Fl d 454options are mutually exclusive. 455.It Fl d Ar depfile 456Use 457.Ar depdir 458to generate an alternative dependency mapping. 459.Xr find_elf 1ONBLD 460is used to locate the ELF sharable objects for which alternative mappings are 461required. 462The 463.Fl D 464and 465.Fl d 466options are mutually exclusive. 467.It Fl E Ar errfile 468Direct error messages for the analyzed objects to 469.Ar errfile 470instead of stdout. 471.It Fl e Ar exfile 472An exception file is used to exclude objects from 473the usual rules. 474See 475.Sx EXCEPTION FILE FORMAT . 476.It Fl f Ar listfile 477Normally, 478.Ic interface_check 479runs 480.Ic find_elf 481to locate the ELF objects to analyze. 482The 483.Fl f 484option can be used to instead provide a file containing the list of objects to 485analyze, in the format produced by 486.Ic find_elf -r . 487.It Fl I Ar infofile 488Direct informational messages ( 489.Fl i , 490and 491.Fl v 492options) for the analyzed objects to 493.Ar infofile 494instead of stdout. 495.It Fl i 496Provide dynamic entry information. 497Presently only dependencies and runpaths are printed. 498.It Fl j Ar jobs 499Process objects in parallel, using up to 500.Ar jobs 501child processes. 502The output produced by a successful run is identical to that of a serial 503run. 504.It Fl m 505Enable 506.Xr mcs 1 507checking. 508.It Fl o 509Produce a one-line output for each condition discovered, prefixed 510by the objects name. 511This output style is more terse, but is more appropriate for sorting and 512diffing with previous build results. 513.It Fl s 514Determine whether 515.Em .stabs 516sections exist. 517.It Fl v 518Provide version definition information. 519Each symbol defined by the object is printed along with the version it is 520assigned to. 521.It Fl w Ar outdir 522Interpret the paths of all input and output files relative to 523.Ar outdir . 524.El 525.Sh EXCEPTION FILE FORMAT 526Exceptions to the rules enforced by 527.Nm check_rtime 528are specified using an exception file. 529The 530.Fl -e 531option is used to specify an explicit exception file. 532Otherwise, if used in an activated workspace, the default exception file is 533.Pa $CODEMGR_WS/exception_list/check_rtime 534if that file exists. 535If not used in an activated workspace, or if 536.Pa $CODEMGR_WS/exception_list/check_rtime 537does not exist, 538.Nm check_rtime 539will use 540.Pa /opt/onbld/etc/exception_list/check_rtime 541as a fallback default exception file. 542.Pp 543To run 544.Nm check_rtime 545without applying exceptions, specify 546.Fl e 547with a value of 548.Pa /dev/null . 549.Pp 550A 551.Ql # 552character at the beginning of a line, or at any point in 553a line when preceded by whitespace, introduces a comment. 554Empty lines, and lines containing only comments, are ignored by 555.Nm check_rtime . 556Exceptions are specified as space separated keyword, and 557.Xr perl 1 558regular expression: 559.Pp 560.Dl keyword perl-regex 561.Pp 562Since whitespace is used as a separator, the regular 563expression cannot itself contain whitespace. 564Use of the 565.Ql \es 566character class to represent whitespace within the regular expression is 567recommended. 568.Pp 569Before the perl regular expression is used, constructs of the form 570.Em MACH(dir) 571are expanded into a regular expression that matches the directory given, as 572well as any 64-bit architecture subdirectory that might be present 573(i.e. amd64, sparcv9). For instance, 574.Em MACH(lib) 575will match any of the following: 576.Bl -tag -width indent 577.It Pa lib 578.It Pa lib/amd64 579.It Pa lib/sparcv9 580.El 581.Pp 582The exceptions understood by 583.Nm check_rtime 584are: 585.Bl -tag -width indent 586.It EXEC_DATA 587Executables that are not required to have non-executable writable 588data segments 589.It EXEC_STACK 590Executables that are not required to have a non-executable stack 591.It KMOD 592Objects that looks like kernel modules but don't have to be linked with the 593.Fl z Ar type=kmod 594flag. 595.It NOCRLEALT 596Objects that should be skipped when building the alternative dependency 597mapping via the 598.Fl d 599option. 600.It NODIRECT 601Directories and files that are allowed to have no direct bound symbols. 602.It NOSYMSORT 603Files for which we skip checking of duplicate addresses in the 604symbol sort sections. 605.It OLDDEP 606Objects that used to contain system functionality that has since 607migrated to libc. 608We preserve these libraries as pure filters for backward compatibility but 609nothing needs to link to them. 610.It SKIP 611Directories and/or individual objects to skip. 612Note that SKIP should be a last resort, used only when one of the other 613exceptions will not suffice. 614.It STAB 615Objects that are allowed to contain debugging information (stabs). 616.It TEXTREL 617Objects for which we allow relocations to the text segment. 618.It UNREF_OBJ 619Objects that are allowed to be unreferenced. 620.It UNDEF_REF 621Objects that are allowed undefined references. 622.It UNUSED_DEPS 623Objects that are allowed to have unused dependencies. 624.It UNUSED_OBJ 625Objects that are always allowed to be unused dependencies. 626.It UNUSED_RPATH 627Objects that are allowed to have unused runpath directories. 628.It FORBIDDEN 629Specifies that dependencies on a given object are forbidden. 630.It FORBIDDEN_DEP 631Specifies that a given object is permitted a forbidden dependency. 632.El 633.Sh ALTERNATIVE DEPENDENCY MAPPING 634.Nm check_rtime 635was primarily designed to process a nightly builds 636.Ev $ROOT 637hierarchy. 638It is often the case that objects within this hierarchy must bind to 639dependencies within the same hierarchy to satisfy their requirements. 640.Pp 641To achieve this, 642.Nm check_rtime 643uses the shared objects specified with the 644.Fl D 645or 646.Fl d 647options. 648If neither option is specified, and the 649.Ev $CODEMGR_WS 650and 651.Ev $ROOT 652environment variables are defined, the proto area for the workspace is 653used. 654The objects found are used to create runtime configuration files via 655.Xr crle 1 , 656that establish the new shared objects as alternatives to their underlying 657system location. 658.Nm check_rtime 659passes these configuration files as 660.Ev LD_CONFIG 661environment variable settings to 662.Xr ldd 1 663using its 664.Fl -e 665option. 666.Pp 667The effect of these configuration files is that the execution of an 668object under 669.Xr ldd 1 670will bind to the dependencies defined as alternatives. 671Simply put, an object inspected in the 672.Pa proto 673area will bind to its dependencies found in the 674.Pa proto 675area. 676Dependencies that have no alternative mapping will continue to bind to the 677underlying system. 678.Sh ENVIRONMENT VARIABLES 679When the 680.Fl D 681or 682.Fl d 683option isn't in use, 684.Nm check_rtime 685uses the following environment variables to 686establish an alternative dependency mapping: 687.Bl -tag -width indent 688.It Ev CODEMGR_WS 689The root of your workspace, which is the directory 690containing 691.Pa .git . 692Existence of this environment variable indicates that 693.Ev $ROOT 694should be investigated. 695.It Ev ROOT 696Root of the 697.Pa proto 698area of your workspace. 699Any shared objects under this directory will be used to establish an 700alternative dependency mapping. 701.El 702If 703.Xr ldd 1 704supports the 705.Fl U 706option, it will be used to determine any unreferenced dependencies. 707Otherwise 708.Xr ldd 1 709uses the older 710.Fl u 711option which only detects unused references. 712If the following environment variable exists, and indicates an earlier release 713than \fB5.10\fP then 714.Xr ldd 1 715also falls back to using the 716.Fl u 717option. 718.Bl -tag -width indent 719.It Ev RELEASE 720The release version number of the environment being built. 721.El 722.Sh ERROR CONDITIONS 723Inspection of an object with 724.Xr ldd 1 725assumes it is compatible with the machine on which 726.Nm check_rtime 727is being run. 728Incompatible objects such as a 64-bit object encountered on a 32-bit system, 729or an i386 object encountered on a sparc system, can not be fully inspected. 730These objects are displayed as: 731.Pp 732.Dl foo: has wrong class or data encoding 733.Sh FILES 734.Bl -tag -width indent 735.It Pa $CODEMGR_WS/exception_list/check_rtime 736.It Pa /opt/onbld/etc/exception_list/check_rtime 737.El 738.Sh SEE ALSO 739.Xr crle 1 , 740.Xr elfdump 1 , 741.Xr ld.so.1 1 , 742.Xr ldd 1 , 743.Xr mcs 1 , 744.Xr find_elf 1ONBLD 745