Skip to content

Commit

Permalink
Add support for virtualized (xen) platforms (i.e. amazon ec2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpokrywka committed Nov 24, 2011
1 parent f200d48 commit b76ece9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# Should be included last in the command string, even after PlatformInfo.portability_cflags.
EXTRA_CXXFLAGS = "-Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long"
EXTRA_CXXFLAGS << " -Wno-missing-field-initializers" if PlatformInfo.compiler_supports_wno_missing_field_initializers_flag?
EXTRA_CXXFLAGS << " -mno-tls-direct-seg-refs" if PlatformInfo.requires_no_tls_direct_seg_refs? && PlatformInfo.compiler_supports_no_tls_direct_seg_refs_option?
EXTRA_CXXFLAGS << " #{OPTIMIZATION_FLAGS}" if !OPTIMIZATION_FLAGS.empty?

# Extra linker flags that should always be passed to the linker.
Expand Down
5 changes: 5 additions & 0 deletions lib/phusion_passenger/platform_info/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ def self.compiler_supports_wno_missing_field_initializers_flag?
end
memoize :compiler_supports_wno_missing_field_initializers_flag?

def self.compiler_supports_no_tls_direct_seg_refs_option?
return try_compile(:c, '', '-mno-tls-direct-seg-refs')
end
memoize :compiler_supports_no_tls_direct_seg_refs_option?, true

# Returns whether compiling C++ with -fvisibility=hidden might result
# in tons of useless warnings, like this:
# http://code.google.com/p/phusion-passenger/issues/detail?id=526
Expand Down
5 changes: 5 additions & 0 deletions lib/phusion_passenger/platform_info/operating_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ def self.supports_lfence_instruction?
}))
end
memoize :supports_lfence_instruction?, true

def self.requires_no_tls_direct_seg_refs?
return File.exists?("/proc/xen/capabilities")
end
memoize :requires_no_tls_direct_seg_refs?, true
end

end # module PhusionPassenger

0 comments on commit b76ece9

Please sign in to comment.