summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/alpha/dl-machine.h6
-rw-r--r--sysdeps/generic/machine-gmon.h4
-rw-r--r--sysdeps/generic/sbrk.c18
-rw-r--r--sysdeps/mach/hurd/getcwd.c6
-rw-r--r--sysdeps/posix/profil.c14
5 files changed, 38 insertions, 10 deletions
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index 2bf8f9b7ec..3704c25c3c 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -217,7 +217,11 @@ _dl_start_user:
jsr $26, ($0)
ldgp $gp, 0($26)
br 1b
-2: /* Pass our finalizer function to the user in $0. */
+2: /* Clear the startup flag. */
+ .set at
+ stl $31, _dl_starting_up
+ .set noat
+ /* Pass our finalizer function to the user in $0. */
lda $0, _dl_fini
/* Jump to the user's entry point. */
mov $9, $27
diff --git a/sysdeps/generic/machine-gmon.h b/sysdeps/generic/machine-gmon.h
index 115962a601..43bf62d663 100644
--- a/sysdeps/generic/machine-gmon.h
+++ b/sysdeps/generic/machine-gmon.h
@@ -46,6 +46,6 @@ static inline void mcount_internal (frompc, selfpc)
#define MCOUNT \
void _mcount (void) \
{ \
- mcount_internal ((u_long) __builtin_return_address (0), \
- (u_long) __builtin_return_address (1)); \
+ mcount_internal ((u_long) __builtin_return_address (1), \
+ (u_long) __builtin_return_address (0)); \
}
diff --git a/sysdeps/generic/sbrk.c b/sysdeps/generic/sbrk.c
index f63195adb3..d3ea705294 100644
--- a/sysdeps/generic/sbrk.c
+++ b/sysdeps/generic/sbrk.c
@@ -38,8 +38,22 @@ __sbrk (ptrdiff_t increment)
instances of __brk and __sbrk can share the heap, returning
interleaved pieces of it. */
if (__curbrk == NULL || __libc_multiple_libcs)
- if (__brk (0) < 0)
- return (void *) -1;
+ {
+ extern void _end;
+
+ if (__brk (0) < 0) /* Initialize the break. */
+ return (void *) -1;
+
+ /* Align break address to page boundary if not happened before. */
+ if (!__libc_multiple_libcs && __curbrk == &_end)
+ {
+ size_t pg = __getpagesize ();
+ ptrdiff_t rest = pg - ((&_end - (void *) 0) & (pg - 1));
+
+ if (__brk (__curbrk + rest) < 0)
+ return (void *) -1;
+ }
+ }
if (increment == 0)
return __curbrk;
diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c
index daa67fb858..4df2524afb 100644
--- a/sysdeps/mach/hurd/getcwd.c
+++ b/sysdeps/mach/hurd/getcwd.c
@@ -229,8 +229,12 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir,
free (file_name);
return NULL;
}
- file_namep = &buf[file_namep - file_name];
+ file_namep = &buf[file_namep - file_name + size / 2];
file_name = buf;
+ /* Move current contents up to the end of the buffer.
+ This is guaranteed to be non-overlapping. */
+ memcpy (file_namep, file_namep - size / 2,
+ file_name + size - file_namep);
}
}
file_namep -= d->d_namlen;
diff --git a/sysdeps/posix/profil.c b/sysdeps/posix/profil.c
index 8e34b3564f..a6786b1a13 100644
--- a/sysdeps/posix/profil.c
+++ b/sysdeps/posix/profil.c
@@ -37,7 +37,13 @@ static u_int pc_scale;
static inline void
profil_count (void *pc)
{
- size_t i = ((pc - pc_offset - (void *) 0) / 2) * pc_scale / 65536;
+ size_t i = (pc - pc_offset - (void *) 0) / 2;
+
+ if (sizeof (unsigned long long int) > sizeof (size_t))
+ i = (unsigned long long int) i * pc_scale / 65536;
+ else
+ i = i / 65536 * pc_scale + i % 65536 * pc_scale / 65536;
+
if (i < nsamples)
++samples[i];
}
@@ -65,11 +71,11 @@ profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
if (samples == NULL)
/* Wasn't turned on. */
return 0;
- samples = NULL;
- if (sigaction (SIGPROF, &oact, NULL) < 0)
+ if (setitimer (ITIMER_PROF, &otimer, NULL) < 0)
return -1;
- return setitimer (ITIMER_PROF, &otimer, NULL);
+ samples = NULL;
+ return sigaction (SIGPROF, &oact, NULL);
}
samples = sample_buffer;