Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

(PA-6896) Enable pie on RHEL 9 and up #906

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/components/ruby-3.2.5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
special_flags = " --prefix=#{ruby_dir} --with-opt-dir=#{settings[:prefix]} "

if settings[:supports_pie]
special_flags += " CFLAGS='#{settings[:cflags]}' LDFLAGS='#{settings[:ldflags]}' CPPFLAGS='#{settings[:cppflags]}' "
special_flags += " CFLAGS='-fPIC -fstack-protector-strong -fno-plt -O2' LDFLAGS='#{settings[:ldflags]}' CPPFLAGS='-fPIE #{settings[:cppflags]}' "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe why you're removing :cflags from here? What problem is being solved aside from "pie doesn't work"? Does this mean none of the cflags defined in the project are being passed to the configure command?

end

# Ruby's build process requires a "base" ruby and we need a ruby to install
Expand Down
6 changes: 5 additions & 1 deletion configs/projects/_shared-compiler-settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# are too old to support these flags.

if((platform.is_sles? && platform.os_version.to_i >= 15) ||
(platform.is_el? && platform.os_version.to_i == 8 && platform.architecture !~ /ppc64/) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean RHEL 9 ppc now supports pie? If so, the commit message should mention the change in behavior.

(platform.is_debian? && platform.os_version.to_i >= 10) ||
(platform.is_ubuntu? && platform.os_version.to_i >= 22) ||
platform.is_fedora?
Expand All @@ -21,4 +20,9 @@
proj.setting(:cppflags, "-I#{proj.includedir} -D_FORTIFY_SOURCE=2")
proj.setting(:cflags, '-fstack-protector-strong -fno-plt -O2')
proj.setting(:ldflags, "-L#{proj.libdir} -Wl,-rpath=#{proj.libdir},-z,relro,-z,now")
elsif(platform.is_el? && platform.os_version.to_i >= 8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elsif(platform.is_el? && platform.os_version.to_i >= 8)
elsif platform.is_el? && platform.os_version.to_i >= 8

proj.setting(:supports_pie, true)
proj.setting(:cppflags, "-I#{proj.includedir} -D_FORTIFY_SOURCE=2")
proj.setting(:cflags, '-fPIC -pie -fstack-protector-strong -fno-plt -O2')
proj.setting(:ldflags, "-L#{proj.libdir} -Wl,-rpath=#{proj.libdir},-z,relro,-z,now")
end
Loading