Bug 2167213

Summary: 389-ds-base does not honor standard Fedora compiler flags for Rust
Product: [Fedora] Fedora Reporter: Fabio Valentini <decathorpe>
Component: 389-ds-baseAssignee: mreynolds
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: abokovoy, mreynolds, spichugi, tbordaz, vashirov
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fabio Valentini 2023-02-05 20:47:06 UTC
Currently, the Rust module in clamav is built without default Fedora compiler flags for Rust code (i.e. "-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn") - essentially, the code is not fully optimized, and does not contain debuginfo or frame pointers.

RUSTFLAGS are the standard environment variable for setting compiler flags for rustc (similar to CFLAGS / CXXFLAGS / LDFLAGS), but they aren't set by default (and not yet included in %set_build_flags, but I've reported an RFE about this).

It appears that the 389-ds-base build system currently hard-codes these compiler flags: --release --verbose -- -C debuginfo=2

This results in Rust code compiled as part of 389-ds-base not being optimized at the same level as other Rust code in Fedora (i.e. `-Copt-level=3` is default in Fedora, but `--release` mode only implies `-Copt-level=2`), and it also doesn't include the other mandatory compiler flags, which result in better quality of generated code (and on rawhide, includes frame pointers on x86_64 and aarch64).

Comment 1 Ben Cotton 2023-02-07 15:08:23 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 2 Fedora Release Engineering 2023-08-16 07:06:36 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.