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

Commit

Permalink
(PA-6383) Enable PIE for RHEL,Ubuntu and Debian
Browse files Browse the repository at this point in the history
(PA-6383) Exclude ppc64 architecture

(PA-6383) Fix Spaces

(PA-6383) Exclude ppc64 arch
  • Loading branch information
skyamgarp committed Aug 9, 2024
1 parent 3b5b4ab commit d315dcc
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
8 changes: 8 additions & 0 deletions configs/components/_base-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
elsif platform.architecture == 'arm64' && platform.os_version.to_i >= 13
pkg.environment 'CC', 'clang'
end
elsif((platform.is_sles? && platform.os_version.to_i >= 15) ||
(platform.is_el? && platform.os_version.to_i >= 8 && platform.architecture !~ /ppc64/) ||
(platform.is_debian? && platform.os_version.to_i >= 10) ||
(platform.is_ubuntu? && platform.os_version.to_i >= 20) ||
platform.is_fedora?
)
pkg.environment 'LDFLAGS', settings[:ldflags]
pkg.environment 'optflags', settings[:cflags]
end

####################
Expand Down
7 changes: 6 additions & 1 deletion configs/components/augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@
end
end

if platform.name =~ /sles-15|el-8|debian-10/ || platform.is_fedora?
if((platform.is_sles? && platform.os_version.to_i >= 15) ||
(platform.is_el? && platform.os_version.to_i >= 8 && platform.architecture !~ /ppc64/) ||
(platform.is_debian? && platform.os_version.to_i >= 10) ||
(platform.is_ubuntu? && platform.os_version.to_i >= 20) ||
platform.is_fedora?
)
pkg.environment 'CFLAGS', settings[:cflags]
pkg.environment 'CPPFLAGS', settings[:cppflags]
pkg.environment "LDFLAGS", settings[:ldflags]
Expand Down
7 changes: 6 additions & 1 deletion configs/components/ruby-2.7.8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@

special_flags = " --prefix=#{ruby_dir} --with-opt-dir=#{settings[:prefix]} "

if platform.name =~ /sles-15|el-8|debian-10/
if((platform.is_sles? && platform.os_version.to_i >= 15) ||
(platform.is_el? && platform.os_version.to_i >= 8 && platform.architecture !~ /ppc64/) ||
(platform.is_debian? && platform.os_version.to_i >= 10) ||
(platform.is_ubuntu? && platform.os_version.to_i >= 20) ||
platform.is_fedora?
)
special_flags += " CFLAGS='#{settings[:cflags]}' LDFLAGS='#{settings[:ldflags]}' CPPFLAGS='#{settings[:cppflags]}' "
end

Expand Down
7 changes: 6 additions & 1 deletion configs/components/ruby-3.2.5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@

special_flags = " --prefix=#{ruby_dir} --with-opt-dir=#{settings[:prefix]} "

if platform.name =~ /sles-15|el-8|debian-10/
if((platform.is_sles? && platform.os_version.to_i >= 15) ||
(platform.is_el? && platform.os_version.to_i >= 8 && platform.architecture !~ /ppc64/) ||
(platform.is_debian? && platform.os_version.to_i >= 10) ||
(platform.is_ubuntu? && platform.os_version.to_i >= 20) ||
platform.is_fedora?
)
special_flags += " CFLAGS='#{settings[:cflags]}' LDFLAGS='#{settings[:ldflags]}' CPPFLAGS='#{settings[:cppflags]}' "
end

Expand Down
7 changes: 6 additions & 1 deletion configs/components/runtime-bolt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
pkg.install_file "#{settings[:tools_root]}/bin/libgdbm_compat-4.dll", "#{settings[:ruby_bindir]}/libgdbm_compat-4.dll"
pkg.install_file "#{settings[:tools_root]}/bin/libiconv-2.dll", "#{settings[:ruby_bindir]}/libiconv-2.dll"
pkg.install_file "#{settings[:tools_root]}/bin/libffi-6.dll", "#{settings[:ruby_bindir]}/libffi-6.dll"
elsif platform.is_macos? or platform.name =~ /sles-15|el-8|debian-10|ubuntu-20.04|ubuntu-22.04/ || platform.is_fedora?
elsif ( (platform.is_sles? && platform.os_version.to_i >= 15) ||
(platform.is_el? && platform.os_version.to_i >= 8) ||
(platform.is_debian? && platform.os_version.to_i >= 10) ||
(platform.is_ubuntu? && platform.os_version.to_i >= 20) ||
platform.is_fedora? || platform.is_macos?
)

# Do nothing for distros that have a suitable compiler do not use pl-build-tools

Expand Down
8 changes: 7 additions & 1 deletion configs/projects/_shared-agent-settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@
# stack canary and full RELRO.
# We only do this on platforms that use their default OS toolchain since pl-gcc versions
# are too old to support these flags.
if platform.name =~ /sles-15|el-8|debian-10/ || platform.is_fedora?

if((platform.is_sles? && platform.os_version.to_i >= 15) ||
(platform.is_el? && platform.os_version.to_i >= 8 && platform.architecture !~ /ppc64/) ||
(platform.is_debian? && platform.os_version.to_i >= 10) ||
(platform.is_ubuntu? && platform.os_version.to_i >= 20) ||
platform.is_fedora?
)
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")
Expand Down

0 comments on commit d315dcc

Please sign in to comment.