Skip to content

Commit 3bc479d

Browse files
committed
---
yaml --- r: 51181 b: refs/heads/try c: d617030 h: refs/heads/master i: 51179: 5e4d090 v: v3
1 parent 9ae5ffe commit 3bc479d

File tree

20 files changed

+33
-116
lines changed

20 files changed

+33
-116
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
5-
refs/heads/try: 686f448b0ccacf66eb48d1f15fb9d51b4f9678e6
5+
refs/heads/try: d617030d635c0d93fb969d76a622774133f61f7a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,9 +1539,9 @@ for spawning [tasks][tasks].
15391539

15401540
Rust closures have a convenient subtyping property: you can pass any kind of
15411541
closure (as long as the arguments and return types match) to functions
1542-
that expect a `fn()`. Thus, when writing a higher-order function that
1542+
that expect a `&fn()`. Thus, when writing a higher-order function that
15431543
only calls its function argument, and does nothing else with it, you
1544-
should almost always declare the type of that argument as `fn()`. That way,
1544+
should almost always declare the type of that argument as `&fn()`. That way,
15451545
callers may pass any kind of closure.
15461546

15471547
~~~~

branches/try/mk/install.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ $(foreach target,$(CFG_TARGET_TRIPLES), \
5151
define INSTALL_TARGET_N
5252
install-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
5353
$$(Q)mkdir -p $$(PTL$(1)$(2))
54-
$$(Q)$$(call INSTALL_LIB,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
54+
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
5555
$$(Q)$$(call INSTALL_LIB, \
5656
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB_$(1)))
5757
$$(Q)$$(call INSTALL_LIB, \
5858
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(STDLIB_GLOB_$(1)))
59-
$$(Q)$$(call INSTALL_LIB,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
59+
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
6060

6161
endef
6262

6363
define INSTALL_HOST_N
6464
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
6565
$$(Q)mkdir -p $$(PTL$(1)$(2))
66-
$$(Q)$$(call INSTALL_LIB,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
66+
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
6767
$$(Q)$$(call INSTALL_LIB, \
6868
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB_$(1)))
6969
$$(Q)$$(call INSTALL_LIB, \
@@ -80,7 +80,7 @@ install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
8080
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTI_GLOB_$(1)))
8181
$$(Q)$$(call INSTALL_LIB, \
8282
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUST_GLOB_$(1)))
83-
$$(Q)$$(call INSTALL_LIB,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
83+
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
8484

8585
endef
8686

branches/try/mk/platform.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ ifdef CFG_VALGRIND
6161
endif
6262

6363
ifneq ($(findstring linux,$(CFG_OSTYPE)),)
64+
# -znoexecstack is here because librt is for some reason being created
65+
# with executable stack and Fedora (or SELinux) doesn't like that (#798)
6466
ifdef CFG_PERF
6567
ifneq ($(CFG_PERF_WITH_LOGFD),)
6668
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 --log-fd 2
@@ -124,7 +126,7 @@ CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-gnu := -fno-rtti
124126
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-gnu := -shared -fPIC -ldl -lpthread -lrt -g -m64
125127
CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
126128
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-linux-gnu := -Wl,-whole-archive
127-
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-linux-gnu := -Wl,-no-whole-archive
129+
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-linux-gnu := -Wl,-no-whole-archive -Wl,-znoexecstack
128130
CFG_DEF_SUFFIX_x86_64-unknown-linux-gnu := .linux.def
129131
CFG_INSTALL_NAME_x86_64-unknown-linux-gnu =
130132
CFG_LIBUV_LINK_FLAGS_x86_64-unknown-linux-gnu =
@@ -150,7 +152,7 @@ CFG_GCCISH_CXXFLAGS_i686-unknown-linux-gnu := -fno-rtti
150152
CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-gnu := -shared -fPIC -ldl -lpthread -lrt -g -m32
151153
CFG_GCCISH_DEF_FLAG_i686-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
152154
CFG_GCCISH_PRE_LIB_FLAGS_i686-unknown-linux-gnu := -Wl,-whole-archive
153-
CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-linux-gnu := -Wl,-no-whole-archive
155+
CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-linux-gnu := -Wl,-no-whole-archive -Wl,-znoexecstack
154156
CFG_DEF_SUFFIX_i686-unknown-linux-gnu := .linux.def
155157
CFG_INSTALL_NAME_i686-unknown-linux-gnu =
156158
CFG_LIBUV_LINK_FLAGS_i686-unknown-linux-gnu =
@@ -226,7 +228,7 @@ CFG_GCCISH_CXXFLAGS_arm-linux-androideabi := -fno-rtti
226228
CFG_GCCISH_LINK_FLAGS_arm-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++ -lgnustl_shared
227229
CFG_GCCISH_DEF_FLAG_arm-linux-androideabi := -Wl,--export-dynamic,--dynamic-list=
228230
CFG_GCCISH_PRE_LIB_FLAGS_arm-linux-androideabi := -Wl,-whole-archive
229-
CFG_GCCISH_POST_LIB_FLAGS_arm-linux-androideabi := -Wl,-no-whole-archive
231+
CFG_GCCISH_POST_LIB_FLAGS_arm-linux-androideabi := -Wl,-no-whole-archive -Wl,-znoexecstack
230232
CFG_DEF_SUFFIX_arm-linux-androideabi := .android.def
231233
CFG_INSTALL_NAME_arm-linux-androideabi =
232234
CFG_LIBUV_LINK_FLAGS_arm-linux-androideabi =

branches/try/src/libcore/str.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,10 +1865,8 @@ pub struct CharRange {
18651865
* Given a byte position and a str, return the previous char and its position
18661866
*
18671867
* This function can be used to iterate over a unicode string in reverse.
1868-
*
1869-
* returns 0 for next index if called on start index 0
18701868
*/
1871-
pub fn char_range_at_reverse(ss: &str, start: uint) -> CharRange {
1869+
fn char_range_at_reverse(ss: &str, start: uint) -> CharRange {
18721870
let mut prev = start;
18731871

18741872
// while there is a previous byte == 10......
@@ -1877,12 +1875,7 @@ pub fn char_range_at_reverse(ss: &str, start: uint) -> CharRange {
18771875
}
18781876

18791877
// now refer to the initial byte of previous char
1880-
if prev > 0u {
1881-
prev -= 1u;
1882-
} else {
1883-
prev = 0u;
1884-
}
1885-
1878+
prev -= 1u;
18861879

18871880
let ch = char_at(ss, prev);
18881881
return CharRange {ch:ch, next:prev};
@@ -3768,10 +3761,4 @@ mod tests {
37683761
"12345555".cmp(& &"123456") == Less;
37693762
"22".cmp(& &"1234") == Greater;
37703763
}
3771-
3772-
#[test]
3773-
fn test_char_range_at_reverse_underflow() {
3774-
assert!(char_range_at_reverse("abc", 0).next == 0);
3775-
}
3776-
37773764
}

branches/try/src/rt/arch/arm/_context.S

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
.text
72
.code 32
83
.arm
@@ -22,12 +17,12 @@ swap_registers:
2217
str r10, [r0, #40]
2318
str r11, [r0, #44]
2419
str r12, [r0, #48]
25-
str sp, [r0, #52]
20+
str sp, [r0, #52]
2621
str lr, [r0, #56]
2722

2823
mrs r2, cpsr
2924
str r2, [r0, #64]
30-
25+
3126

3227
ldr r0, [r1, #0]
3328
ldr r3, [r1, #12]
@@ -40,10 +35,10 @@ swap_registers:
4035
ldr r10, [r1, #40]
4136
ldr r11, [r1, #44]
4237
ldr r12, [r1, #48]
43-
38+
4439
ldr sp, [r1, #52]
4540
ldr lr, [r1, #56]
46-
41+
4742
ldr r2, [r1, #64]
4843
msr cpsr_cxsf, r2
4944

branches/try/src/rt/arch/arm/ccall.S

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
.text
72
.code 32
83
.arm
@@ -24,3 +19,4 @@ __morestack:
2419
pop {r4, fp, lr}
2520
mov pc, lr
2621
.fnend
22+

branches/try/src/rt/arch/arm/morestack.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
.text
72
.code 32
83
.arm

branches/try/src/rt/arch/arm/record_sp.S

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
.text
72
.code 32
83
.arm
@@ -50,17 +45,17 @@ get_sp_limit:
5045
get_sp:
5146
mov r0, sp
5247
mov pc, lr
53-
48+
5449
.data
5550
my_cpu: .long 0
5651
.global my_array
57-
my_array:
58-
.long 0
52+
my_array:
5953
.long 0
6054
.long 0
6155
.long 0
6256
.long 0
6357
.long 0
6458
.long 0
6559
.long 0
60+
.long 0
6661
.end

branches/try/src/rt/arch/i386/_context.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
.text
72

83
/*

branches/try/src/rt/arch/i386/ccall.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
/*
72
The function for switching to the C stack. It is called
83
__morestack because gdb allows any frame with that name to

branches/try/src/rt/arch/i386/morestack.S

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
/*
72
__morestack
83
@@ -223,11 +218,11 @@ MORESTACK:
223218
.L$bail:
224219
movl 32(%esp),%eax
225220
inc %eax
226-
221+
227222
addl $44, %esp
228223
popl %ebp
229224
addl $4+8,%esp
230-
225+
231226
jmpl *%eax
232227

233228
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
@@ -246,7 +241,7 @@ L_rust_get_task$stub:
246241
L_upcall_new_stack$stub:
247242
.indirect_symbol _upcall_new_stack
248243
.ascii "\364\364\364\364\364"
249-
244+
250245
L_upcall_del_stack$stub:
251246
.indirect_symbol _upcall_del_stack
252247
.ascii "\364\364\364\364\364"
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif

branches/try/src/rt/arch/mips/_context.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
.text
72
.globl swap_registers
83
.align 2

branches/try/src/rt/arch/mips/ccall.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
.text
72

83
.globl __morestack

branches/try/src/rt/arch/mips/record_sp.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
.text
72

83
.globl record_sp_limit

branches/try/src/rt/arch/x86_64/_context.S

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
#include "regs.h"
72
#define ARG0 RUSTRT_ARG0_S
83
#define ARG1 RUSTRT_ARG1_S
9-
4+
105
.text
116

127
/*
@@ -16,7 +11,7 @@ and Microsoft discussion at
1611
http://msdn.microsoft.com/en-US/library/9z1stfyw%28v=VS.80%29.aspx.
1712
1813
BOTH CALLING CONVENTIONS
19-
14+
2015
Callee save registers:
2116
R12--R15, RDI, RSI, RBX, RBP, RSP
2217
XMM0--XMM5
@@ -35,7 +30,7 @@ User flags have no specified role and are not preserved
3530
across calls, with the exception of DF in %rFLAGS,
3631
which must be clear (set to "forward" direction)
3732
on function entry and return.
38-
33+
3934
MICROSOFT CALLING CONVENTIONS
4035
4136
Return value: RAX
@@ -44,15 +39,15 @@ First four arguments:
4439
RCX, RDX, R8, R9
4540
XMM0, XMM1, XMM2, XMM3
4641
*/
47-
42+
4843
/*
4944
Stores current registers into arg0/RCX and restores
5045
registers found in arg1/RDX. This is used by our
5146
implementation of getcontext. Only saves/restores nonvolatile
5247
registers and the register used for the first argument.
5348
Volatile registers in general ought to be saved by the caller
5449
anyhow.
55-
*/
50+
*/
5651

5752
#if defined(__APPLE__) || defined(_WIN32)
5853
#define SWAP_REGISTERS _swap_registers

branches/try/src/rt/arch/x86_64/ccall.S

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
/*
72
The function for switching to the C stack. It is called
83
__morestack because gdb allows any frame with that name to
@@ -15,7 +10,7 @@
1510
#define ARG0 RUSTRT_ARG0_S
1611
#define ARG1 RUSTRT_ARG1_S
1712
#define ARG2 RUSTRT_ARG2_S
18-
13+
1914
.text
2015

2116
#if defined(__APPLE__) || defined(_WIN32)

branches/try/src/rt/arch/x86_64/morestack.S

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif
5-
61
/*
72
__morestack
83
@@ -83,7 +78,7 @@ MORESTACK:
8378
movq %r11, %rdx // Size of stack arguments
8479
movq %rax, %rsi // Address of stack arguments
8580
movq %r10, %rdi // The amount of stack needed
86-
81+
8782
#ifdef __APPLE__
8883
call UPCALL_NEW_STACK
8984
#endif
@@ -137,7 +132,7 @@ MORESTACK:
137132
popq %rax // Restore the return value
138133
popq %rbp
139134
ret
140-
135+
141136
.cfi_endproc
142137

143138
#else
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
// Mark stack as non-executable
2-
#if defined(__linux__) && defined(__ELF__)
3-
.section .note.GNU-stack, "", @progbits
4-
#endif

0 commit comments

Comments
 (0)