Skip to content

fix(copr): add PIE flag for aws-lc probe - #10974

Merged
jdx merged 1 commit into
mainfrom
codex/fix-copr-pie-probe
Jul 13, 2026
Merged

jdx merged 1 commit into
mainfrom
codex/fix-copr-pie-probe

Conversation

@jdx

@jdx jdx commented Jul 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • append -fPIE to Fedora x86_64 COPR LDFLAGS
  • preserve the existing Fedora RPM hardening linker flags
  • document why the flag is needed for the aws-lc-sys compiler probe

Root cause

aws-lc-sys compiles and links its memcmp_invalid_stripped_check probe in a single compiler invocation. The probe intentionally ignores CFLAGS, but applies Fedora's LDFLAGS. Fedora 44's hardened linker specs produce a PIE executable, while the probe's object is compiled without -fPIE, causing an R_X86_64_32 relocation failure.

Adding -fPIE to LDFLAGS supplies the matching compile flag in that combined invocation without removing Fedora's hardening flags.

Related to #10921.

Validation

  • reproduced the original failure with the exact aws-lc-sys 0.42.0 probe in a Fedora 44 x86_64 container
  • confirmed the probe compiles and runs successfully with the added -fPIE
  • expanded the generated spec successfully with Fedora 44 rpmspec
  • mise run lint-fix

Note

Low Risk
Packaging-only change scoped to Fedora x86_64 COPR RPM builds; no runtime application logic.

Overview
Fixes Fedora x86_64 COPR builds that fail during the aws-lc-sys memcmp compiler probe when hardened linker flags produce a PIE binary but the probe object is not position-independent.

The generated RPM %build section now exports LDFLAGS="${LDFLAGS:-} -fPIE" for %if 0%{?fedora} and %ifarch x86_64, appending the compile flag in the same combined compile/link step without dropping existing Fedora hardening. Inline comments document why CFLAGS are ignored by the probe and why this workaround is needed.

Reviewed by Cursor Bugbot for commit 4897545. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Fedora x86_64 package builds by ensuring compiler checks use position-independent code.
    • Increased compatibility and reliability for RPM packaging on supported Fedora systems.

Entire-Checkpoint: 37c30f3fe0b7
@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c597066-1fe0-4212-8630-ff0e571c234a

📥 Commits

Reviewing files that changed from the base of the PR and between b2bdeb1 and 4897545.

📒 Files selected for processing (1)
  • packaging/copr/build-copr.sh

📝 Walkthrough

Walkthrough

The COPR build script’s generated RPM spec now appends -fPIE to LDFLAGS only for Fedora x86_64 builds, supporting the aws-lc-sys memcmp compiler probe.

Changes

COPR PIE flag configuration

Layer / File(s) Summary
Fedora x86_64 LDFLAGS override
packaging/copr/build-copr.sh
The generated spec conditionally appends -fPIE to LDFLAGS for Fedora x86_64 builds, with comments describing the aws-lc-sys compiler probe requirement.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: bestagi, icholy

Poem

A rabbit hops through Fedora’s build,
With PIE flags neatly stilled.
x86_64 gets a linker tune,
For memcmp beneath the moon.
COPR compiles—carrots bloom!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a PIE flag to fix the aws-lc probe in COPR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jdx
jdx enabled auto-merge (squash) July 13, 2026 21:12
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a build failure on Fedora 44 x86_64 COPR by appending -fPIE to LDFLAGS inside an architecture-specific RPM spec block. The root cause is that aws-lc-sys runs its memcmp_invalid_stripped_check probe as a combined compile-and-link command that skips CFLAGS but inherits LDFLAGS; Fedora's hardened linker specs request a PIE executable, which requires the object to be compiled with -fPIE, causing an R_X86_64_32 relocation error without it.

  • The new %if 0%{?fedora} / %ifarch x86_64 guards mirror the existing nasm BuildRequires block, keeping the scope precise and consistent with the surrounding spec.
  • ${LDFLAGS:-} -fPIE preserves whatever hardening flags redhat-rpm-config already placed in LDFLAGS; the flag is only needed in Fedora (not RHEL) because RHEL's linker specs don't enforce the same PIE requirement.

Confidence Score: 5/5

Targeted one-liner fix inside a well-scoped RPM macro guard; no logic paths are altered and existing hardening flags are preserved.

The change is a single export statement gated behind the exact same %if 0%{?fedora} / %ifarch x86_64 block used elsewhere in the spec. The flag is a well-understood compiler directive, the expansion form preserves any pre-existing LDFLAGS, and the failure mode without it is the documented relocation error that the author reproduced and confirmed fixed.

No files require special attention.

Important Files Changed

Filename Overview
packaging/copr/build-copr.sh Adds -fPIE to LDFLAGS for Fedora x86_64 COPR builds to fix an R_X86_64_32 relocation error in the aws-lc-sys compiler probe; guard matches the existing nasm BuildRequires pattern.

Reviews (1): Last reviewed commit: "fix(copr): add PIE flag for aws-lc probe" | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.7.5 x -- echo 21.4 ± 1.1 19.5 26.1 1.00
mise x -- echo 23.0 ± 2.0 20.2 46.2 1.08 ± 0.11

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.7.5 env 21.7 ± 1.2 19.4 29.4 1.00
mise env 22.4 ± 1.3 20.0 28.0 1.03 ± 0.08

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.7.5 hook-env 22.7 ± 1.2 20.1 29.0 1.00
mise hook-env 23.3 ± 1.3 20.7 28.2 1.03 ± 0.08

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.7.5 ls 20.0 ± 1.1 17.3 24.9 1.00
mise ls 20.1 ± 1.3 17.9 27.5 1.01 ± 0.09

xtasks/test/perf

Command mise-2026.7.5 mise Variance
install (cached) 178ms 176ms +1%
ls (cached) 66ms 67ms -1%
bin-paths (cached) 70ms 72ms -2%
task-ls (cached) 131ms 135ms -2%

@jdx
jdx merged commit 7d1b73d into main Jul 13, 2026
34 checks passed
@jdx
jdx deleted the codex/fix-copr-pie-probe branch July 13, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant