2001-04-25  Ulrich Drepper  <drepper@redhat.com>

	* malloc/malloc.c: Allow MALLOC_ALIGNMENT to be defined on the
	compiler command line.
	* sysdeps/hppa/Makefile: Add -DMALLOC_ALIGNMENT=16 to compiler
	command line for malloc.c.
This commit is contained in:
Ulrich Drepper 2001-04-26 00:07:06 +00:00
parent e0ea35832e
commit c3fa6e3dc7
5 changed files with 39 additions and 26 deletions

View File

@ -1,3 +1,10 @@
2001-04-25 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c: Allow MALLOC_ALIGNMENT to be defined on the
compiler command line.
* sysdeps/hppa/Makefile: Add -DMALLOC_ALIGNMENT=16 to compiler
command line for malloc.c.
2001-04-25 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/sparc/sparc64/bits/time.h: Move to...

2
README
View File

@ -11,7 +11,7 @@ configurations:
alpha*-*-linux-gnu Linux-2.x on DEC Alpha
powerpc-*-linux-gnu Linux and MkLinux on PowerPC systems
sparc-*-linux-gnu Linux-2.x on SPARC
sparc64-*-linux-gnu Linux-2.x on UltraSPARC
sparc64-*-linux-gnu Linux-2.x on UltraSPARC 64-bit
arm-*-none ARM standalone systems
arm-*-linux Linux-2.x on ARM
arm-*-linuxaout Linux-2.x on ARM using a.out binaries

View File

@ -1292,7 +1292,10 @@ static void free_atfork();
/* sizes, alignments */
#define SIZE_SZ (sizeof(INTERNAL_SIZE_T))
#define MALLOC_ALIGNMENT (SIZE_SZ + SIZE_SZ)
/* Allow the default to be overwritten on the compiler command line. */
#ifndef MALLOC_ALIGNMENT
# define MALLOC_ALIGNMENT (SIZE_SZ + SIZE_SZ)
#endif
#define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1)
#define MINSIZE (sizeof(struct malloc_chunk))

View File

@ -22,6 +22,10 @@
# CFLAGS-.os += -ffunction-sections
LDFLAGS-c_pic.os += -Wl,--unique=.text*
ifeq ($(subdir),malloc)
CFLAGS-malloc.c += -DMALLOC_ALIGNMENT=16
endif
ifeq ($(subdir),elf)
dl-routines += dl-symaddr dl-fptr
rtld-routines += dl-symaddr dl-fptr

View File

@ -90,10 +90,10 @@ __get_clockfreq_via_proc_openprom (void)
obp_fd = open ("/proc/openprom", O_RDONLY);
if (obp_fd != -1)
{
unsigned long buf[4096 / sizeof (unsigned long)];
unsigned long int buf[4096 / sizeof (unsigned long int)];
struct dirent *dirp = (struct dirent *) buf;
off_t dbase = (off_t) 0;
int len;
ssize_t len;
while ((len = getdirentries (obp_fd, (char *) dirp,
sizeof (buf), &dbase)) > 0)
@ -103,13 +103,16 @@ __get_clockfreq_via_proc_openprom (void)
while (len > 0)
{
char node_name[strlen ("/proc/openprom/")
+ this_dirp->d_reclen
+ _D_ALLOC_NAMLEN (this_dirp)
+ strlen ("/clock-frequency")];
int fd;
strcpy (node_name, "/proc/openprom/");
strcat (node_name, this_dirp->d_name);
strcat (node_name, "/device_type");
/* Note that
strlen("/clock-frequency") > strlen("/device_type")
*/
stpcpy (stpcpy (stpcpy (node_name, "/proc/openprom/"),
this_dirp->d_name),
"/device_type");
fd = open (node_name, O_RDONLY);
if (fd != -1)
{
@ -117,20 +120,20 @@ __get_clockfreq_via_proc_openprom (void)
int ret;
ret = read (fd, type_string, sizeof (type_string));
if (ret > 0 && !strncmp (type_string, "'cpu'", 5))
if (ret > 0 && strncmp (type_string, "'cpu'", 5) == 0)
{
int clkfreq_fd;
strcpy (node_name, "/proc/openprom/");
strcat (node_name, this_dirp->d_name);
strcat (node_name, "/clock-frequency");
stpcpy (stpcpy (stpcpy (node_name, "/proc/openprom/"),
this_dirp->d_name),
"/clock-frequency");
clkfreq_fd = open (node_name, O_RDONLY);
if (fd != -1)
{
if (read (clkfreq_fd, type_string,
sizeof (type_string)) > 0)
result = (hp_timing_t)
strtol (type_string, (char **)NULL, 16);
strtoull (type_string, NULL, 16);
close (clkfreq_fd);
}
}
@ -142,7 +145,7 @@ __get_clockfreq_via_proc_openprom (void)
len -= this_dirp->d_reclen;
this_dirp = (struct dirent *)
((char *)this_dirp + this_dirp->d_reclen);
((char *) this_dirp + this_dirp->d_reclen);
}
if (result != 0)
break;
@ -170,11 +173,11 @@ __get_clockfreq_via_dev_openprom (void)
obp_cmd->oprom_size =
sizeof (obp_buf) - sizeof (unsigned int);
*(int *)obp_cmd->oprom_array = 0;
*(int *) obp_cmd->oprom_array = 0;
ret = ioctl (obp_dev_fd, OPROMCHILD, (char *) obp_cmd);
if (ret == 0)
{
int cur_node = *(int *)obp_cmd->oprom_array;
int cur_node = *(int *) obp_cmd->oprom_array;
while (cur_node != 0 && cur_node != -1)
{
@ -182,19 +185,18 @@ __get_clockfreq_via_dev_openprom (void)
strcpy (obp_cmd->oprom_array, "device_type");
ret = ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd);
if (ret == 0
&& !strncmp (obp_cmd->oprom_array, "cpu", 3))
&& strncmp (obp_cmd->oprom_array, "cpu", 3) == 0)
{
obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int);
obp_cmd->oprom_size = (sizeof (obp_buf)
- sizeof (unsigned int));
strcpy (obp_cmd->oprom_array, "clock-frequency");
ret = ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd);
if (ret == 0)
{
result = (hp_timing_t)
*(unsigned int *)obp_cmd->oprom_array;
}
result =
(hp_timing_t) *(unsigned int *) obp_cmd->oprom_array;
}
obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int);
*(int *)obp_cmd->oprom_array = cur_node;
*(int *) obp_cmd->oprom_array = cur_node;
ret = ioctl (obp_dev_fd, OPROMNEXT, (char *) obp_cmd);
if (ret < 0)
break;
@ -219,7 +221,6 @@ __get_clockfreq (void)
It contains at least one line like
Cpu0ClkTick : 000000002cb41780
We search for this line and convert the number in an integer. */
result = __get_clockfreq_via_cpuinfo ();
if (result != 0)
return result;
@ -227,13 +228,11 @@ __get_clockfreq (void)
/* If that did not work, try to find an OpenPROM node
with device_type equal to 'cpu' using /dev/openprom
and fetch the clock-frequency property from there. */
result = __get_clockfreq_via_dev_openprom ();
if (result != 0)
return result;
/* Finally, try the same lookup as above but using /proc/openprom. */
result = __get_clockfreq_via_proc_openprom ();
return result;