freebsd support
This commit is contained in:
parent
f0e98691db
commit
a59c4b1b47
2
configure
vendored
2
configure
vendored
@ -212,7 +212,7 @@ case $CFG_CPUTYPE in
|
||||
CFG_CPUTYPE=arm
|
||||
;;
|
||||
|
||||
x86_64 | x86-64 | x64)
|
||||
x86_64 | x86-64 | x64 | amd64)
|
||||
CFG_CPUTYPE=x86_64
|
||||
;;
|
||||
|
||||
|
353
mk/libuv/x86_64/freebsd/Makefile
Normal file
353
mk/libuv/x86_64/freebsd/Makefile
Normal file
@ -0,0 +1,353 @@
|
||||
# We borrow heavily from the kernel build setup, though we are simpler since
|
||||
# we don't have Kconfig tweaking settings on us.
|
||||
|
||||
# The implicit make rules have it looking for RCS files, among other things.
|
||||
# We instead explicitly write all the rules we care about.
|
||||
# It's even quicker (saves ~200ms) to pass -r on the command line.
|
||||
MAKEFLAGS=-r
|
||||
|
||||
# The source directory tree.
|
||||
srcdir := ../../../..
|
||||
|
||||
# The name of the builddir.
|
||||
builddir_name ?= out
|
||||
|
||||
# The V=1 flag on command line makes us verbosely print command lines.
|
||||
ifdef V
|
||||
quiet=
|
||||
else
|
||||
quiet=quiet_
|
||||
endif
|
||||
|
||||
# Specify BUILDTYPE=Release on the command line for a release build.
|
||||
BUILDTYPE ?= Default
|
||||
|
||||
# Directory all our build output goes into.
|
||||
# Note that this must be two directories beneath src/ for unit tests to pass,
|
||||
# as they reach into the src/ directory for data with relative paths.
|
||||
builddir ?= $(builddir_name)/$(BUILDTYPE)
|
||||
abs_builddir := $(abspath $(builddir))
|
||||
depsdir := $(builddir)/.deps
|
||||
|
||||
# Object output directory.
|
||||
obj := $(builddir)/obj
|
||||
abs_obj := $(abspath $(obj))
|
||||
|
||||
# We build up a list of every single one of the targets so we can slurp in the
|
||||
# generated dependency rule Makefiles in one pass.
|
||||
all_deps :=
|
||||
|
||||
|
||||
|
||||
# C++ apps need to be linked with g++.
|
||||
#
|
||||
# Note: flock is used to seralize linking. Linking is a memory-intensive
|
||||
# process so running parallel links can often lead to thrashing. To disable
|
||||
# the serialization, override LINK via an envrionment variable as follows:
|
||||
#
|
||||
# export LINK=g++
|
||||
#
|
||||
# This will allow make to invoke N linker processes as specified in -jN.
|
||||
LINK ?= lockf $(builddir)/linker.lock $(CXX)
|
||||
|
||||
CC.target ?= $(CC)
|
||||
CFLAGS.target ?= $(CFLAGS)
|
||||
CXX.target ?= $(CXX)
|
||||
CXXFLAGS.target ?= $(CXXFLAGS)
|
||||
LINK.target ?= $(LINK)
|
||||
LDFLAGS.target ?= $(LDFLAGS)
|
||||
AR.target ?= $(AR)
|
||||
ARFLAGS.target ?= crs
|
||||
|
||||
# N.B.: the logic of which commands to run should match the computation done
|
||||
# in gyp's make.py where ARFLAGS.host etc. is computed.
|
||||
# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
|
||||
# to replicate this environment fallback in make as well.
|
||||
CC.host ?= gcc
|
||||
CFLAGS.host ?=
|
||||
CXX.host ?= g++
|
||||
CXXFLAGS.host ?=
|
||||
LINK.host ?= g++
|
||||
LDFLAGS.host ?=
|
||||
AR.host ?= ar
|
||||
ARFLAGS.host := crs
|
||||
|
||||
# Define a dir function that can handle spaces.
|
||||
# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
|
||||
# "leading spaces cannot appear in the text of the first argument as written.
|
||||
# These characters can be put into the argument value by variable substitution."
|
||||
empty :=
|
||||
space := $(empty) $(empty)
|
||||
|
||||
# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
|
||||
replace_spaces = $(subst $(space),?,$1)
|
||||
unreplace_spaces = $(subst ?,$(space),$1)
|
||||
dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
|
||||
|
||||
# Flags to make gcc output dependency info. Note that you need to be
|
||||
# careful here to use the flags that ccache and distcc can understand.
|
||||
# We write to a dep file on the side first and then rename at the end
|
||||
# so we can't end up with a broken dep file.
|
||||
depfile = $(depsdir)/$(call replace_spaces,$@).d
|
||||
DEPFLAGS = -MMD -MF $(depfile).raw
|
||||
|
||||
# We have to fixup the deps output in a few ways.
|
||||
# (1) the file output should mention the proper .o file.
|
||||
# ccache or distcc lose the path to the target, so we convert a rule of
|
||||
# the form:
|
||||
# foobar.o: DEP1 DEP2
|
||||
# into
|
||||
# path/to/foobar.o: DEP1 DEP2
|
||||
# (2) we want missing files not to cause us to fail to build.
|
||||
# We want to rewrite
|
||||
# foobar.o: DEP1 DEP2 \
|
||||
# DEP3
|
||||
# to
|
||||
# DEP1:
|
||||
# DEP2:
|
||||
# DEP3:
|
||||
# so if the files are missing, they're just considered phony rules.
|
||||
# We have to do some pretty insane escaping to get those backslashes
|
||||
# and dollar signs past make, the shell, and sed at the same time.
|
||||
# Doesn't work with spaces, but that's fine: .d files have spaces in
|
||||
# their names replaced with other characters.
|
||||
define fixup_dep
|
||||
# The depfile may not exist if the input file didn't have any #includes.
|
||||
touch $(depfile).raw
|
||||
# Fixup path as in (1).
|
||||
sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
|
||||
# Add extra rules as in (2).
|
||||
# We remove slashes and replace spaces with new lines;
|
||||
# remove blank lines;
|
||||
# delete the first line and append a colon to the remaining lines.
|
||||
sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
|
||||
grep -v '^$$' |\
|
||||
sed -e 1d -e 's|$$|:|' \
|
||||
>> $(depfile)
|
||||
rm $(depfile).raw
|
||||
endef
|
||||
|
||||
# Command definitions:
|
||||
# - cmd_foo is the actual command to run;
|
||||
# - quiet_cmd_foo is the brief-output summary of the command.
|
||||
|
||||
quiet_cmd_cc = CC($(TOOLSET)) $@
|
||||
cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
|
||||
|
||||
quiet_cmd_cxx = CXX($(TOOLSET)) $@
|
||||
cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
|
||||
|
||||
quiet_cmd_touch = TOUCH $@
|
||||
cmd_touch = touch $@
|
||||
|
||||
quiet_cmd_copy = COPY $@
|
||||
# send stderr to /dev/null to ignore messages when linking directories.
|
||||
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@")
|
||||
|
||||
quiet_cmd_alink = AR($(TOOLSET)) $@
|
||||
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$^)
|
||||
|
||||
# Due to circular dependencies between libraries :(, we wrap the
|
||||
# special "figure out circular dependencies" flags around the entire
|
||||
# input list during linking.
|
||||
quiet_cmd_link = LINK($(TOOLSET)) $@
|
||||
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
|
||||
|
||||
# We support two kinds of shared objects (.so):
|
||||
# 1) shared_library, which is just bundling together many dependent libraries
|
||||
# into a link line.
|
||||
# 2) loadable_module, which is generating a module intended for dlopen().
|
||||
#
|
||||
# They differ only slightly:
|
||||
# In the former case, we want to package all dependent code into the .so.
|
||||
# In the latter case, we want to package just the API exposed by the
|
||||
# outermost module.
|
||||
# This means shared_library uses --whole-archive, while loadable_module doesn't.
|
||||
# (Note that --whole-archive is incompatible with the --start-group used in
|
||||
# normal linking.)
|
||||
|
||||
# Other shared-object link notes:
|
||||
# - Set SONAME to the library filename so our binaries don't reference
|
||||
# the local, absolute paths used on the link command-line.
|
||||
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
|
||||
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)
|
||||
|
||||
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
|
||||
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
|
||||
|
||||
|
||||
# Define an escape_quotes function to escape single quotes.
|
||||
# This allows us to handle quotes properly as long as we always use
|
||||
# use single quotes and escape_quotes.
|
||||
escape_quotes = $(subst ','\'',$(1))
|
||||
# This comment is here just to include a ' to unconfuse syntax highlighting.
|
||||
# Define an escape_vars function to escape '$' variable syntax.
|
||||
# This allows us to read/write command lines with shell variables (e.g.
|
||||
# $LD_LIBRARY_PATH), without triggering make substitution.
|
||||
escape_vars = $(subst $$,$$$$,$(1))
|
||||
# Helper that expands to a shell command to echo a string exactly as it is in
|
||||
# make. This uses printf instead of echo because printf's behaviour with respect
|
||||
# to escape sequences is more portable than echo's across different shells
|
||||
# (e.g., dash, bash).
|
||||
exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
|
||||
|
||||
# Helper to compare the command we're about to run against the command
|
||||
# we logged the last time we ran the command. Produces an empty
|
||||
# string (false) when the commands match.
|
||||
# Tricky point: Make has no string-equality test function.
|
||||
# The kernel uses the following, but it seems like it would have false
|
||||
# positives, where one string reordered its arguments.
|
||||
# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
|
||||
# $(filter-out $(cmd_$@), $(cmd_$(1))))
|
||||
# We instead substitute each for the empty string into the other, and
|
||||
# say they're equal if both substitutions produce the empty string.
|
||||
# .d files contain ? instead of spaces, take that into account.
|
||||
command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
|
||||
$(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
|
||||
|
||||
# Helper that is non-empty when a prerequisite changes.
|
||||
# Normally make does this implicitly, but we force rules to always run
|
||||
# so we can check their command lines.
|
||||
# $? -- new prerequisites
|
||||
# $| -- order-only dependencies
|
||||
prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
|
||||
|
||||
# Helper that executes all postbuilds, and deletes the output file when done
|
||||
# if any of the postbuilds failed.
|
||||
define do_postbuilds
|
||||
@E=0;\
|
||||
for p in $(POSTBUILDS); do\
|
||||
eval $$p;\
|
||||
F=$$?;\
|
||||
if [ $$F -ne 0 ]; then\
|
||||
E=$$F;\
|
||||
fi;\
|
||||
done;\
|
||||
if [ $$E -ne 0 ]; then\
|
||||
rm -rf "$@";\
|
||||
exit $$E;\
|
||||
fi
|
||||
endef
|
||||
|
||||
# do_cmd: run a command via the above cmd_foo names, if necessary.
|
||||
# Should always run for a given target to handle command-line changes.
|
||||
# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
|
||||
# Third argument, if non-zero, makes it do POSTBUILDS processing.
|
||||
# Note: We intentionally do NOT call dirx for depfile, since it contains ? for
|
||||
# spaces already and dirx strips the ? characters.
|
||||
define do_cmd
|
||||
$(if $(or $(command_changed),$(prereq_changed)),
|
||||
@$(call exact_echo, $($(quiet)cmd_$(1)))
|
||||
@mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
|
||||
$(if $(findstring flock,$(word 1,$(cmd_$1))),
|
||||
@$(cmd_$(1))
|
||||
@echo " $(quiet_cmd_$(1)): Finished",
|
||||
@$(cmd_$(1))
|
||||
)
|
||||
@$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
|
||||
@$(if $(2),$(fixup_dep))
|
||||
$(if $(and $(3), $(POSTBUILDS)),
|
||||
$(call do_postbuilds)
|
||||
)
|
||||
)
|
||||
endef
|
||||
|
||||
# Declare the "all" target first so it is the default,
|
||||
# even though we don't have the deps yet.
|
||||
.PHONY: all
|
||||
all:
|
||||
|
||||
# Use FORCE_DO_CMD to force a target to run. Should be coupled with
|
||||
# do_cmd.
|
||||
.PHONY: FORCE_DO_CMD
|
||||
FORCE_DO_CMD:
|
||||
|
||||
TOOLSET := target
|
||||
# Suffix rules, putting all outputs into $(obj).
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
# Try building from generated source, too.
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
|
||||
@$(call do_cmd,cxx,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
|
||||
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
||||
$(findstring $(join ^,$(prefix)),\
|
||||
$(join ^,src/libuv/run-benchmarks.target.mk)))),)
|
||||
include src/libuv/run-benchmarks.target.mk
|
||||
endif
|
||||
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
||||
$(findstring $(join ^,$(prefix)),\
|
||||
$(join ^,src/libuv/run-tests.target.mk)))),)
|
||||
include src/libuv/run-tests.target.mk
|
||||
endif
|
||||
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
||||
$(findstring $(join ^,$(prefix)),\
|
||||
$(join ^,src/libuv/uv.target.mk)))),)
|
||||
include src/libuv/uv.target.mk
|
||||
endif
|
||||
|
||||
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
||||
cmd_regen_makefile = ./src/libuv/build/gyp/gyp -fmake --ignore-environment "--toplevel-dir=." "--depth=." "--generator-output=mk/libuv/x86_64/unix" "-Dlibrary=static_library" "-Dtarget_arch=x86_64" "-DOS=freebsd" src/libuv/uv.gyp
|
||||
Makefile: $(srcdir)/src/libuv/uv.gyp
|
||||
# $(call do_cmd,regen_makefile)
|
||||
|
||||
# "all" is a concatenation of the "all" targets from all the included
|
||||
# sub-makefiles. This is just here to clarify.
|
||||
all:
|
||||
|
||||
# Add in dependency-tracking rules. $(all_deps) is the list of every single
|
||||
# target in our tree. Only consider the ones with .d (dependency) info:
|
||||
d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
|
||||
ifneq ($(d_files),)
|
||||
# Rather than include each individual .d file, concatenate them into a
|
||||
# single file which make is able to load faster. We split this into
|
||||
# commands that take 1000 files at a time to avoid overflowing the
|
||||
# command line.
|
||||
$(shell cat $(wordlist 1,1000,$(d_files)) > $(depsdir)/all.deps)
|
||||
|
||||
ifneq ($(word 1001,$(d_files)),)
|
||||
$(error Found unprocessed dependency files (gyp didn't generate enough rules!))
|
||||
endif
|
||||
|
||||
# make looks for ways to re-generate included makefiles, but in our case, we
|
||||
# don't have a direct way. Explicitly telling make that it has nothing to do
|
||||
# for them makes it go faster.
|
||||
$(depsdir)/all.deps: ;
|
||||
|
||||
include $(depsdir)/all.deps
|
||||
endif
|
83
mk/libuv/x86_64/freebsd/src/libuv/run-benchmarks.target.mk
Normal file
83
mk/libuv/x86_64/freebsd/src/libuv/run-benchmarks.target.mk
Normal file
@ -0,0 +1,83 @@
|
||||
# This file is generated by gyp; do not edit.
|
||||
|
||||
TOOLSET := target
|
||||
TARGET := run-benchmarks
|
||||
DEFS_Default := '-D_LARGEFILE_SOURCE' \
|
||||
'-D_FILE_OFFSET_BITS=64' \
|
||||
'-D_GNU_SOURCE' \
|
||||
'-DEIO_STACKSIZE=262144'
|
||||
|
||||
# Flags passed to all source files.
|
||||
CFLAGS_Default := -pthread
|
||||
|
||||
# Flags passed to only C files.
|
||||
CFLAGS_C_Default :=
|
||||
|
||||
# Flags passed to only C++ files.
|
||||
CFLAGS_CC_Default :=
|
||||
|
||||
INCS_Default := -I$(srcdir)/src/libuv/include
|
||||
|
||||
OBJS := $(obj).target/$(TARGET)/src/libuv/test/benchmark-ares.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/benchmark-getaddrinfo.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/benchmark-ping-pongs.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/benchmark-pound.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/benchmark-pump.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/benchmark-sizes.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/benchmark-spawn.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/benchmark-tcp-write-batch.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/benchmark-udp-packet-storm.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/dns-server.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/echo-server.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/blackhole-server.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/run-benchmarks.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/runner.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/runner-unix.o
|
||||
|
||||
# Add to the list of files we specially track dependencies for.
|
||||
all_deps += $(OBJS)
|
||||
|
||||
# Make sure our dependencies are built before any of us.
|
||||
$(OBJS): | $(obj).target/src/libuv/libuv.a
|
||||
|
||||
# CFLAGS et al overrides must be target-local.
|
||||
# See "Target-specific Variable Values" in the GNU Make manual.
|
||||
$(OBJS): TOOLSET := $(TOOLSET)
|
||||
$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
|
||||
$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
|
||||
|
||||
# Suffix rules, putting all outputs into $(obj).
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
# Try building from generated source, too.
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
# End of this set of suffix rules
|
||||
### Rules for final target.
|
||||
LDFLAGS_Default :=
|
||||
|
||||
LIBS :=
|
||||
|
||||
$(builddir)/run-benchmarks: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
|
||||
$(builddir)/run-benchmarks: LIBS := $(LIBS)
|
||||
$(builddir)/run-benchmarks: LD_INPUTS := $(OBJS) $(obj).target/src/libuv/libuv.a
|
||||
$(builddir)/run-benchmarks: TOOLSET := $(TOOLSET)
|
||||
$(builddir)/run-benchmarks: $(OBJS) $(obj).target/src/libuv/libuv.a FORCE_DO_CMD
|
||||
$(call do_cmd,link)
|
||||
|
||||
all_deps += $(builddir)/run-benchmarks
|
||||
# Add target alias
|
||||
.PHONY: run-benchmarks
|
||||
run-benchmarks: $(builddir)/run-benchmarks
|
||||
|
||||
# Add executable to "all" target.
|
||||
.PHONY: all
|
||||
all: $(builddir)/run-benchmarks
|
||||
|
117
mk/libuv/x86_64/freebsd/src/libuv/run-tests.target.mk
Normal file
117
mk/libuv/x86_64/freebsd/src/libuv/run-tests.target.mk
Normal file
@ -0,0 +1,117 @@
|
||||
# This file is generated by gyp; do not edit.
|
||||
|
||||
TOOLSET := target
|
||||
TARGET := run-tests
|
||||
DEFS_Default := '-D_LARGEFILE_SOURCE' \
|
||||
'-D_FILE_OFFSET_BITS=64' \
|
||||
'-D_GNU_SOURCE' \
|
||||
'-DEIO_STACKSIZE=262144'
|
||||
|
||||
# Flags passed to all source files.
|
||||
CFLAGS_Default := -pthread
|
||||
|
||||
# Flags passed to only C files.
|
||||
CFLAGS_C_Default :=
|
||||
|
||||
# Flags passed to only C++ files.
|
||||
CFLAGS_CC_Default :=
|
||||
|
||||
INCS_Default := -I$(srcdir)/src/libuv/include
|
||||
|
||||
OBJS := $(obj).target/$(TARGET)/src/libuv/test/blackhole-server.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/echo-server.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/run-tests.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/runner.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-get-loadavg.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-async.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-callback-stack.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-connection-fail.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-delayed-accept.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-fail-always.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-fs.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-fs-event.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-get-currentexe.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-get-memory.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-getaddrinfo.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-gethostbyname.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-getsockname.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-hrtime.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-idle.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-ipc.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-loop-handles.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-multiple-listen.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-pass-always.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-ping-pong.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-pipe-bind-error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-pipe-connect-error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-ref.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-shutdown-eof.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-spawn.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-stdio-over-pipes.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-bind-error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-bind6-error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-close.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-flags.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-connect-error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-connect6-error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-write-error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-write-to-half-open-connection.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tcp-writealot.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-threadpool.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-timer-again.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-timer.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-tty.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-udp-dgram-too-big.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-udp-ipv6.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-udp-send-and-recv.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/test-udp-multicast-join.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/test/runner-unix.o
|
||||
|
||||
# Add to the list of files we specially track dependencies for.
|
||||
all_deps += $(OBJS)
|
||||
|
||||
# Make sure our dependencies are built before any of us.
|
||||
$(OBJS): | $(obj).target/src/libuv/libuv.a
|
||||
|
||||
# CFLAGS et al overrides must be target-local.
|
||||
# See "Target-specific Variable Values" in the GNU Make manual.
|
||||
$(OBJS): TOOLSET := $(TOOLSET)
|
||||
$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
|
||||
$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
|
||||
|
||||
# Suffix rules, putting all outputs into $(obj).
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
# Try building from generated source, too.
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
# End of this set of suffix rules
|
||||
### Rules for final target.
|
||||
LDFLAGS_Default :=
|
||||
|
||||
LIBS :=
|
||||
|
||||
$(builddir)/run-tests: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
|
||||
$(builddir)/run-tests: LIBS := $(LIBS)
|
||||
$(builddir)/run-tests: LD_INPUTS := $(OBJS) $(obj).target/src/libuv/libuv.a
|
||||
$(builddir)/run-tests: TOOLSET := $(TOOLSET)
|
||||
$(builddir)/run-tests: $(OBJS) $(obj).target/src/libuv/libuv.a FORCE_DO_CMD
|
||||
$(call do_cmd,link)
|
||||
|
||||
all_deps += $(builddir)/run-tests
|
||||
# Add target alias
|
||||
.PHONY: run-tests
|
||||
run-tests: $(builddir)/run-tests
|
||||
|
||||
# Add executable to "all" target.
|
||||
.PHONY: all
|
||||
all: $(builddir)/run-tests
|
||||
|
6
mk/libuv/x86_64/freebsd/src/libuv/uv.Makefile
Normal file
6
mk/libuv/x86_64/freebsd/src/libuv/uv.Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# This file is generated by gyp; do not edit.
|
||||
|
||||
export builddir_name ?= mk/libuv/x86_64/unix/./src/libuv/out
|
||||
.PHONY: all
|
||||
all:
|
||||
$(MAKE) -C ../.. uv run-benchmarks run-tests
|
138
mk/libuv/x86_64/freebsd/src/libuv/uv.target.mk
Normal file
138
mk/libuv/x86_64/freebsd/src/libuv/uv.target.mk
Normal file
@ -0,0 +1,138 @@
|
||||
# This file is generated by gyp; do not edit.
|
||||
|
||||
TOOLSET := target
|
||||
TARGET := uv
|
||||
DEFS_Default := '-D_LARGEFILE_SOURCE' \
|
||||
'-D_FILE_OFFSET_BITS=64' \
|
||||
'-D_GNU_SOURCE' \
|
||||
'-DEIO_STACKSIZE=262144' \
|
||||
'-DHAVE_CONFIG_H' \
|
||||
'-DEV_CONFIG_H="config_freebsd.h"' \
|
||||
'-DEIO_CONFIG_H="config_freebsd.h"'
|
||||
|
||||
# Flags passed to all source files.
|
||||
CFLAGS_Default := -pthread \
|
||||
-g \
|
||||
--std=gnu89 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Wno-unused-parameter
|
||||
|
||||
# Flags passed to only C files.
|
||||
CFLAGS_C_Default :=
|
||||
|
||||
# Flags passed to only C++ files.
|
||||
CFLAGS_CC_Default :=
|
||||
|
||||
INCS_Default := -I$(srcdir)/src/libuv/include \
|
||||
-I$(srcdir)/src/libuv/include/uv-private \
|
||||
-I$(srcdir)/src/libuv/src \
|
||||
-I$(srcdir)/src/libuv/src/unix/ev \
|
||||
-I$(srcdir)/src/libuv/src/ares/config_freebsd
|
||||
|
||||
OBJS := $(obj).target/$(TARGET)/src/libuv/src/uv-common.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_cancel.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares__close_sockets.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_data.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_destroy.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_expand_name.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_expand_string.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_fds.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_free_hostent.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_free_string.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_gethostbyaddr.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_gethostbyname.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares__get_hostent.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_getnameinfo.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_getopt.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_getsock.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_init.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_library_init.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_llist.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_mkquery.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_nowarn.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_options.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_parse_aaaa_reply.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_parse_a_reply.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_parse_mx_reply.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_parse_ns_reply.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_parse_ptr_reply.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_parse_srv_reply.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_parse_txt_reply.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_process.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_query.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares__read_line.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_search.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_send.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_strcasecmp.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_strdup.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_strerror.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_timeout.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares__timeval.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_version.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/ares_writev.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/bitncmp.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/inet_net_pton.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/inet_ntop.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/ares/windows_port.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/core.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/uv-eio.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/fs.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/udp.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/tcp.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/pipe.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/tty.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/stream.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/cares.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/dl.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/error.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/process.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/eio/eio.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/ev/ev.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/freebsd.o \
|
||||
$(obj).target/$(TARGET)/src/libuv/src/unix/kqueue.o
|
||||
|
||||
# Add to the list of files we specially track dependencies for.
|
||||
all_deps += $(OBJS)
|
||||
|
||||
# CFLAGS et al overrides must be target-local.
|
||||
# See "Target-specific Variable Values" in the GNU Make manual.
|
||||
$(OBJS): TOOLSET := $(TOOLSET)
|
||||
$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
|
||||
$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
|
||||
|
||||
# Suffix rules, putting all outputs into $(obj).
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
# Try building from generated source, too.
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD
|
||||
@$(call do_cmd,cc,1)
|
||||
|
||||
# End of this set of suffix rules
|
||||
### Rules for final target.
|
||||
LDFLAGS_Default :=
|
||||
|
||||
LIBS := -lm
|
||||
|
||||
$(obj).target/src/libuv/libuv.a: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
|
||||
$(obj).target/src/libuv/libuv.a: LIBS := $(LIBS)
|
||||
$(obj).target/src/libuv/libuv.a: TOOLSET := $(TOOLSET)
|
||||
$(obj).target/src/libuv/libuv.a: $(OBJS) FORCE_DO_CMD
|
||||
$(call do_cmd,alink)
|
||||
|
||||
all_deps += $(obj).target/src/libuv/libuv.a
|
||||
# Add target alias
|
||||
.PHONY: uv
|
||||
uv: $(obj).target/src/libuv/libuv.a
|
||||
|
||||
# Add target alias to "all" target.
|
||||
.PHONY: all
|
||||
all: uv
|
||||
|
@ -24,14 +24,15 @@ endif
|
||||
ifneq ($(findstring freebsd,$(CFG_OSTYPE)),)
|
||||
CFG_LIB_NAME=lib$(1).so
|
||||
CFG_LIB_GLOB=lib$(1)-*.so
|
||||
CFG_GCCISH_CFLAGS += -fPIC -march=i686 -I/usr/local/include
|
||||
CFG_GCCISH_CFLAGS += -fPIC -I/usr/local/include
|
||||
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -lpthread -lrt
|
||||
ifeq ($(CFG_CPUTYPE), x86_64)
|
||||
CFG_GCCISH_CFLAGS_i386 += -m32
|
||||
CFG_GCCISH_LINK_FLAGS_i386 += -m32
|
||||
CFG_GCCISH_CFLAGS_x86_64 += -m32
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64 += -m32
|
||||
endif
|
||||
CFG_GCCISH_DEF_FLAG := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS := -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS := -Wl,-no-whole-archive
|
||||
CFG_GCCISH_CFLAGS_i386 += -m32
|
||||
CFG_GCCISH_LINK_FLAGS_i386 += -m32
|
||||
CFG_GCCISH_CFLAGS_x86_64 += -m64
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64 += -m64
|
||||
CFG_UNIXY := 1
|
||||
CFG_LDENV := LD_LIBRARY_PATH
|
||||
CFG_DEF_SUFFIX := .bsd.def
|
||||
@ -246,4 +247,4 @@ define CFG_MAKE_ASSEMBLER
|
||||
endef
|
||||
|
||||
$(foreach target,$(CFG_TARGET_TRIPLES),\
|
||||
$(eval $(call CFG_MAKE_ASSEMBLER,$(target))))
|
||||
$(eval $(call CFG_MAKE_ASSEMBLER,$(target))))
|
||||
|
9
mk/rt.mk
9
mk/rt.mk
@ -119,6 +119,9 @@ ifeq ($$(CFG_WINDOWSY), 1)
|
||||
else ifeq ($(CFG_OSTYPE), apple-darwin)
|
||||
LIBUV_OSTYPE_$(1) := mac
|
||||
LIBUV_LIB_$(1) := rt/$(1)/libuv/Default/libuv.a
|
||||
else ifeq ($(CFG_OSTYPE), unknown-freebsd)
|
||||
LIBUV_OSTYPE_$(1) := freebsd
|
||||
LIBUV_LIB_$(1) := rt/$(1)/libuv/Default/obj.target/src/libuv/libuv.a
|
||||
else
|
||||
LIBUV_OSTYPE_$(1) := unix
|
||||
LIBUV_LIB_$(1) := rt/$(1)/libuv/Default/obj.target/src/libuv/libuv.a
|
||||
@ -174,6 +177,12 @@ $$(LIBUV_LIB_$(1)): $$(wildcard \
|
||||
# These could go in rt.mk or rustllvm.mk, they're needed for both.
|
||||
|
||||
# This regexp has a single $, escaped twice
|
||||
%.bsd.def: %.def.in $$(MKFILE_DEPS)
|
||||
@$$(call E, def: $$@)
|
||||
$$(Q)echo "{" > $$@
|
||||
$$(Q)sed 's/.$$$$/&;/' $$< >> $$@
|
||||
$$(Q)echo "};" >> $$@
|
||||
|
||||
%.linux.def: %.def.in $$(MKFILE_DEPS)
|
||||
@$$(call E, def: $$@)
|
||||
$$(Q)echo "{" > $$@
|
||||
|
@ -220,6 +220,7 @@ mod write {
|
||||
} else { FileType = LLVMAssemblyFile; }
|
||||
// Write optimized bitcode if --save-temps was on.
|
||||
|
||||
let seg_stack = sess.get_targ_cfg().os != session::os_freebsd;
|
||||
if opts.save_temps {
|
||||
// Always output the bitcode file with --save-temps
|
||||
|
||||
@ -244,7 +245,7 @@ mod write {
|
||||
buf_o,
|
||||
LLVMAssemblyFile,
|
||||
CodeGenOptLevel,
|
||||
true)})});
|
||||
seg_stack)})});
|
||||
}
|
||||
|
||||
|
||||
@ -264,7 +265,7 @@ mod write {
|
||||
buf_o,
|
||||
LLVMObjectFile,
|
||||
CodeGenOptLevel,
|
||||
true)})});
|
||||
seg_stack)})});
|
||||
}
|
||||
} else {
|
||||
// If we aren't saving temps then just output the file
|
||||
@ -282,7 +283,7 @@ mod write {
|
||||
buf_o,
|
||||
FileType,
|
||||
CodeGenOptLevel,
|
||||
true)})});
|
||||
seg_stack)})});
|
||||
}
|
||||
// Clean up and return
|
||||
|
||||
@ -566,7 +567,8 @@ fn link_binary(sess: session::session,
|
||||
let rmlib =
|
||||
bind fn (config: @session::config, filename: str) -> str {
|
||||
if config.os == session::os_macos ||
|
||||
config.os == session::os_linux &&
|
||||
(config.os == session::os_linux ||
|
||||
config.os == session::os_freebsd) &&
|
||||
str::find(filename, "lib") == 0 {
|
||||
ret str::slice(filename, 3u,
|
||||
str::byte_len(filename));
|
||||
@ -580,6 +582,7 @@ fn link_binary(sess: session::session,
|
||||
ret alt config.os {
|
||||
session::os_macos. { rmext(rmlib(filename)) }
|
||||
session::os_linux. { rmext(rmlib(filename)) }
|
||||
session::os_freebsd. { rmext(rmlib(filename)) }
|
||||
_ { rmext(filename) }
|
||||
};
|
||||
}
|
||||
@ -657,6 +660,10 @@ fn link_binary(sess: session::session,
|
||||
gcc_args += ["-lrt", "-ldl"];
|
||||
}
|
||||
|
||||
if sess.get_targ_cfg().os == session::os_freebsd {
|
||||
gcc_args += ["-lrt"];
|
||||
}
|
||||
|
||||
// OS X 10.6 introduced 'compact unwind info', which is produced by the
|
||||
// linker from the dwarf unwind info. Unfortunately, it does not seem to
|
||||
// understand how to unwind our __morestack frame, so we have to turn it
|
||||
|
@ -105,6 +105,7 @@ fn get_rpath_relative_to_output(os: session::os,
|
||||
// Mac doesn't appear to support $ORIGIN
|
||||
let prefix = alt os {
|
||||
session::os_linux. { "$ORIGIN" + fs::path_sep() }
|
||||
session::os_freebsd. { "$ORIGIN" + fs::path_sep() }
|
||||
session::os_macos. { "@executable_path" + fs::path_sep() }
|
||||
};
|
||||
|
||||
@ -191,6 +192,7 @@ fn minimize_rpaths(rpaths: [str]) -> [str] {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#[test]
|
||||
@ -315,6 +317,14 @@ mod test {
|
||||
assert res == "$ORIGIN/../lib";
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn test_rpath_relative() {
|
||||
let res = get_rpath_relative_to_output(session::os_freebsd,
|
||||
"/usr", "bin/rustc", "lib/libstd.so");
|
||||
assert res == "$ORIGIN/../lib";
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn test_rpath_relative() {
|
||||
|
@ -8,6 +8,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
|
||||
session::os_macos. { "__DATA,__note.rustc" }
|
||||
session::os_win32. { ".note.rustc" }
|
||||
session::os_linux. { ".note.rustc" }
|
||||
session::os_freebsd. { ".note.rustc" }
|
||||
},
|
||||
|
||||
data_layout: alt target_os {
|
||||
@ -24,12 +25,17 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
|
||||
session::os_linux. {
|
||||
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
|
||||
}
|
||||
|
||||
session::os_freebsd. {
|
||||
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
|
||||
}
|
||||
},
|
||||
|
||||
target_triple: alt target_os {
|
||||
session::os_macos. { "i686-apple-darwin" }
|
||||
session::os_win32. { "i686-pc-mingw32" }
|
||||
session::os_linux. { "i686-unknown-linux-gnu" }
|
||||
session::os_freebsd. { "i686-unknown-freebsd" }
|
||||
},
|
||||
|
||||
gcc_args: ["-m32"]
|
||||
|
@ -8,6 +8,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
|
||||
session::os_macos. { "__DATA,__note.rustc" }
|
||||
session::os_win32. { ".note.rustc" }
|
||||
session::os_linux. { ".note.rustc" }
|
||||
session::os_freebsd. { ".note.rustc" }
|
||||
},
|
||||
|
||||
data_layout: alt target_os {
|
||||
@ -29,12 +30,19 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
|
||||
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
|
||||
"s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
}
|
||||
|
||||
session::os_freebsd. {
|
||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
|
||||
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
|
||||
"s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
}
|
||||
},
|
||||
|
||||
target_triple: alt target_os {
|
||||
session::os_macos. { "x86_64-apple-darwin" }
|
||||
session::os_win32. { "x86_64-pc-mingw32" }
|
||||
session::os_linux. { "x86_64-unknown-linux-gnu" }
|
||||
session::os_freebsd. { "x86_64-unknown-freebsd" }
|
||||
},
|
||||
|
||||
gcc_args: ["-m64"]
|
||||
|
@ -26,6 +26,7 @@ fn default_configuration(sess: session::session, argv0: str, input: str) ->
|
||||
session::os_win32. { "msvcrt.dll" }
|
||||
session::os_macos. { "libc.dylib" }
|
||||
session::os_linux. { "libc.so.6" }
|
||||
session::os_freebsd. { "libc.so.7" }
|
||||
_ { "libc.so" }
|
||||
};
|
||||
|
||||
@ -294,6 +295,8 @@ fn get_os(triple: str) -> session::os {
|
||||
session::os_macos
|
||||
} else if str::find(triple, "linux") >= 0 {
|
||||
session::os_linux
|
||||
} else if str::find(triple, "freebsd") >= 0 {
|
||||
session::os_freebsd
|
||||
} else { early_error("Unknown operating system!") };
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import syntax::parse::parser::parse_sess;
|
||||
import util::filesearch;
|
||||
import back::target_strs;
|
||||
|
||||
tag os { os_win32; os_macos; os_linux; }
|
||||
tag os { os_win32; os_macos; os_linux; os_freebsd; }
|
||||
|
||||
tag arch { arch_x86; arch_x86_64; arch_arm; }
|
||||
|
||||
|
@ -129,6 +129,7 @@ fn default_native_lib_naming(sess: session::session, static: bool) ->
|
||||
session::os_win32. { ret {prefix: "", suffix: ".dll"}; }
|
||||
session::os_macos. { ret {prefix: "lib", suffix: ".dylib"}; }
|
||||
session::os_linux. { ret {prefix: "lib", suffix: ".so"}; }
|
||||
session::os_freebsd. { ret {prefix: "lib", suffix: ".so"}; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5152,6 +5152,8 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
|
||||
fn main_name() -> str { ret "main"; }
|
||||
#[cfg(target_os = "linux")]
|
||||
fn main_name() -> str { ret "main"; }
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn main_name() -> str { ret "main"; }
|
||||
let llfty = T_fn([ccx.int_type, ccx.int_type], ccx.int_type);
|
||||
let llfn = decl_cdecl_fn(ccx.llmod, main_name(), llfty);
|
||||
let llbb = str::as_buf("top", {|buf|
|
||||
|
@ -163,6 +163,7 @@ fn maybe_with_lib_path<T>(path: str, f: fn@() -> T) -> T {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn maybe_with_lib_path<T>(_path: str, f: fn@() -> T) -> T {
|
||||
f()
|
||||
}
|
||||
|
@ -309,6 +309,7 @@ fn program_output(cx: cx, testfile: str, lib_path: str, prog: str,
|
||||
// Linux and mac don't require adjusting the library search path
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn make_cmdline(_libpath: str, prog: str, args: [str]) -> str {
|
||||
#fmt["%s %s", prog, str::connect(args, " ")]
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ fn make_new_path(path: str) -> str {
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn lib_path_env_var() -> str { "LD_LIBRARY_PATH" }
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
@ -27,6 +28,7 @@ fn lib_path_env_var() -> str { "PATH" }
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn path_div() -> str { ":" }
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
|
@ -22,6 +22,9 @@ native mod f64 {
|
||||
#[link_name="log"] pure fn ln(n: f64) -> f64;
|
||||
#[link_name="log1p"] pure fn ln1p(n: f64) -> f64;
|
||||
pure fn log10(n: f64) -> f64;
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os="win32")]
|
||||
pure fn log2(n: f64) -> f64;
|
||||
pure fn modf(n: f64, iptr: *f64) -> f64;
|
||||
pure fn pow(n: f64, e: f64) -> f64;
|
||||
@ -56,6 +59,9 @@ native mod f32 {
|
||||
#[link_name="ldexpf"] pure fn ldexp(x: f32, n: c_int) -> f32;
|
||||
#[link_name="logf"] pure fn ln(n: f32) -> f32;
|
||||
#[link_name="log1p"] pure fn ln1p(n: f64) -> f64;
|
||||
#[cfg(target_os="linux")]
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os="win32")]
|
||||
#[link_name="log2f"] pure fn log2(n: f32) -> f32;
|
||||
#[link_name="log10f"] pure fn log10(n: f32) -> f32;
|
||||
#[link_name="modff"] pure fn modf(n: f32, iptr: *f32) -> f32;
|
||||
|
@ -114,6 +114,11 @@ mod consts {
|
||||
const ln_10: f32 = 2.30258509299404568401799145468436421f32;
|
||||
}
|
||||
|
||||
#[cfg(target_os="freebsd")]
|
||||
pure fn log2(n: f32) -> f32 {
|
||||
ret ln(n) / ln(2f32)
|
||||
}
|
||||
|
||||
//
|
||||
// Local Variables:
|
||||
// mode: rust
|
||||
|
@ -114,6 +114,11 @@ mod consts {
|
||||
const ln_10: f64 = 2.30258509299404568401799145468436421f64;
|
||||
}
|
||||
|
||||
#[cfg(target_os="freebsd")]
|
||||
pure fn log2(n: f64) -> f64 {
|
||||
ret ln(n) / ln(2f64)
|
||||
}
|
||||
|
||||
//
|
||||
// Local Variables:
|
||||
// mode: rust
|
||||
|
155
src/libstd/freebsd_os.rs
Normal file
155
src/libstd/freebsd_os.rs
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
Module: os
|
||||
|
||||
TODO: Restructure and document
|
||||
*/
|
||||
|
||||
import core::option;
|
||||
import core::ctypes::*;
|
||||
|
||||
export libc;
|
||||
export libc_constants;
|
||||
export pipe;
|
||||
export fd_FILE;
|
||||
export close;
|
||||
export fclose;
|
||||
export waitpid;
|
||||
export getcwd;
|
||||
export exec_suffix;
|
||||
export target_os;
|
||||
export dylib_filename;
|
||||
export get_exe_path;
|
||||
export fsync_fd;
|
||||
|
||||
// FIXME Somehow merge stuff duplicated here and macosx_os.rs. Made difficult
|
||||
// by https://github.com/graydon/rust/issues#issue/268
|
||||
|
||||
#[link_name = ""] // FIXME remove after #[nolink] is snapshotted
|
||||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
native mod libc {
|
||||
fn read(fd: fd_t, buf: *u8, count: size_t) -> ssize_t;
|
||||
fn write(fd: fd_t, buf: *u8, count: size_t) -> ssize_t;
|
||||
fn fread(buf: *u8, size: size_t, n: size_t, f: libc::FILE) -> size_t;
|
||||
fn fwrite(buf: *u8, size: size_t, n: size_t, f: libc::FILE) -> size_t;
|
||||
fn open(s: str::sbuf, flags: c_int, mode: unsigned) -> fd_t;
|
||||
fn close(fd: fd_t) -> c_int;
|
||||
type FILE;
|
||||
fn fopen(path: str::sbuf, mode: str::sbuf) -> FILE;
|
||||
fn fdopen(fd: fd_t, mode: str::sbuf) -> FILE;
|
||||
fn fclose(f: FILE);
|
||||
fn fflush(f: FILE) -> c_int;
|
||||
fn fsync(fd: fd_t) -> c_int;
|
||||
fn fileno(f: FILE) -> fd_t;
|
||||
fn fgetc(f: FILE) -> c_int;
|
||||
fn ungetc(c: c_int, f: FILE);
|
||||
fn feof(f: FILE) -> c_int;
|
||||
fn fseek(f: FILE, offset: long, whence: c_int) -> c_int;
|
||||
fn ftell(f: FILE) -> long;
|
||||
type dir;
|
||||
fn opendir(d: str::sbuf) -> dir;
|
||||
fn closedir(d: dir) -> c_int;
|
||||
type dirent;
|
||||
fn readdir(d: dir) -> dirent;
|
||||
fn getenv(n: str::sbuf) -> str::sbuf;
|
||||
fn setenv(n: str::sbuf, v: str::sbuf, overwrite: c_int) -> c_int;
|
||||
fn unsetenv(n: str::sbuf) -> c_int;
|
||||
fn pipe(buf: *mutable fd_t) -> c_int;
|
||||
fn waitpid(pid: pid_t, &status: c_int, options: c_int) -> pid_t;
|
||||
fn readlink(path: str::sbuf, buf: str::sbuf, bufsize: size_t) -> ssize_t;
|
||||
fn mkdir(path: str::sbuf, mode: c_int) -> c_int;
|
||||
fn rmdir(path: str::sbuf) -> c_int;
|
||||
fn chdir(path: str::sbuf) -> c_int;
|
||||
|
||||
fn sysctl(name: *c_int, namelen: c_uint,
|
||||
oldp: *u8, &oldlenp: size_t,
|
||||
newp: *u8, newlen: size_t) -> c_int;
|
||||
}
|
||||
|
||||
mod libc_constants {
|
||||
const O_RDONLY: c_int = 0i32;
|
||||
const O_WRONLY: c_int = 1i32;
|
||||
const O_RDWR: c_int = 2i32;
|
||||
const O_APPEND: c_int = 8i32;
|
||||
const O_CREAT: c_int = 512i32;
|
||||
const O_EXCL: c_int = 2048i32;
|
||||
const O_TRUNC: c_int = 1024i32;
|
||||
const O_TEXT: c_int = 0i32; // nonexistent in FreeBSD libc
|
||||
const O_BINARY: c_int = 0i32; // nonexistent in FreeBSD libc
|
||||
|
||||
const S_IRUSR: unsigned = 256u32;
|
||||
const S_IWUSR: unsigned = 128u32;
|
||||
|
||||
const CTL_KERN: c_int = 1i32;
|
||||
const KERN_PROC: c_int = 14i32;
|
||||
const KERN_PROC_PATHNAME: c_int = 12i32;
|
||||
}
|
||||
|
||||
fn pipe() -> {in: fd_t, out: fd_t} {
|
||||
let fds = {mutable in: 0i32, mutable out: 0i32};
|
||||
assert (os::libc::pipe(ptr::mut_addr_of(fds.in)) == 0i32);
|
||||
ret {in: fds.in, out: fds.out};
|
||||
}
|
||||
|
||||
fn fd_FILE(fd: fd_t) -> libc::FILE {
|
||||
ret str::as_buf("r", {|modebuf| libc::fdopen(fd, modebuf) });
|
||||
}
|
||||
|
||||
fn close(fd: fd_t) -> c_int {
|
||||
libc::close(fd)
|
||||
}
|
||||
|
||||
fn fclose(file: libc::FILE) {
|
||||
libc::fclose(file)
|
||||
}
|
||||
|
||||
fn fsync_fd(fd: fd_t, _l: io::fsync::level) -> c_int {
|
||||
ret libc::fsync(fd);
|
||||
}
|
||||
|
||||
fn waitpid(pid: pid_t) -> i32 {
|
||||
let status = 0i32;
|
||||
assert (os::libc::waitpid(pid, status, 0i32) != -1i32);
|
||||
ret status;
|
||||
}
|
||||
|
||||
#[abi = "cdecl"]
|
||||
native mod rustrt {
|
||||
fn rust_getcwd() -> str;
|
||||
}
|
||||
|
||||
fn getcwd() -> str { ret rustrt::rust_getcwd(); }
|
||||
|
||||
fn exec_suffix() -> str { ret ""; }
|
||||
|
||||
fn target_os() -> str { ret "freebsd"; }
|
||||
|
||||
fn dylib_filename(base: str) -> str { ret "lib" + base + ".so"; }
|
||||
|
||||
/// Returns the directory containing the running program
|
||||
/// followed by a path separator
|
||||
fn get_exe_path() -> option::t<fs::path> unsafe {
|
||||
let bufsize = 1023u;
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(0u8, bufsize));
|
||||
let mib = [libc_constants::CTL_KERN,
|
||||
libc_constants::KERN_PROC,
|
||||
libc_constants::KERN_PROC_PATHNAME, -1i32];
|
||||
ret str::as_buf(path, { |path_buf|
|
||||
if libc::sysctl(vec::unsafe::to_ptr(mib),
|
||||
vec::len(mib) as c_uint,
|
||||
path_buf, bufsize,
|
||||
ptr::null(), 0u) == 0i32 {
|
||||
option::some(fs::dirname(path) + fs::path_sep())
|
||||
} else {
|
||||
option::none
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
// mode: rust;
|
||||
// fill-column: 78;
|
||||
// indent-tabs-mode: nil
|
||||
// c-basic-offset: 4
|
||||
// buffer-file-coding-system: utf-8-unix
|
||||
// End:
|
@ -148,6 +148,7 @@ fn make_dir(p: path, mode: ctypes::c_int) -> bool {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn mkdir(_p: path, _mode: ctypes::c_int) -> bool {
|
||||
ret str::as_buf(_p, {|buf| os::libc::mkdir(buf, _mode) == 0i32 });
|
||||
}
|
||||
@ -186,6 +187,7 @@ fn remove_dir(p: path) -> bool {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn rmdir(_p: path) -> bool {
|
||||
ret str::as_buf(_p, {|buf| os::libc::rmdir(buf) == 0i32 });
|
||||
}
|
||||
@ -201,6 +203,7 @@ fn change_dir(p: path) -> bool {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn chdir(_p: path) -> bool {
|
||||
ret str::as_buf(_p, {|buf| os::libc::chdir(buf) == 0i32 });
|
||||
}
|
||||
@ -367,6 +370,7 @@ fn normalize(p: path) -> path {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn reabsolute(orig: path, new: path) -> path {
|
||||
if path_is_absolute(orig) {
|
||||
path_sep() + new
|
||||
|
@ -28,6 +28,7 @@ fn setenv(n: str, v: str) { }
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn getenv(n: str) -> option::t<str> unsafe {
|
||||
let s = str::as_buf(n, {|buf| os::libc::getenv(buf) });
|
||||
ret if unsafe::reinterpret_cast(s) == 0 {
|
||||
@ -40,6 +41,7 @@ fn getenv(n: str) -> option::t<str> unsafe {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn setenv(n: str, v: str) {
|
||||
// FIXME (868)
|
||||
str::as_buf(
|
||||
|
@ -266,6 +266,7 @@ fn waitpid(pid: pid_t) -> int {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn waitpid_os(pid: pid_t) -> int {
|
||||
#[cfg(target_os = "linux")]
|
||||
fn WIFEXITED(status: i32) -> bool {
|
||||
@ -273,6 +274,7 @@ fn waitpid(pid: pid_t) -> int {
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn WIFEXITED(status: i32) -> bool {
|
||||
(status & 0x7fi32) == 0i32
|
||||
}
|
||||
@ -283,6 +285,7 @@ fn waitpid(pid: pid_t) -> int {
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn WEXITSTATUS(status: i32) -> i32 {
|
||||
status >> 8i32
|
||||
}
|
||||
|
@ -98,6 +98,13 @@ mod os;
|
||||
#[path = "posix_fs.rs"]
|
||||
mod os_fs;
|
||||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[path = "freebsd_os.rs"]
|
||||
mod os;
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[path = "posix_fs.rs"]
|
||||
mod os_fs;
|
||||
|
||||
// Local Variables:
|
||||
// mode: rust;
|
||||
// fill-column: 78;
|
||||
|
@ -5,6 +5,7 @@ the C libuv API. Does very little right now pending scheduler improvements.
|
||||
|
||||
#[cfg(target_os = "linux")];
|
||||
#[cfg(target_os = "macos")];
|
||||
#[cfg(target_os = "freebsd")];
|
||||
|
||||
export sanity_check;
|
||||
export loop_t, idle_t;
|
||||
@ -39,6 +40,7 @@ type idle_cb = opaque_cb;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
type handle_private_fields = {
|
||||
a00: ctypes::c_int,
|
||||
a01: ctypes::c_int,
|
||||
@ -121,6 +123,7 @@ fn sanity_check() {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn handle_fields_new() -> handle_fields {
|
||||
{
|
||||
loop: ptr::null(),
|
||||
@ -149,4 +152,4 @@ fn idle_new() -> idle_t {
|
||||
{
|
||||
fields: handle_fields_new()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,20 +16,20 @@ ___morestack:
|
||||
__morestack:
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_startproc
|
||||
#endif
|
||||
|
||||
pushl %ebp
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_def_cfa_offset 8
|
||||
.cfi_offset %ebp, -8
|
||||
#endif
|
||||
|
||||
movl %esp,%ebp // save esp
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_def_cfa_register %ebp
|
||||
#endif
|
||||
|
||||
@ -42,6 +42,6 @@ __morestack:
|
||||
|
||||
ret
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_endproc
|
||||
#endif
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@
|
||||
#define UPCALL_DEL_STACK L_upcall_del_stack$stub
|
||||
#define MORESTACK ___morestack
|
||||
#else
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#define UPCALL_NEW_STACK upcall_new_stack
|
||||
#define UPCALL_DEL_STACK upcall_del_stack
|
||||
#define RUST_GET_TASK rust_get_task
|
||||
@ -93,7 +93,7 @@
|
||||
.globl MORESTACK
|
||||
|
||||
// FIXME: What about _WIN32?
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
.hidden MORESTACK
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
@ -106,7 +106,7 @@
|
||||
#endif
|
||||
|
||||
MORESTACK:
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_startproc
|
||||
#endif
|
||||
|
||||
@ -125,7 +125,7 @@ MORESTACK:
|
||||
// __morestack, and an extra return address.
|
||||
|
||||
pushl %ebp
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
// The CFA is 20 bytes above the register that it is
|
||||
// associated with for this frame (which will be %ebp)
|
||||
.cfi_def_cfa_offset 20
|
||||
@ -133,7 +133,7 @@ MORESTACK:
|
||||
.cfi_offset %ebp, -20
|
||||
#endif
|
||||
movl %esp, %ebp
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
// Calculate the CFA as an offset from %ebp
|
||||
.cfi_def_cfa_register %ebp
|
||||
#endif
|
||||
@ -216,7 +216,7 @@ MORESTACK:
|
||||
// FIXME: I don't think these rules are necessary
|
||||
// since the unwinder should never encounter an instruction
|
||||
// pointer pointing here.
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
// Restore the rule for how to find %ebp
|
||||
.cfi_restore %ebp
|
||||
// Tell the unwinder how to find the CFA in terms of %esp
|
||||
@ -234,7 +234,7 @@ MORESTACK:
|
||||
|
||||
jmpl *%eax
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_endproc
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
.globl GET_SP
|
||||
.globl CHECK_STACK
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
RECORD_SP:
|
||||
movl 4(%esp), %eax
|
||||
movl %eax, %gs:48
|
||||
|
@ -23,19 +23,19 @@ ___morestack:
|
||||
__morestack:
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_startproc
|
||||
#endif
|
||||
|
||||
push %rbp
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset %rbp, -16
|
||||
#endif
|
||||
|
||||
mov %rsp,%rbp // save rsp
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_def_cfa_register %rbp
|
||||
#endif
|
||||
|
||||
@ -46,6 +46,6 @@ __morestack:
|
||||
|
||||
ret
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
.cfi_endproc
|
||||
#endif
|
||||
|
@ -31,7 +31,11 @@ extern "C" void __morestack(void *args, void *fn_ptr, uintptr_t stack_ptr);
|
||||
|
||||
class context {
|
||||
public:
|
||||
#ifdef __FreeBSD__
|
||||
registers_t regs __attribute__(aligned(16));
|
||||
#else
|
||||
registers_t regs;
|
||||
#endif
|
||||
|
||||
context();
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
.globl UPCALL_DEL_STACK
|
||||
.globl MORESTACK
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
.hidden MORESTACK
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||
MORESTACK:
|
||||
.cfi_startproc
|
||||
|
||||
@ -92,6 +92,9 @@ MORESTACK:
|
||||
#ifdef __linux__
|
||||
call UPCALL_NEW_STACK@PLT
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
call UPCALL_NEW_STACK@PLT
|
||||
#endif
|
||||
|
||||
// Pop the saved arguments
|
||||
movdqa (%rsp), %xmm0
|
||||
@ -135,6 +138,9 @@ MORESTACK:
|
||||
#ifdef __linux__
|
||||
call UPCALL_DEL_STACK@PLT
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
call UPCALL_DEL_STACK@PLT
|
||||
#endif
|
||||
|
||||
popq %rax // Restore the return value
|
||||
popq %rbp
|
||||
|
@ -14,7 +14,7 @@
|
||||
.globl GET_SP
|
||||
.globl CHECK_STACK
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
RECORD_SP:
|
||||
movq %rdi, %fs:112
|
||||
ret
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <stdint.h>
|
||||
#include "rust_abi.h"
|
||||
|
||||
#if defined(__APPLE__) || defined(__linux__)
|
||||
#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__)
|
||||
#define HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#elif defined(_WIN32)
|
||||
|
@ -23,6 +23,8 @@
|
||||
#define RZ_MAC_32 (1024*20)
|
||||
#define RZ_MAC_64 (1024*20)
|
||||
#define RZ_WIN_32 (1024*20)
|
||||
#define RZ_BSD_32 (1024*20)
|
||||
#define RZ_BSD_64 (1024*20)
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef __i386__
|
||||
@ -48,6 +50,14 @@
|
||||
#define RED_ZONE_SIZE RZ_WIN_64
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#ifdef __i386__
|
||||
#define RED_ZONE_SIZE RZ_BSD_32
|
||||
#endif
|
||||
#ifdef __x86_64__
|
||||
#define RED_ZONE_SIZE RZ_BSD_64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// A value that goes at the end of the stack and must not be touched
|
||||
const uint8_t stack_canary[] = {0xAB, 0xCD, 0xAB, 0xCD,
|
||||
|
@ -20,7 +20,7 @@
|
||||
// the rust stack and happen frequently enough to catch most stack changes,
|
||||
// including at the beginning of all landing pads.
|
||||
// FIXME: Enable this for windows
|
||||
#if defined __linux__ || defined __APPLE__
|
||||
#if defined __linux__ || defined __APPLE__ || defined __FreeBSD__
|
||||
extern "C" void
|
||||
check_stack_alignment() __attribute__ ((aligned (16)));
|
||||
#else
|
||||
|
@ -8,4 +8,7 @@ mod hello;
|
||||
mod hello;
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
mod hello;
|
||||
mod hello;
|
||||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
mod hello;
|
||||
|
@ -19,4 +19,5 @@ fn main() {
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn main() { }
|
||||
|
@ -24,4 +24,5 @@ fn main() {
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn main() { }
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
#[cfg(target_os = "linux")];
|
||||
#[cfg(target_os = "macos")];
|
||||
#[cfg(target_os = "freebsd")];
|
||||
|
||||
import core::*;
|
||||
|
||||
@ -44,4 +45,4 @@ mod test_ref {
|
||||
uv::loop_delete(loop);
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user