Compare commits
79 commits
master
...
rwth/stage
Author | SHA1 | Date | |
---|---|---|---|
3cf7888fea | |||
![]() |
5c63d9cb54 | ||
![]() |
70df86673d | ||
![]() |
f27c0ade36 | ||
![]() |
b377e52d6f | ||
![]() |
e4b3ed8457 | ||
![]() |
99260a0ed2 | ||
![]() |
74d2d63a2b | ||
![]() |
06d34e9b67 | ||
![]() |
3cc46a34f1 | ||
![]() |
6e3f1171de | ||
![]() |
b3b4862b79 | ||
![]() |
27ef95794b | ||
![]() |
d489ba9755 | ||
![]() |
393fdf06c5 | ||
![]() |
3bea9865ad | ||
![]() |
d47bdb3104 | ||
![]() |
f220fc6d4b | ||
![]() |
15b6e7749a | ||
![]() |
774f919a1b | ||
![]() |
548cf25120 | ||
![]() |
a125dd6dce | ||
![]() |
1b38a3bb93 | ||
![]() |
34a883b767 | ||
![]() |
fcdb3ac07c | ||
![]() |
b9b25e2a90 | ||
![]() |
23688400f9 | ||
![]() |
f8bb08ccf2 | ||
![]() |
a9de2d2641 | ||
![]() |
75becf673e | ||
![]() |
6561c9511c | ||
![]() |
7bd559b0a7 | ||
![]() |
5c256e4e16 | ||
![]() |
64a7fafe41 | ||
![]() |
2b26565b16 | ||
![]() |
119d54c545 | ||
![]() |
562f54c6f0 | ||
![]() |
fb765930ef | ||
![]() |
048e64213f | ||
![]() |
f2a52656b2 | ||
![]() |
86f9941629 | ||
![]() |
532c631f85 | ||
![]() |
83ea776de8 | ||
![]() |
bdebe44a26 | ||
![]() |
7f8e4d2934 | ||
![]() |
f1dd432a53 | ||
![]() |
0277f11570 | ||
![]() |
8f7e53b90e | ||
![]() |
9af10f2f53 | ||
![]() |
7228ff3b12 | ||
![]() |
8a337ad337 | ||
![]() |
b84b044437 | ||
![]() |
358030b63a | ||
![]() |
d2017a1dd6 | ||
![]() |
2d10d42f0b | ||
![]() |
8c6c1ee634 | ||
![]() |
87668dd5cc | ||
![]() |
211fa113f0 | ||
![]() |
2e75a39295 | ||
![]() |
15908ecd3b | ||
![]() |
0bf9a45722 | ||
![]() |
aee7b9de52 | ||
![]() |
83a4832d15 | ||
![]() |
c26a8fa4f8 | ||
![]() |
21b6fdf309 | ||
![]() |
719b54b05a | ||
![]() |
187140ae99 | ||
![]() |
eaaaaeb4bd | ||
![]() |
6eefe8f2bd | ||
![]() |
fc34006203 | ||
![]() |
65d1d08f3c | ||
![]() |
f0c0a764ea | ||
![]() |
0b49fb79a9 | ||
![]() |
2214869297 | ||
![]() |
03cf4a4f94 | ||
![]() |
239ee0c051 | ||
![]() |
840a28465d | ||
![]() |
5a5ddb35e2 | ||
9a2cb452e5 |
5350 changed files with 1794418 additions and 302 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -6,3 +6,8 @@
|
|||
documentation/html/
|
||||
include/eduos/config.h
|
||||
include/eduos/config.inc
|
||||
newlib/tmp/
|
||||
newlib/x86/
|
||||
tools/initrd.img
|
||||
tools/make_initrd
|
||||
newlib/examples/hello
|
||||
|
|
4
.travis.yml
Normal file
4
.travis.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
language: c
|
||||
compiler: gcc
|
||||
before_install: sudo apt-get update
|
||||
install: sudo apt-get install nasm
|
106
Makefile.example → Makefile.in
Normal file → Executable file
106
Makefile.example → Makefile.in
Normal file → Executable file
|
@ -1,31 +1,27 @@
|
|||
TERM = xterm
|
||||
TOPDIR = $(shell pwd)
|
||||
ARCH = x86
|
||||
TERM = xterm
|
||||
BIT = 32
|
||||
NAME = eduos
|
||||
KERNDIRS = libkern kernel mm arch/$(ARCH)/kernel arch/$(ARCH)/mm
|
||||
KERNDIRS = libkern kernel mm fs arch/$(ARCH)/kernel arch/$(ARCH)/mm
|
||||
SUBDIRS = $(KERNDIRS)
|
||||
|
||||
# Set your own cross compiler tool chain prefix here
|
||||
CROSSCOMPREFIX =
|
||||
|
||||
CC_FOR_TARGET = $(CROSSCOMPREFIX)gcc
|
||||
CXX_FOR_TARGET = $(CROSSCOMPREFIX)g++
|
||||
GCC_FOR_TARGET = $(CROSSCOMPREFIX)gcc
|
||||
CPP_FOR_TARGET = $(CROSSCOMPREFIX)cpp
|
||||
AR_FOR_TARGET = $(CROSSCOMPREFIX)ar
|
||||
AS_FOR_TARGET = $(CROSSCOMPREFIX)as
|
||||
LD_FOR_TARGET = $(CROSSCOMPREFIX)ld
|
||||
NM_FOR_TARGET = $(CROSSCOMPREFIX)nm
|
||||
OBJDUMP_FOR_TARGET = $(CROSSCOMPREFIX)objdump
|
||||
OBJCOPY_FOR_TARGET = $(CROSSCOMPREFIX)objcopy
|
||||
RANLIB_FOR_TARGET = $(CROSSCOMPREFIX)ranlib
|
||||
STRIP_FOR_TARGET = $(CROSSCOMPREFIX)strip
|
||||
READELF_FOR_TARGET = $(CROSSCOMPREFIX)readelf
|
||||
STACKPROT =
|
||||
|
||||
CC_FOR_TARGET = @CC_FOR_TARGET@
|
||||
CXX_FOR_TARGET = @CXX_FOR_TARGET@
|
||||
GCC_FOR_TARGET = @GCC_FOR_TARGET@
|
||||
CPP_FOR_TARGET = @CPP_FOR_TARGET@
|
||||
AR_FOR_TARGET = @AR_FOR_TARGET@
|
||||
AS_FOR_TARGET = @AS_FOR_TARGET@
|
||||
LD_FOR_TARGET = @LD_FOR_TARGET@
|
||||
NM_FOR_TARGET = @NM_FOR_TARGET@
|
||||
OBJDUMP_FOR_TARGET = @OBJDUMP_FOR_TARGET@
|
||||
OBJCOPY_FOR_TARGET = @OBJCOPY_FOR_TARGET@
|
||||
RANLIB_FOR_TARGET = @RANLIB_FOR_TARGET@
|
||||
STRIP_FOR_TARGET = @STRIP_FOR_TARGET@
|
||||
READELF_FOR_TARGET = @READELF_FOR_TARGET@
|
||||
NASM = nasm
|
||||
NASMFLAGS = -felf32 -g -i$(TOPDIR)/include/eduos/
|
||||
GDB = $(CROSSCOMPREFIX)gdb
|
||||
GDBFLAGS = -x debug.gdb
|
||||
QEMU = qemu-system-i386
|
||||
QEMUFLAGS = -smp 2 -monitor stdio \
|
||||
-net nic,model=rtl8139 \
|
||||
|
@ -36,11 +32,12 @@ QEMUDEBUGFLAGS = -monitor none -daemonize \
|
|||
QEMUSERIALFLAGS = -device pci-serial,chardev=tS0 \
|
||||
-chardev socket,host=localhost,port=4555,server,id=tS0
|
||||
|
||||
NASMFLAGS = -felf32 -g -i$(TOPDIR)/include/eduos/
|
||||
INCLUDE = -I$(TOPDIR)/include -I$(TOPDIR)/arch/$(ARCH)/include
|
||||
# Compiler options for final code
|
||||
CFLAGS = -g -m32 -march=i586 -Wall -O2 -fno-builtin -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc $(INCLUDE) -fno-stack-protector
|
||||
# Compiler options for debugging
|
||||
debug debug-eclipse : CFLAGS = -g -O0 -m32 -march=i586 -Wall -fno-builtin -DWITH_FRAME_POINTER -nostdinc $(INCLUDE) -fno-stack-protector
|
||||
#CFLAGS = -g -O -m32 -march=i586 -Wall -fno-builtin -DWITH_FRAME_POINTER -nostdinc $(INCLUDE) -fno-stack-protector
|
||||
AR = ar
|
||||
ARFLAGS = rsv
|
||||
RM = rm -rf
|
||||
|
@ -48,6 +45,12 @@ LDFLAGS = -T link.ld -z max-page-size=4096 --defsym __BUILD_DATE=$(shell date +'
|
|||
STRIP_DEBUG = --strip-debug
|
||||
KEEP_DEBUG = --only-keep-debug
|
||||
|
||||
CFLAGS_FOR_NEWLIB = -m$(BIT) $(STACKPROT)
|
||||
LDFLAGS_FOR_NEWLIB = -m$(BIT)
|
||||
NASMFLAGS_FOR_NEWLIB = -felf$(BIT)
|
||||
CFLAGS_FOR_TOOLS = -m$(BIT) -O2 -Wall
|
||||
LDFLAGS_FOR_TOOLS =
|
||||
|
||||
# Prettify output
|
||||
V = 0
|
||||
ifeq ($V,0)
|
||||
|
@ -57,40 +60,70 @@ endif
|
|||
|
||||
default: all
|
||||
|
||||
all: $(NAME).elf
|
||||
all: newlib tools $(NAME).elf
|
||||
|
||||
newlib:
|
||||
$Q$(MAKE) ARCH=$(ARCH) BIT=$(BIT) \
|
||||
LDFLAGS="$(LDFLAGS_FOR_NEWLIB)" \
|
||||
CFLAGS="$(CFLAGS_FOR_NEWLIB)" \
|
||||
NASMFLAGS="$(NASMFLAGS_FOR_NEWLIB)" \
|
||||
CC_FOR_TARGET=$(CC_FOR_TARGET) \
|
||||
CXX_FOR_TARGET=$(CXX_FOR_TARGET) \
|
||||
GCC_FOR_TARGET=$(GCC_FOR_TARGET) \
|
||||
AR_FOR_TARGET=$(AR_FOR_TARGET) \
|
||||
AS_FOR_TARGET=$(AS_FOR_TARGET) \
|
||||
LD_FOR_TARGET=$(LD_FOR_TARGET) \
|
||||
NM_FOR_TARGET=$(NM_FOR_TARGET) \
|
||||
OBJDUMP_FOR_TARGET=$(OBJDUMP_FOR_TARGET) \
|
||||
OBJCOPY_FOR_TARGET=$(OBJCOPY_FOR_TARGET) \
|
||||
RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET) \
|
||||
STRIP_FOR_TARGET=$(STRIP_FOR_TARGET) \
|
||||
READELF_FOR_TARGET=$(READELF_FOR_TARGET) -C newlib
|
||||
|
||||
$(NAME).elf:
|
||||
$Q$(LD_FOR_TARGET) $(LDFLAGS) -o $(NAME).elf $^
|
||||
@echo [OBJCOPY] $(NAME).sym
|
||||
$Q$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $(NAME).elf $(NAME).sym
|
||||
#@echo [OBJCOPY] $(NAME).elf
|
||||
#$Q$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $(NAME).elf
|
||||
@echo [OBJCOPY] $(NAME).elf
|
||||
$Q$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $(NAME).elf
|
||||
|
||||
tools:
|
||||
$Q$(MAKE) ARCH=$(ARCH) BIT=$(BIT) CFLAGS="$(CFLAGS_FOR_TOOLS)" LDFLAGS="$(LDFLAGS_FOR_TOOLS)" -C tools
|
||||
|
||||
clean:
|
||||
$Q$(RM) $(NAME).elf $(NAME).sym *~
|
||||
$Q$(MAKE) -C newlib clean
|
||||
$Q$(MAKE) -C tools clean
|
||||
@echo Cleaned.
|
||||
|
||||
veryclean: clean
|
||||
$Q$(RM) qemu-vlan0.pcap
|
||||
$Q$(MAKE) -C newlib veryclean
|
||||
$Q$(MAKE) -C tools veryclean
|
||||
@echo Very cleaned
|
||||
|
||||
qemu: $(NAME).elf
|
||||
$(QEMU) $(QEMUFLAGS) -kernel $(NAME).elf
|
||||
$(QEMU) $(QEMUFLAGS) -kernel $(NAME).elf -initrd tools/initrd.img
|
||||
|
||||
uart: $(NAME).elf
|
||||
$(QEMU) $(QEMUFLAGS) $(QEMUSERIALFLAGS) -kernel $(NAME).elf
|
||||
$(QEMU) $(QEMUFLAGS) $(QEMUSERIALFLAGS) -kernel $(NAME).elf -append uart=io:0xc110
|
||||
|
||||
debug: $(NAME).elf
|
||||
$(TERM) -e $(GDB) $(GDBFLAGS) &
|
||||
$(QEMU) $(QEMUDEBUGFLAGS) -s -S -kernel $(NAME).elf
|
||||
|
||||
debug-eclipse: clean $(NAME).elf
|
||||
killall $(QEMU) &
|
||||
( ( $(QEMU) $(QEMUDEBUGFLAGS) $(QEMUSERIALFLAGS) -s -S -kernel $(NAME).elf & ) & )
|
||||
|
||||
doc:
|
||||
@echo Create documentation...
|
||||
@doxygen
|
||||
@echo Create documentation...
|
||||
|
||||
test:
|
||||
@echo "Nothing to test"
|
||||
|
||||
include/eduos/config.inc: include/eduos/config.h
|
||||
@echo "; This file is generated automatically from the config.h file." > include/eduos/config.inc
|
||||
@echo "; Before editing this, you should consider editing config.h." >> include/eduos/config.inc
|
||||
@awk '/^#define KERNEL_STACK_SIZE/{ print "%define KERNEL_STACK_SIZE", $$3 }' include/eduos/config.h >> include/eduos/config.inc
|
||||
@awk '/^#define VIDEO_MEM_ADDR/{ print "%define VIDEO_MEM_ADDR", $$3 }' include/eduos/stddef.h >> include/eduos/config.inc
|
||||
|
||||
%.o : %.c
|
||||
@echo [CC] $@
|
||||
|
@ -98,11 +131,6 @@ doc:
|
|||
@echo [DEP] $*.dep
|
||||
$Q$(CC_FOR_TARGET) -MF $*.dep -MT $*.o -MM $(CFLAGS) $<
|
||||
|
||||
include/eduos/config.inc: include/eduos/config.h
|
||||
@echo "; This file is generated automatically from the config.h file." > include/eduos/config.inc
|
||||
@echo "; Before editing this, you should consider editing config.h." >> include/eduos/config.inc
|
||||
@awk '/^#define KERNEL_STACK_SIZE/{ print "%define KERNEL_STACK_SIZE", $$3 }' include/eduos/config.h >> include/eduos/config.inc
|
||||
|
||||
%.o : %.asm include/eduos/config.inc
|
||||
@echo [ASM] $@
|
||||
$Q$(NASM) $(NASMFLAGS) -o $@ $<
|
||||
|
@ -111,6 +139,6 @@ include/eduos/config.inc: include/eduos/config.h
|
|||
@echo [GCC-ASM] $@
|
||||
$Q$(CC_FOR_TARGET) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
.PHONY: default all clean emu gdb newlib tools
|
||||
|
||||
.PHONY: default all clean emu gdb newlib tools test
|
||||
|
||||
include $(addsuffix /Makefile,$(SUBDIRS))
|
41
README.md
41
README.md
|
@ -6,10 +6,10 @@ Introduction
|
|||
|
||||
eduOS is a Unix-like computer operating system based on a monolithic architecture for educational purposes.
|
||||
It is derived from following tutorials and software distributions.
|
||||
|
||||
|
||||
0. bkerndev - Bran's Kernel Development Tutorial
|
||||
|
||||
The first steps to realize eduOS based on Bran's Kernel Development
|
||||
The first steps to realize eduOS based on Bran's Kernel Development
|
||||
Tutorial (http://www.osdever.net/tutorials/view/brans-kernel-development-tutorial).
|
||||
In particular, the initialization of GDT, IDT and the interrupt handlers are derived
|
||||
from this tutorial.
|
||||
|
@ -21,22 +21,34 @@ It is derived from following tutorials and software distributions.
|
|||
Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
the permission of UNIX System Laboratories, Inc.
|
||||
|
||||
2. JamesM's kernel development tutorials
|
||||
The first version of eduOS's virtual filesystem and its initial
|
||||
ramdiks is is derived from JamesM's kernel development tutorials.
|
||||
(http://www.jamesmolloy.co.uk/tutorial_html/index.html)
|
||||
|
||||
3. newlib
|
||||
The C library "newlib" is used to build user-level aplications on the top
|
||||
of eduOS. Newlib is a collection of source code, it is
|
||||
distributed under the terms of several different licenses. All of the
|
||||
licensing is either public domain or BSD-like, which means that even
|
||||
proprietary applications can adopt newlib because its use does not
|
||||
require distribution of the end work's source code. For convenience, all
|
||||
of newlib's licenses are gathered up into the file COPYING.NEWLIB,
|
||||
which is included in the directory newlib or in newlib's source code.
|
||||
|
||||
|
||||
Requirements of eduOS
|
||||
---------------------
|
||||
|
||||
* Currently, eduOS supports only x86-based architectures.
|
||||
* Following command line tools have to be installed:
|
||||
make, gcc, binutil, git, qemu, nams, gdb
|
||||
make, gcc, binutils, git, qemu, nasm, gdb
|
||||
* The test PC has to use grub as bootloader.
|
||||
|
||||
Building eduOS
|
||||
--------------
|
||||
|
||||
0. Copy Makefile.example to Makefile and edit this Makefile to meet your individual convenience.
|
||||
1. Copy include/eduos/config.h.example to include/eduos/config.h and edit this config file to
|
||||
meet your individual convenience.
|
||||
2. Build kernel with "make"
|
||||
0. It is now possible to automatically configure eduOS with one command. To configure the system, run the "configure" script in the this dirctory, e.g.: ./configure
|
||||
1. Build kernel with "make"
|
||||
|
||||
Start eduOS via qemu
|
||||
--------------------
|
||||
|
@ -46,7 +58,7 @@ Start eduOS via qemu
|
|||
Boot eduOS via grub
|
||||
-------------------
|
||||
0. Copy eduos.elf as eduos.bin into the directory /boot. (cp eduos.elf /boot/eduos.bin)
|
||||
1. Create a boot entry in the grub menu. This depends on the version of grub, which is used by
|
||||
1. Create a boot entry in the grub menu. This depends on the version of grub, which is used by
|
||||
the installed Linux system. For instance, we added following lines to /boot/grub/grub.cfg:
|
||||
|
||||
<pre>
|
||||
|
@ -62,7 +74,7 @@ Boot eduOS via grub
|
|||
|
||||
Overview of all branches
|
||||
------------------------
|
||||
0. stage0 - Smallest HelloWorld of the World
|
||||
0. stage0 - Smallest HelloWorld of the World
|
||||
|
||||
Description of loading a minimal 32bit kernel
|
||||
|
||||
|
@ -92,6 +104,14 @@ Overview of all branches
|
|||
|
||||
Add basic support of a serial device
|
||||
|
||||
7. stage7 - A simple file system
|
||||
|
||||
Add a virtual filesystem and a prototype of an initial ramdisk
|
||||
|
||||
8. stage8 - HelloWorld in user space
|
||||
|
||||
Add HelloWorld example with a small C library (newlib)
|
||||
|
||||
Usefull Links
|
||||
-------------
|
||||
0. http://www.gnu.org/software/grub/manual/multiboot/
|
||||
|
@ -100,3 +120,4 @@ Usefull Links
|
|||
3. http://techblog.lankes.org/tutorials/
|
||||
4. http://www.os.rwth-aachen.de
|
||||
5. http://www.noteblok.net/2014/06/14/bachelor
|
||||
6. https://sourceware.org/newlib/
|
||||
|
|
179
arch/x86/include/asm/elf.h
Normal file
179
arch/x86/include/asm/elf.h
Normal file
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Stefan Lankes, RWTH Aachen University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Stefan Lankes
|
||||
* @file arch/x86/include/asm/elf.h
|
||||
* @brief Define constants and structures related to ELF
|
||||
*
|
||||
* This file keeps define constants for identification and definition of ELF files.\n
|
||||
* ELF files consist of up to five parts:
|
||||
* - ELF header
|
||||
* - program header table
|
||||
* - section header table
|
||||
* - ELF sections
|
||||
* - ELF segment
|
||||
*/
|
||||
#ifndef __ELF_H__
|
||||
#define __ELF_H__
|
||||
|
||||
#include <eduos/config.h>
|
||||
#include <asm/stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ELF_MAGIC 0x464C457F
|
||||
|
||||
#define ELF_ET_NONE 0x0000 // no type
|
||||
#define ELF_ET_REL 0x0001 // relocatable
|
||||
#define ELF_ET_EXEC 0x0002 // executeable
|
||||
#define ELF_ET_DYN 0x0003 // Shared-Object-File
|
||||
#define ELF_ET_CORE 0x0004 // Corefile
|
||||
#define ELF_ET_LOPROC 0xFF00 // Processor-specific
|
||||
#define ELF_ET_HIPROC 0x00FF // Processor-specific
|
||||
|
||||
#define ELF_EM_NONE 0x0000 // no type
|
||||
#define ELF_EM_M32 0x0001 // AT&T WE 32100
|
||||
#define ELF_EM_SPARC 0x0002 // SPARC
|
||||
#define ELF_EM_386 0x0003 // Intel 80386
|
||||
#define ELF_EM_68K 0x0004 // Motorola 68000
|
||||
#define ELF_EM_88K 0x0005 // Motorola 88000
|
||||
#define ELF_EM_860 0x0007 // Intel 80860
|
||||
#define ELF_EM_MIPS 0x0008 // MIPS RS3000
|
||||
|
||||
#define ELF_CLASS_NONE 0x0000
|
||||
#define ELF_CLASS_32 0x0001 // 32bit file
|
||||
#define ELF_CLASS_64 0x0002 // 64bit file
|
||||
|
||||
#define ELF_DATA_NONE 0x0000
|
||||
#define ELF_DATA_2LSB 0x0001
|
||||
#define ELF_DATA_2MSB 0x002
|
||||
|
||||
/* Legal values for p_type (segment type). */
|
||||
|
||||
#define ELF_PT_NULL 0 /* Program header table entry unused */
|
||||
#define ELF_PT_LOAD 1 /* Loadable program segment */
|
||||
#define ELF_PT_DYNAMIC 2 /* Dynamic linking information */
|
||||
#define ELF_PT_INTERP 3 /* Program interpreter */
|
||||
#define ELF_PT_NOTE 4 /* Auxiliary information */
|
||||
#define ELF_PT_SHLIB 5
|
||||
#define ELF_PT_PHDR 6 /* Entry for header table itself */
|
||||
#define ELF_PT_TLS 7 /* Thread-local storage segment */
|
||||
#define ELF_PT_NUM 8 /* Number of defined types */
|
||||
#define ELF_PT_LOOS 0x60000000 /* Start of OS-specific */
|
||||
#define ELF_PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
|
||||
#define ELF_PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
|
||||
#define ELF_PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
|
||||
#define ELF_PT_LOSUNW 0x6ffffffa
|
||||
#define ELF_PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
|
||||
#define ELF_PT_SUNWSTACK 0x6ffffffb /* Stack segment */
|
||||
#define ELF_PT_HISUNW 0x6fffffff
|
||||
#define ELF_PT_HIOS 0x6fffffff /* End of OS-specific */
|
||||
#define ELF_PT_LOPROC 0x70000000 /* Start of processor-specific */
|
||||
#define ELF_PT_HIPROC 0x7fffffff /* End of processor-specific */
|
||||
|
||||
/* These constants define the permissions on sections in the program
|
||||
header, p_flags. */
|
||||
#define PF_R 0x4
|
||||
#define PF_W 0x2
|
||||
#define PF_X 0x1
|
||||
|
||||
/** @brief Identification part of an ELF-file's header
|
||||
*
|
||||
* This structure keeps information about the file format
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t magic;
|
||||
uint8_t _class;
|
||||
uint8_t data;
|
||||
uint8_t version;
|
||||
uint8_t pad[8];
|
||||
uint8_t nident;
|
||||
} __attribute__ ((packed)) elf_ident_t;
|
||||
|
||||
/** @brief Information about the executable
|
||||
*
|
||||
* ELF header\n
|
||||
* This structure keeps information about the format of the executable itself.
|
||||
*/
|
||||
typedef struct {
|
||||
elf_ident_t ident;
|
||||
uint16_t type;
|
||||
uint16_t machine;
|
||||
uint32_t version;
|
||||
uint32_t entry;
|
||||
uint32_t ph_offset;
|
||||
uint32_t sh_offset;
|
||||
uint32_t flags;
|
||||
uint16_t header_size;
|
||||
uint16_t ph_entry_size;
|
||||
uint16_t ph_entry_count;
|
||||
uint16_t sh_entry_size;
|
||||
uint16_t sh_entry_count;
|
||||
uint16_t sh_str_table_index;
|
||||
} __attribute__ ((packed)) elf_header_t;
|
||||
|
||||
/** @brief program header information
|
||||
*
|
||||
* program header table\n
|
||||
* This structure keeps information about the program header.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
uint32_t offset;
|
||||
uint32_t virt_addr;
|
||||
uint32_t phys_addr;
|
||||
uint32_t file_size;
|
||||
uint32_t mem_size;
|
||||
uint32_t flags;
|
||||
uint32_t alignment;
|
||||
} __attribute__ ((packed)) elf_program_header_t;
|
||||
|
||||
/** @brief Information about ELF section
|
||||
*
|
||||
* ELF section\n
|
||||
* This structure keeps information about a specific ELF section
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t name;
|
||||
uint32_t type;
|
||||
uint32_t flags;
|
||||
uint32_t addr;
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
uint32_t link;
|
||||
uint32_t info;
|
||||
uint32_t align;
|
||||
uint32_t enttry_size;
|
||||
} __attribute__ ((packed)) elf_section_header_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -110,26 +110,17 @@ typedef struct {
|
|||
size_t base;
|
||||
} __attribute__ ((packed)) gdt_ptr_t;
|
||||
|
||||
#ifdef CONFIG_LGUEST
|
||||
|
||||
// TODO TODO: Just hacked in
|
||||
#define GDT_ENTRIES 32
|
||||
|
||||
#else
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
#define GDT_ENTRIES (5+MAX_TASKS)
|
||||
#define GDT_ENTRIES (5+1)
|
||||
#else
|
||||
// a TSS descriptor is twice larger than a code/data descriptor
|
||||
#define GDT_ENTRIES (5+MAX_TASKS*2)
|
||||
#define GDT_ENTRIES (5+1*2)
|
||||
#endif
|
||||
|
||||
#if GDT_ENTRIES > 8192
|
||||
#error Too many GDT entries!
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @brief Installs the global descriptor table
|
||||
*
|
||||
* The installation involves the following steps:
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
|
||||
/// Does the bootloader provide mem_* fields?
|
||||
#define MULTIBOOT_INFO_MEM (1 << 0)
|
||||
/// Does the bootloader provide the command-line?
|
||||
#define MULTIBOOT_INFO_CMDLINE (1 << 2)
|
||||
/// Does the bootloader provide a list of modules?
|
||||
#define MULTIBOOT_INFO_MODS (1 << 3)
|
||||
/// Does the bootloader provide a full memory map?
|
||||
|
|
|
@ -34,18 +34,12 @@
|
|||
* This file contains the several functions to manage the page tables
|
||||
*/
|
||||
|
||||
#include <eduos/tasks_types.h>
|
||||
#include <eduos/stddef.h>
|
||||
#include <eduos/stdlib.h>
|
||||
|
||||
#ifndef __PAGE_H__
|
||||
#define __PAGE_H__
|
||||
|
||||
/// Page offset bits
|
||||
#define PAGE_BITS 12
|
||||
/// The size of a single page in bytes
|
||||
#define PAGE_SIZE ( 1L << PAGE_BITS)
|
||||
/// Mask the page address without page map flags
|
||||
#define PAGE_MASK (-1L << PAGE_BITS)
|
||||
|
||||
/// Total operand width in bits
|
||||
#define BITS 32
|
||||
/// Linear/virtual address width
|
||||
|
@ -53,7 +47,7 @@
|
|||
/// Physical address width (we dont support PAE)
|
||||
#define PHYS_BITS BITS
|
||||
/// Page map bits
|
||||
#define PAGE_MAP_BITS 10
|
||||
#define PAGE_MAP_BITS 10
|
||||
/// Number of page map indirections
|
||||
#define PAGE_LEVELS 2
|
||||
|
||||
|
@ -90,11 +84,6 @@
|
|||
#define PG_GLOBAL (1 << 8)
|
||||
/// This table is a self-reference and should skipped by page_map_copy()
|
||||
#define PG_SELF (1 << 9)
|
||||
/// This page is used for bootstrapping the paging code.
|
||||
#define PG_BOOT PG_SELF
|
||||
|
||||
/// This page is reserved for copying
|
||||
#define PAGE_TMP (PAGE_FLOOR((size_t) &kernel_start) - PAGE_SIZE)
|
||||
|
||||
/** @brief Converts a virtual address to a physical
|
||||
*
|
||||
|
@ -103,7 +92,7 @@
|
|||
* @param addr Virtual address to convert
|
||||
* @return physical address
|
||||
*/
|
||||
size_t page_virt_to_phys(size_t vir);
|
||||
size_t virt_to_phys(size_t vir);
|
||||
|
||||
/** @brief Initialize paging subsystem
|
||||
*
|
||||
|
@ -112,35 +101,59 @@ size_t page_virt_to_phys(size_t vir);
|
|||
* Before calling page_init(), the bootstrap tables contain a simple identity
|
||||
* paging. Which is replaced by more specific mappings.
|
||||
*/
|
||||
int page_init();
|
||||
int page_init(void);
|
||||
|
||||
/** @brief Map a continious region of pages
|
||||
/** @brief Map one page into the boot page table
|
||||
*
|
||||
* @param viraddr
|
||||
* @param phyaddr
|
||||
* @param npages
|
||||
* @param bits
|
||||
* @return
|
||||
*/
|
||||
int page_map_bootmap(size_t viraddr, size_t phyaddr, size_t bits);
|
||||
|
||||
/** @brief Map a continuous region of pages
|
||||
*
|
||||
* @param viraddr Desired virtual address
|
||||
* @param phyaddr Physical address to map from
|
||||
* @param npages The region's size in number of pages
|
||||
* @param bits Further page flags
|
||||
* @return
|
||||
*/
|
||||
int page_map(size_t viraddr, size_t phyaddr, size_t npages, size_t bits);
|
||||
|
||||
/** @brief Unmap a continious region of pages
|
||||
/** @brief Unmap a continuous region of pages
|
||||
*
|
||||
* @param viraddr
|
||||
* @param npages
|
||||
* @param viraddr The virtual start address
|
||||
* @param npages The range's size in pages
|
||||
* @return
|
||||
*/
|
||||
int page_unmap(size_t viraddr, size_t npages);
|
||||
|
||||
/** @brief Change the page permission in the page tables of the current task
|
||||
*
|
||||
* Applies given flags noted in the 'flags' parameter to
|
||||
* the range denoted by virtual start and end addresses.
|
||||
*
|
||||
* @param start Range's virtual start address
|
||||
* @param end Range's virtual end address
|
||||
* @param flags flags to apply
|
||||
*
|
||||
* @return
|
||||
* - 0 on success
|
||||
* - -EINVAL (-22) on failure.
|
||||
*/
|
||||
int page_set_flags(size_t viraddr, uint32_t npages, int flags);
|
||||
|
||||
/** @brief Copy a whole page map tree
|
||||
*
|
||||
* @param dest Physical address of new page map
|
||||
* @retval 0 Success. Everything went fine.
|
||||
* @retval <0 Error. Something went wrong.
|
||||
*/
|
||||
int page_map_copy(task_t *dest);
|
||||
int page_map_copy(struct task *dest);
|
||||
|
||||
/** @brief Free a whole page map tree */
|
||||
int page_map_drop();
|
||||
int page_map_drop(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -60,12 +60,13 @@ int pci_init(void);
|
|||
* @param vendor_id The device's vendor ID
|
||||
* @param device_id the device's ID
|
||||
* @param info Pointer to the record pci_info_t where among other the IObase address will be stored
|
||||
* @param base Search for the preferred IO address. Zero, if any address is useful
|
||||
*
|
||||
* @return
|
||||
* - 0 on success
|
||||
* - -EINVAL on failure
|
||||
*/
|
||||
int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, pci_info_t* info);
|
||||
int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, uint32_t base, pci_info_t* info);
|
||||
|
||||
#ifdef WITH_PCI_NAMES
|
||||
/** @brief Print information of existing pci adapters
|
||||
|
|
|
@ -46,6 +46,12 @@ extern "C" {
|
|||
*/
|
||||
int uart_init(void);
|
||||
|
||||
/** @brief Initialize UART output without a device check
|
||||
*
|
||||
* @return Returns 0 on success
|
||||
*/
|
||||
int uart_early_init(char*);
|
||||
|
||||
/** @brief Simple string output on a serial device.
|
||||
*
|
||||
* If you want a new line you will have to "\\n".
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
|
||||
[BITS 32]
|
||||
|
||||
extern kernel_start ; defined in linker script
|
||||
extern kernel_end
|
||||
|
||||
; We use a special name to map this section at the begin of our kernel
|
||||
; => Multiboot expects its magic number at the beginning of the kernel.
|
||||
SECTION .mboot
|
||||
|
@ -54,6 +57,7 @@ mboot:
|
|||
dd MULTIBOOT_HEADER_MAGIC
|
||||
dd MULTIBOOT_HEADER_FLAGS
|
||||
dd MULTIBOOT_CHECKSUM
|
||||
dd 0, 0, 0, 0, 0 ; address fields
|
||||
|
||||
SECTION .text
|
||||
ALIGN 4
|
||||
|
@ -61,10 +65,10 @@ stublet:
|
|||
; Initialize stack pointer
|
||||
mov esp, boot_stack
|
||||
add esp, KERNEL_STACK_SIZE-16
|
||||
; Interpret multiboot information
|
||||
mov DWORD [mb_info], ebx
|
||||
; Initialize CPU features
|
||||
call cpu_init
|
||||
; Interpret multiboot information
|
||||
mov DWORD [mb_info], ebx
|
||||
|
||||
; Jump to the boot processors's C code
|
||||
extern main
|
||||
|
@ -77,22 +81,62 @@ stublet:
|
|||
; extensions (huge pages) enabled.
|
||||
global cpu_init
|
||||
cpu_init:
|
||||
; initialize page tables
|
||||
push edi
|
||||
mov eax, VIDEO_MEM_ADDR
|
||||
and eax, 0xFFFFF000 ; page align lower half
|
||||
mov edi, eax
|
||||
shr edi, 10 ; (edi >> 12) * 4 (index for boot_pgt)
|
||||
add edi, boot_pgt
|
||||
or eax, 0x113 ; set present, global, writable and cache disable bits
|
||||
mov DWORD [edi], eax
|
||||
pop edi
|
||||
|
||||
push edi
|
||||
mov eax, DWORD [mb_info] ; map multiboot info
|
||||
and eax, 0xFFFFF000 ; page align lower half
|
||||
mov edi, eax
|
||||
shr edi, 10 ; (edi >> 12) * 4 (index for boot_pgt)
|
||||
add edi, boot_pgt
|
||||
or eax, 0x101 ; set present and global bits
|
||||
mov DWORD [edi], eax
|
||||
pop edi
|
||||
push edi
|
||||
push ebx
|
||||
push ecx
|
||||
mov ecx, kernel_start
|
||||
mov ebx, kernel_end
|
||||
add ebx, 0x1000
|
||||
L0: cmp ecx, ebx
|
||||
jae L1
|
||||
mov eax, ecx
|
||||
and eax, 0xFFFFF000 ; page align lower half
|
||||
mov edi, eax
|
||||
shr edi, 10 ; (edi >> 12) * 4 (index for boot_pgt)
|
||||
add edi, boot_pgt
|
||||
or eax, 0x103 ; set present, global and writable bits
|
||||
mov DWORD [edi], eax
|
||||
add ecx, 0x1000
|
||||
jmp L0
|
||||
L1:
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop edi
|
||||
|
||||
; Set CR3
|
||||
mov eax, boot_pgd
|
||||
mov cr3, eax
|
||||
|
||||
; Set CR4
|
||||
mov cr4, eax
|
||||
and eax, ~(1 << 9) ; disable SSE
|
||||
or eax, (1 << 4) ; enable PSE
|
||||
mov eax, cr4
|
||||
and eax, 0xfffbf9ff ; disable SSE
|
||||
or eax, (1 << 4) ; enable PSE
|
||||
mov cr4, eax
|
||||
|
||||
; Set CR0
|
||||
mov eax, cr0
|
||||
and eax, ~(1 << 2) ; disable FPU emulation
|
||||
and eax, ~(1 << 30) ; enable caching
|
||||
or eax, (1 << 31) ; enable paging
|
||||
or eax, (1 << 5) ; enable FPU exceptions
|
||||
mov cr0, eax
|
||||
|
||||
ret
|
||||
|
@ -327,18 +371,12 @@ boot_stack:
|
|||
; These tables do a simple identity paging and will
|
||||
; be replaced in page_init() by more fine-granular mappings.
|
||||
ALIGN 4096
|
||||
global boot_map
|
||||
boot_map:
|
||||
boot_pgd:
|
||||
DD boot_pgt + 0x107 ; PG_PRESENT | PG_GLOBAL | PG_RW | PG_USER
|
||||
times 1022 DD 0 ; PAGE_MAP_ENTRIES - 2
|
||||
DD boot_pgd + 0x303 ; PG_PRESENT | PG_GLOBAL | PG_RW | PG_SELF (self-reference)
|
||||
DD boot_pgd + 0x303 ; PG_PRESENT | PG_GLOBAL | PG_RW | PG_SELF (self-reference)
|
||||
boot_pgt:
|
||||
%assign i 0
|
||||
%rep 1024 ; PAGE_MAP_ENTRIES
|
||||
DD i + 0x203 ; PG_PRESENT | PG_BOOT | PG_RW
|
||||
%assign i i + 4096 ; PAGE_SIZE
|
||||
%endrep
|
||||
times 1024 DD 0
|
||||
|
||||
; add some hints to the ELF file
|
||||
SECTION .note.GNU-stack noalloc noexec nowrite progbits
|
||||
|
|
|
@ -47,6 +47,8 @@ static gdt_entry_t gdt[GDT_ENTRIES] = {[0 ... GDT_ENTRIES-1] = {0, 0, 0, 0, 0,
|
|||
*/
|
||||
extern void gdt_flush(void);
|
||||
|
||||
extern const void boot_stack;
|
||||
|
||||
void set_kernel_stack(void)
|
||||
{
|
||||
task_t* curr_task = current_task;
|
||||
|
@ -136,7 +138,7 @@ void gdt_install(void)
|
|||
/* set default values */
|
||||
task_state_segment.eflags = 0x1202;
|
||||
task_state_segment.ss0 = 0x10; // data segment
|
||||
task_state_segment.esp0 = 0xDEADBEEF; // invalid pseudo address
|
||||
task_state_segment.esp0 = (size_t) &boot_stack - 0x10;
|
||||
task_state_segment.cs = 0x0b;
|
||||
task_state_segment.ss = task_state_segment.ds = task_state_segment.es = task_state_segment.fs = task_state_segment.gs = 0x13;
|
||||
gdt_set_gate(5, (unsigned long) (&task_state_segment), sizeof(tss_t)-1,
|
||||
|
|
|
@ -143,7 +143,7 @@ int pci_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, pci_info_t* info)
|
||||
int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, uint32_t base, pci_info_t* info)
|
||||
{
|
||||
uint32_t slot, bus, i;
|
||||
|
||||
|
@ -166,6 +166,9 @@ int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, pci_info_t* info
|
|||
info->size[i] = (info->base[i]) ? pci_what_size(bus, slot, i) : 0;
|
||||
}
|
||||
info->irq = pci_what_irq(bus, slot);
|
||||
if (base)
|
||||
if (!(info->base[0] == base))
|
||||
continue;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,13 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <eduos/stdlib.h>
|
||||
#include <eduos/stdio.h>
|
||||
#include <eduos/string.h>
|
||||
#include <eduos/mailbox.h>
|
||||
#include <eduos/ctype.h>
|
||||
#include <eduos/vma.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/uart.h>
|
||||
|
@ -198,10 +202,8 @@ static int uart_thread(void* arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void uart_config(void)
|
||||
static int uart_config(uint8_t early)
|
||||
{
|
||||
mailbox_uint8_init(&input_queue);
|
||||
|
||||
/*
|
||||
* enable FIFOs
|
||||
* clear RX and TX FIFO
|
||||
|
@ -236,14 +238,62 @@ static void uart_config(void)
|
|||
/* set DLAB=0 */
|
||||
write_to_uart(UART_LCR, lcr & (~UART_LCR_DLAB));
|
||||
|
||||
/* enable interrupt */
|
||||
write_to_uart(UART_IER, UART_IER_RDI | UART_IER_RLSI | UART_IER_THRI);
|
||||
if (!early) {
|
||||
mailbox_uint8_init(&input_queue);
|
||||
|
||||
int err = create_kernel_task(&id, uart_thread, NULL, HIGH_PRIO);
|
||||
if (BUILTIN_EXPECT(err, 0))
|
||||
kprintf("Failed to create task for the uart device: %d\n", err);
|
||||
/* enable interrupt */
|
||||
write_to_uart(UART_IER, UART_IER_RDI | UART_IER_RLSI | UART_IER_THRI);
|
||||
|
||||
koutput_add_uart();
|
||||
int err = create_kernel_task(&id, uart_thread, NULL, HIGH_PRIO);
|
||||
if (BUILTIN_EXPECT(err, 0))
|
||||
kprintf("Failed to create task for the uart device: %d\n", err);
|
||||
|
||||
koutput_add_uart();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern const void kernel_start;
|
||||
|
||||
int uart_early_init(char* cmdline)
|
||||
{
|
||||
if (BUILTIN_EXPECT(!cmdline, 0))
|
||||
return -EINVAL;
|
||||
|
||||
char* str = strstr(cmdline, "uart=");
|
||||
if (!str)
|
||||
return -EINVAL;
|
||||
|
||||
if (strncmp(str, "uart=io:", 8) == 0) {
|
||||
iobase = strtol(str+8, (char **)NULL, 16);
|
||||
if (!iobase)
|
||||
return -EINVAL;
|
||||
mmio = 0;
|
||||
} else if (strncmp(str, "uart=mmio:", 10) == 0) {
|
||||
iobase = strtol(str+10, (char **)NULL, 16);
|
||||
if (!iobase)
|
||||
return -EINVAL;
|
||||
if (iobase >= PAGE_MAP_ENTRIES*PAGE_SIZE) {
|
||||
/* at this point we use the boot page table
|
||||
* => IO address is not mapped
|
||||
* => dirty hack, map device before the kernel
|
||||
*/
|
||||
int err;
|
||||
size_t newaddr = ((size_t) &kernel_start - PAGE_SIZE);
|
||||
|
||||
err = page_map_bootmap(newaddr & PAGE_MASK, iobase & PAGE_MASK, PG_GLOBAL | PG_ACCESSED | PG_DIRTY | PG_RW | PG_PCD);
|
||||
if (BUILTIN_EXPECT(err, 0)) {
|
||||
iobase = 0;
|
||||
return err;
|
||||
}
|
||||
iobase = newaddr;
|
||||
}
|
||||
mmio = 1;
|
||||
}
|
||||
|
||||
// configure uart
|
||||
return uart_config(1);
|
||||
}
|
||||
|
||||
int uart_init(void)
|
||||
|
@ -253,16 +303,16 @@ int uart_init(void)
|
|||
uint32_t bar = 0;
|
||||
|
||||
// Searching for Intel's UART device
|
||||
if (pci_get_device_info(0x8086, 0x0936, &pci_info) == 0)
|
||||
if (pci_get_device_info(0x8086, 0x0936, iobase, &pci_info) == 0)
|
||||
goto Lsuccess;
|
||||
// Searching for Qemu's UART device
|
||||
if (pci_get_device_info(0x1b36, 0x0002, &pci_info) == 0)
|
||||
if (pci_get_device_info(0x1b36, 0x0002, iobase, &pci_info) == 0)
|
||||
goto Lsuccess;
|
||||
// Searching for Qemu's 2x UART device (pci-serial-2x)
|
||||
if (pci_get_device_info(0x1b36, 0x0003, &pci_info) == 0)
|
||||
if (pci_get_device_info(0x1b36, 0x0003, iobase, &pci_info) == 0)
|
||||
goto Lsuccess;
|
||||
// Searching for Qemu's 4x UART device (pci-serial-4x)
|
||||
if (pci_get_device_info(0x1b36, 0x0003, &pci_info) == 0)
|
||||
if (pci_get_device_info(0x1b36, 0x0004, iobase, &pci_info) == 0)
|
||||
goto Lsuccess;
|
||||
|
||||
return -1;
|
||||
|
@ -275,20 +325,28 @@ Lsuccess:
|
|||
kprintf("UART uses io address 0x%x\n", iobase);
|
||||
} else {
|
||||
mmio = 1;
|
||||
page_map(iobase & PAGE_MASK, iobase & PAGE_MASK, 1, PG_GLOBAL | PG_RW | PG_PCD);
|
||||
page_map(iobase & PAGE_MASK, iobase & PAGE_MASK, 1, PG_GLOBAL | PG_ACCESSED | PG_DIRTY | PG_RW | PG_PCD);
|
||||
kprintf("UART uses mmio address 0x%x\n", iobase);
|
||||
vma_add(iobase, iobase + PAGE_SIZE, VMA_READ|VMA_WRITE);
|
||||
}
|
||||
#else
|
||||
// per default we use COM1...
|
||||
mmio = 0;
|
||||
iobase = 0x3F8;
|
||||
irq_install_handler(32+4, uart_handler);
|
||||
#endif
|
||||
|
||||
// configure uart
|
||||
uart_config();
|
||||
return uart_config(0);
|
||||
#else
|
||||
// per default we use COM1...
|
||||
if (!iobase)
|
||||
iobase = 0x3F8;
|
||||
mmio = 0;
|
||||
if ((iobase == 0x3F8) || (iobase == 0x3E8))
|
||||
irq_install_handler(32+4, uart_handler);
|
||||
else if ((iobase == 0x2F8) || (iobase == 0x2E8))
|
||||
irq_install_handler(32+3, uart_handler);
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
// configure uart
|
||||
return uart_config(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include <asm/io.h>
|
||||
#include <asm/vga.h>
|
||||
|
||||
#ifdef CONFIG_VGA
|
||||
|
||||
/*
|
||||
* These define our textpointer, our background and foreground
|
||||
* colors (attributes), and x and y cursor coordinates
|
||||
|
@ -235,5 +233,3 @@ void vga_init(void)
|
|||
textmemptr = (unsigned short *)VIDEO_MEM_ADDR;
|
||||
vga_clear();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
/**
|
||||
* This is a 32/64 bit portable paging implementation for the x86 architecture
|
||||
* using self-referenced page tablesi.
|
||||
* using self-referenced page tables i.
|
||||
* See http://www.noteblok.net/2014/06/14/bachelor/ for a detailed description.
|
||||
*
|
||||
* @author Steffen Vogel <steffen.vogel@rwth-aachen.de>
|
||||
|
@ -47,14 +47,14 @@
|
|||
/* Note that linker symbols are not variables, they have no memory
|
||||
* allocated for maintaining a value, rather their address is their value. */
|
||||
extern const void kernel_start;
|
||||
extern const void kernel_end;
|
||||
//extern const void kernel_end;
|
||||
|
||||
/// This page is reserved for copying
|
||||
#define PAGE_TMP (PAGE_FLOOR((size_t) &kernel_start) - PAGE_SIZE)
|
||||
|
||||
/** Lock for kernel space page tables */
|
||||
static spinlock_t kslock = SPINLOCK_INIT;
|
||||
|
||||
/** This PGD table is initialized in entry.asm */
|
||||
extern size_t boot_map[PAGE_MAP_ENTRIES];
|
||||
|
||||
/** A self-reference enables direct access to all page tables */
|
||||
static size_t* self[PAGE_LEVELS] = {
|
||||
(size_t *) 0xFFC00000,
|
||||
|
@ -67,7 +67,7 @@ static size_t * other[PAGE_LEVELS] = {
|
|||
(size_t *) 0xFFFFE000
|
||||
};
|
||||
|
||||
size_t page_virt_to_phys(size_t addr)
|
||||
size_t virt_to_phys(size_t addr)
|
||||
{
|
||||
size_t vpn = addr >> PAGE_BITS; // virtual page number
|
||||
size_t entry = self[0][vpn]; // page table entry
|
||||
|
@ -77,6 +77,12 @@ size_t page_virt_to_phys(size_t addr)
|
|||
return phy | off;
|
||||
}
|
||||
|
||||
//TODO: code is missing
|
||||
int page_set_flags(size_t viraddr, uint32_t npages, int flags)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int page_map(size_t viraddr, size_t phyaddr, size_t npages, size_t bits)
|
||||
{
|
||||
int lvl, ret = -ENOMEM;
|
||||
|
@ -111,7 +117,7 @@ int page_map(size_t viraddr, size_t phyaddr, size_t npages, size_t bits)
|
|||
atomic_int32_inc(¤t_task->user_usage);
|
||||
|
||||
/* Reference the new table within its parent */
|
||||
self[lvl][vpn] = phyaddr | bits | PG_PRESENT;
|
||||
self[lvl][vpn] = phyaddr | bits | PG_PRESENT | PG_USER | PG_RW;
|
||||
|
||||
/* Fill new table with zeros */
|
||||
memset(&self[lvl-1][vpn<<PAGE_MAP_BITS], 0, PAGE_SIZE);
|
||||
|
@ -160,7 +166,7 @@ int page_unmap(size_t viraddr, size_t npages)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int page_map_drop()
|
||||
int page_map_drop(void)
|
||||
{
|
||||
void traverse(int lvl, long vpn) {
|
||||
long stop;
|
||||
|
@ -236,7 +242,32 @@ int page_map_copy(task_t *dest)
|
|||
void page_fault_handler(struct state *s)
|
||||
{
|
||||
size_t viraddr = read_cr2();
|
||||
task_t* task = current_task;
|
||||
|
||||
// on demand userspace heap mapping
|
||||
if ((task->heap) && (viraddr >= task->heap->start) && (viraddr < task->heap->end)) {
|
||||
viraddr &= PAGE_MASK;
|
||||
|
||||
size_t phyaddr = get_page();
|
||||
if (BUILTIN_EXPECT(!phyaddr, 0)) {
|
||||
kprintf("out of memory: task = %u\n", task->id);
|
||||
goto default_handler;
|
||||
}
|
||||
|
||||
viraddr = page_map(viraddr, phyaddr, 1, PG_USER|PG_RW);
|
||||
if (BUILTIN_EXPECT(!viraddr, 0)) {
|
||||
kprintf("map_region: could not map %#lx to %#lx, task = %u\n", viraddr, phyaddr, task->id);
|
||||
put_page(phyaddr);
|
||||
|
||||
goto default_handler;
|
||||
}
|
||||
|
||||
memset((void*) viraddr, 0x00, PAGE_SIZE); // fill with zeros
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
default_handler:
|
||||
kprintf("Page Fault Exception (%d) at cs:ip = %#x:%#lx, task = %u, addr = %#lx, error = %#x [ %s %s %s %s %s ]\n",
|
||||
s->int_no, s->cs, s->eip, current_task->id, viraddr, s->error,
|
||||
(s->error & 0x4) ? "user" : "supervisor",
|
||||
|
@ -248,7 +279,7 @@ void page_fault_handler(struct state *s)
|
|||
while(1) HALT;
|
||||
}
|
||||
|
||||
int page_init()
|
||||
int page_init(void)
|
||||
{
|
||||
size_t addr, npages;
|
||||
int i;
|
||||
|
@ -257,21 +288,12 @@ int page_init()
|
|||
irq_uninstall_handler(14);
|
||||
irq_install_handler(14, page_fault_handler);
|
||||
|
||||
/* Map kernel */
|
||||
addr = (size_t) &kernel_start;
|
||||
npages = PAGE_FLOOR((size_t) &kernel_end - (size_t) &kernel_start) >> PAGE_BITS;
|
||||
page_map(addr, addr, npages, PG_RW | PG_GLOBAL);
|
||||
|
||||
#ifdef CONFIG_VGA
|
||||
/* Map video memory */
|
||||
page_map(VIDEO_MEM_ADDR, VIDEO_MEM_ADDR, 1, PG_RW | PG_PCD | PG_GLOBAL);
|
||||
#endif
|
||||
|
||||
/* Map multiboot information and modules */
|
||||
if (mb_info) {
|
||||
addr = (size_t) mb_info & PAGE_MASK;
|
||||
npages = PAGE_FLOOR(sizeof(*mb_info)) >> PAGE_BITS;
|
||||
page_map(addr, addr, npages, PG_GLOBAL);
|
||||
// already mapped => entry.asm
|
||||
//addr = (size_t) mb_info & PAGE_MASK;
|
||||
//npages = PAGE_FLOOR(sizeof(*mb_info)) >> PAGE_BITS;
|
||||
//page_map(addr, addr, npages, PG_GLOBAL);
|
||||
|
||||
if (mb_info->flags & MULTIBOOT_INFO_MODS) {
|
||||
addr = mb_info->mods_addr;
|
||||
|
@ -282,18 +304,13 @@ int page_init()
|
|||
for(i=0; i<mb_info->mods_count; i++) {
|
||||
addr = mmodule[i].mod_start;
|
||||
npages = PAGE_FLOOR(mmodule[i].mod_end - mmodule[i].mod_start) >> PAGE_BITS;
|
||||
page_map(addr, addr, npages, PG_USER | PG_GLOBAL);
|
||||
page_map(addr, addr, npages, PG_GLOBAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Unmap bootstrap identity paging (see entry.asm, PG_BOOT) */
|
||||
for (i=0; i<PAGE_MAP_ENTRIES; i++)
|
||||
if (self[0][i] & PG_BOOT)
|
||||
self[0][i] = 0;
|
||||
|
||||
/* Flush TLB to adopt changes above */
|
||||
flush_tlb();
|
||||
//flush_tlb();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
1421
config.guess
vendored
Executable file
1421
config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
1807
config.sub
vendored
Executable file
1807
config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
621
config/acx.m4
Executable file
621
config/acx.m4
Executable file
|
@ -0,0 +1,621 @@
|
|||
# Autoconf M4 include file defining utility macros for complex Canadian
|
||||
# cross builds.
|
||||
|
||||
dnl ####
|
||||
dnl # _GCC_TOPLEV_NONCANONICAL_BUILD
|
||||
dnl # $build_alias or canonical $build if blank.
|
||||
dnl # Used when we would use $build_alias, but empty is not OK.
|
||||
AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_BUILD],
|
||||
[AC_REQUIRE([AC_CANONICAL_BUILD]) []dnl
|
||||
case ${build_alias} in
|
||||
"") build_noncanonical=${build} ;;
|
||||
*) build_noncanonical=${build_alias} ;;
|
||||
esac
|
||||
]) []dnl # _GCC_TOPLEV_NONCANONICAL_BUILD
|
||||
|
||||
dnl ####
|
||||
dnl # _GCC_TOPLEV_NONCANONICAL_HOST
|
||||
dnl # $host_alias, or $build_noncanonical if blank.
|
||||
dnl # Used when we would use $host_alias, but empty is not OK.
|
||||
AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_HOST],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
|
||||
case ${host_alias} in
|
||||
"") host_noncanonical=${build_noncanonical} ;;
|
||||
*) host_noncanonical=${host_alias} ;;
|
||||
esac
|
||||
]) []dnl # _GCC_TOPLEV_NONCANONICAL_HOST
|
||||
|
||||
dnl ####
|
||||
dnl # _GCC_TOPLEV_NONCANONICAL_TARGET
|
||||
dnl # $target_alias or $host_noncanonical if blank.
|
||||
dnl # Used when we would use $target_alias, but empty is not OK.
|
||||
AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_TARGET],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl
|
||||
case ${target_alias} in
|
||||
"") target_noncanonical=${host_noncanonical} ;;
|
||||
*) target_noncanonical=${target_alias} ;;
|
||||
esac
|
||||
]) []dnl # _GCC_TOPLEV_NONCANONICAL_TARGET
|
||||
|
||||
dnl ####
|
||||
dnl # ACX_NONCANONICAL_BUILD
|
||||
dnl # Like underscored version, but AC_SUBST's.
|
||||
AC_DEFUN([ACX_NONCANONICAL_BUILD],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
|
||||
AC_SUBST(build_noncanonical)
|
||||
]) []dnl # ACX_NONCANONICAL_BUILD
|
||||
|
||||
dnl ####
|
||||
dnl # ACX_NONCANONICAL_HOST
|
||||
dnl # Like underscored version, but AC_SUBST's.
|
||||
AC_DEFUN([ACX_NONCANONICAL_HOST],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl
|
||||
AC_SUBST(host_noncanonical)
|
||||
]) []dnl # ACX_NONCANONICAL_HOST
|
||||
|
||||
dnl ####
|
||||
dnl # ACX_NONCANONICAL_TARGET
|
||||
dnl # Like underscored version, but AC_SUBST's.
|
||||
AC_DEFUN([ACX_NONCANONICAL_TARGET],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
|
||||
AC_SUBST(target_noncanonical)
|
||||
]) []dnl # ACX_NONCANONICAL_TARGET
|
||||
|
||||
dnl ####
|
||||
dnl # GCC_TOPLEV_SUBDIRS
|
||||
dnl # GCC & friends build 'build', 'host', and 'target' tools. These must
|
||||
dnl # be separated into three well-known subdirectories of the build directory:
|
||||
dnl # build_subdir, host_subdir, and target_subdir. The values are determined
|
||||
dnl # here so that they can (theoretically) be changed in the future. They
|
||||
dnl # were previously reproduced across many different files.
|
||||
dnl #
|
||||
dnl # This logic really amounts to very little with autoconf 2.13; it will
|
||||
dnl # amount to a lot more with autoconf 2.5x.
|
||||
AC_DEFUN([GCC_TOPLEV_SUBDIRS],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
|
||||
AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
|
||||
|
||||
# post-stage1 host modules use a different CC_FOR_BUILD so, in order to
|
||||
# have matching libraries, they should use host libraries: Makefile.tpl
|
||||
# arranges to pass --with-build-libsubdir=$(HOST_SUBDIR).
|
||||
# However, they still use the build modules, because the corresponding
|
||||
# host modules (e.g. bison) are only built for the host when bootstrap
|
||||
# finishes. So:
|
||||
# - build_subdir is where we find build modules, and never changes.
|
||||
# - build_libsubdir is where we find build libraries, and can be overridden.
|
||||
|
||||
# Prefix 'build-' so this never conflicts with target_subdir.
|
||||
build_subdir="build-${build_noncanonical}"
|
||||
AC_ARG_WITH(build-libsubdir,
|
||||
[ --with-build-libsubdir=[DIR] Directory where to find libraries for build system],
|
||||
build_libsubdir="$withval",
|
||||
build_libsubdir="$build_subdir")
|
||||
# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories
|
||||
if ( test $srcdir = . && test -d gcc ) \
|
||||
|| test -d $srcdir/../host-${host_noncanonical}; then
|
||||
host_subdir="host-${host_noncanonical}"
|
||||
else
|
||||
host_subdir=.
|
||||
fi
|
||||
# No prefix.
|
||||
target_subdir=${target_noncanonical}
|
||||
AC_SUBST([build_libsubdir]) []dnl
|
||||
AC_SUBST([build_subdir]) []dnl
|
||||
AC_SUBST([host_subdir]) []dnl
|
||||
AC_SUBST([target_subdir]) []dnl
|
||||
]) []dnl # GCC_TOPLEV_SUBDIRS
|
||||
|
||||
|
||||
####
|
||||
# _NCN_TOOL_PREFIXES: Some stuff that oughtta be done in AC_CANONICAL_SYSTEM
|
||||
# or AC_INIT.
|
||||
# These demand that AC_CANONICAL_SYSTEM be called beforehand.
|
||||
AC_DEFUN([_NCN_TOOL_PREFIXES],
|
||||
[ncn_tool_prefix=
|
||||
test -n "$host_alias" && ncn_tool_prefix=$host_alias-
|
||||
ncn_target_tool_prefix=
|
||||
test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
|
||||
]) []dnl # _NCN_TOOL_PREFIXES
|
||||
|
||||
####
|
||||
# NCN_STRICT_CHECK_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path])
|
||||
# Like plain AC_CHECK_TOOLS, but require prefix if build!=host.
|
||||
|
||||
AC_DEFUN([NCN_STRICT_CHECK_TOOLS],
|
||||
[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
|
||||
AC_ARG_VAR([$1], [$1 for the host])
|
||||
|
||||
if test -n "[$]$1"; then
|
||||
ac_cv_prog_$1=[$]$1
|
||||
elif test -n "$ac_cv_prog_$1"; then
|
||||
$1=$ac_cv_prog_$1
|
||||
fi
|
||||
|
||||
if test -n "$ac_cv_prog_$1"; then
|
||||
for ncn_progname in $2; do
|
||||
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
|
||||
done
|
||||
fi
|
||||
|
||||
for ncn_progname in $2; do
|
||||
if test -n "$ncn_tool_prefix"; then
|
||||
AC_CHECK_PROG([$1], [${ncn_tool_prefix}${ncn_progname}],
|
||||
[${ncn_tool_prefix}${ncn_progname}], , [$4])
|
||||
fi
|
||||
if test -z "$ac_cv_prog_$1" && test $build = $host ; then
|
||||
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
|
||||
fi
|
||||
test -n "$ac_cv_prog_$1" && break
|
||||
done
|
||||
|
||||
if test -z "$ac_cv_prog_$1" ; then
|
||||
ifelse([$3],[], [set dummy $2
|
||||
if test $build = $host ; then
|
||||
$1="[$]2"
|
||||
else
|
||||
$1="${ncn_tool_prefix}[$]2"
|
||||
fi], [$1="$3"])
|
||||
fi
|
||||
]) []dnl # NCN_STRICT_CHECK_TOOLS
|
||||
|
||||
####
|
||||
# NCN_STRICT_CHECK_TARGET_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path])
|
||||
# Like CVS Autoconf AC_CHECK_TARGET_TOOLS, but require prefix if build!=target.
|
||||
|
||||
AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOLS],
|
||||
[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
|
||||
AC_ARG_VAR([$1], patsubst([$1], [_FOR_TARGET$], [])[ for the target])
|
||||
|
||||
if test -n "[$]$1"; then
|
||||
ac_cv_prog_$1=[$]$1
|
||||
elif test -n "$ac_cv_prog_$1"; then
|
||||
$1=$ac_cv_prog_$1
|
||||
fi
|
||||
|
||||
if test -n "$ac_cv_prog_$1"; then
|
||||
for ncn_progname in $2; do
|
||||
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$ac_cv_prog_$1" && test -n "$with_build_time_tools"; then
|
||||
for ncn_progname in $2; do
|
||||
AC_MSG_CHECKING([for ${ncn_progname} in $with_build_time_tools])
|
||||
if test -x $with_build_time_tools/${ncn_progname}; then
|
||||
ac_cv_prog_$1=$with_build_time_tools/${ncn_progname}
|
||||
AC_MSG_RESULT(yes)
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$ac_cv_prog_$1"; then
|
||||
for ncn_progname in $2; do
|
||||
if test -n "$ncn_target_tool_prefix"; then
|
||||
AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}${ncn_progname}],
|
||||
[${ncn_target_tool_prefix}${ncn_progname}], , [$4])
|
||||
fi
|
||||
if test -z "$ac_cv_prog_$1" && test $build = $target ; then
|
||||
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
|
||||
fi
|
||||
test -n "$ac_cv_prog_$1" && break
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$ac_cv_prog_$1" ; then
|
||||
ifelse([$3],[], [set dummy $2
|
||||
if test $build = $target ; then
|
||||
$1="[$]2"
|
||||
else
|
||||
$1="${ncn_target_tool_prefix}[$]2"
|
||||
fi], [$1="$3"])
|
||||
else
|
||||
$1="$ac_cv_prog_$1"
|
||||
fi
|
||||
]) []dnl # NCN_STRICT_CHECK_TARGET_TOOLS
|
||||
|
||||
|
||||
# Backported from Autoconf 2.5x; can go away when and if
|
||||
# we switch. Put the OS path separator in $PATH_SEPARATOR.
|
||||
AC_DEFUN([ACX_PATH_SEP], [
|
||||
# The user is always right.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
echo "#! /bin/sh" >conf$$.sh
|
||||
echo "exit 0" >>conf$$.sh
|
||||
chmod +x conf$$.sh
|
||||
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
|
||||
PATH_SEPARATOR=';'
|
||||
else
|
||||
PATH_SEPARATOR=:
|
||||
fi
|
||||
rm -f conf$$.sh
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([ACX_TOOL_DIRS], [
|
||||
AC_REQUIRE([ACX_PATH_SEP])
|
||||
if test "x$exec_prefix" = xNONE; then
|
||||
if test "x$prefix" = xNONE; then
|
||||
gcc_cv_tool_prefix=$ac_default_prefix
|
||||
else
|
||||
gcc_cv_tool_prefix=$prefix
|
||||
fi
|
||||
else
|
||||
gcc_cv_tool_prefix=$exec_prefix
|
||||
fi
|
||||
|
||||
# If there is no compiler in the tree, use the PATH only. In any
|
||||
# case, if there is no compiler in the tree nobody should use
|
||||
# AS_FOR_TARGET and LD_FOR_TARGET.
|
||||
if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then
|
||||
gcc_version=`cat $srcdir/gcc/BASE-VER`
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin$PATH_SEPARATOR"
|
||||
else
|
||||
gcc_cv_tool_dirs=
|
||||
fi
|
||||
|
||||
if test x$build = x$target && test -n "$md_exec_prefix"; then
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$md_exec_prefix$PATH_SEPARATOR"
|
||||
fi
|
||||
|
||||
]) []dnl # ACX_TOOL_DIRS
|
||||
|
||||
# ACX_HAVE_GCC_FOR_TARGET
|
||||
# Check if the variable GCC_FOR_TARGET really points to a GCC binary.
|
||||
AC_DEFUN([ACX_HAVE_GCC_FOR_TARGET], [
|
||||
cat > conftest.c << \EOF
|
||||
#ifdef __GNUC__
|
||||
gcc_yay;
|
||||
#endif
|
||||
EOF
|
||||
if ($GCC_FOR_TARGET -E conftest.c | grep gcc_yay) > /dev/null 2>&1; then
|
||||
have_gcc_for_target=yes
|
||||
else
|
||||
GCC_FOR_TARGET=${ncn_target_tool_prefix}gcc
|
||||
have_gcc_for_target=no
|
||||
fi
|
||||
rm conftest.c
|
||||
])
|
||||
|
||||
# ACX_CHECK_INSTALLED_TARGET_TOOL(VAR, PROG)
|
||||
# Searching for installed target binutils. We need to take extra care,
|
||||
# else we may find the wrong assembler, linker, etc., and lose.
|
||||
#
|
||||
# First try --with-build-time-tools, if specified.
|
||||
#
|
||||
# For build != host, we ask the installed GCC for the name of the tool it
|
||||
# uses, and accept it if it is an absolute path. This is because the
|
||||
# only good choice for a compiler is the same GCC version that is being
|
||||
# installed (or we couldn't make target libraries), and we assume that
|
||||
# on the host system we'll have not only the same GCC version, but also
|
||||
# the same binutils version.
|
||||
#
|
||||
# For build == host, search the same directories that the installed
|
||||
# compiler will search. We used to do this for the assembler, linker,
|
||||
# and nm only; for simplicity of configuration, however, we extend this
|
||||
# criterion to tools (such as ar and ranlib) that are never invoked by
|
||||
# the compiler, to avoid mismatches.
|
||||
#
|
||||
# Also note we have to check MD_EXEC_PREFIX before checking the user's path
|
||||
# if build == target. This makes the most sense only when bootstrapping,
|
||||
# but we also do so when build != host. In this case, we hope that the
|
||||
# build and host systems will have similar contents of MD_EXEC_PREFIX.
|
||||
#
|
||||
# If we do not find a suitable binary, then try the user's path.
|
||||
|
||||
AC_DEFUN([ACX_CHECK_INSTALLED_TARGET_TOOL], [
|
||||
AC_REQUIRE([ACX_TOOL_DIRS])
|
||||
AC_REQUIRE([ACX_HAVE_GCC_FOR_TARGET])
|
||||
if test -z "$ac_cv_path_$1" ; then
|
||||
if test -n "$with_build_time_tools"; then
|
||||
AC_MSG_CHECKING([for $2 in $with_build_time_tools])
|
||||
if test -x $with_build_time_tools/$2; then
|
||||
$1=`cd $with_build_time_tools && pwd`/$2
|
||||
ac_cv_path_$1=[$]$1
|
||||
AC_MSG_RESULT([$ac_cv_path_$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
elif test $build != $host && test $have_gcc_for_target = yes; then
|
||||
$1=`$GCC_FOR_TARGET --print-prog-name=$2`
|
||||
test [$]$1 = $2 && $1=
|
||||
test -n "[$]$1" && ac_cv_path_$1=[$]$1
|
||||
fi
|
||||
fi
|
||||
if test -z "$ac_cv_path_$1" && test -n "$gcc_cv_tool_dirs"; then
|
||||
AC_PATH_PROG([$1], [$2], [], [$gcc_cv_tool_dirs])
|
||||
fi
|
||||
if test -z "$ac_cv_path_$1" ; then
|
||||
NCN_STRICT_CHECK_TARGET_TOOLS([$1], [$2])
|
||||
else
|
||||
$1=$ac_cv_path_$1
|
||||
fi
|
||||
]) []dnl # ACX_CHECK_INSTALLED_TARGET_TOOL
|
||||
|
||||
###
|
||||
# AC_PROG_CPP_WERROR
|
||||
# Used for autoconf 2.5x to force AC_PREPROC_IFELSE to reject code which
|
||||
# triggers warnings from the preprocessor. Will be in autoconf 2.58.
|
||||
# For now, using this also overrides header checks to use only the
|
||||
# preprocessor (matches 2.13 behavior; matching 2.58's behavior is a
|
||||
# bit harder from here).
|
||||
# Eventually autoconf will default to checking headers with the compiler
|
||||
# instead, and we'll have to do this differently.
|
||||
|
||||
AC_DEFUN([AC_PROG_CPP_WERROR],
|
||||
[AC_REQUIRE([AC_PROG_CPP])dnl
|
||||
m4_define([AC_CHECK_HEADER],m4_defn([_AC_CHECK_HEADER_OLD]))
|
||||
ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
|
||||
|
||||
# Test for GNAT.
|
||||
# We require the gnatbind & gnatmake programs, as well as a compiler driver
|
||||
# that understands Ada. We use the user's CC setting, already found, and
|
||||
# possibly add $1 to the command-line parameters.
|
||||
#
|
||||
# Sets the shell variable have_gnat to yes or no as appropriate, and
|
||||
# substitutes GNATBIND and GNATMAKE.
|
||||
AC_DEFUN([ACX_PROG_GNAT],
|
||||
[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_CHECK_TOOL(GNATBIND, gnatbind, no)
|
||||
AC_CHECK_TOOL(GNATMAKE, gnatmake, no)
|
||||
AC_CACHE_CHECK([whether compiler driver understands Ada],
|
||||
acx_cv_cc_gcc_supports_ada,
|
||||
[cat >conftest.adb <<EOF
|
||||
procedure conftest is begin null; end conftest;
|
||||
EOF
|
||||
acx_cv_cc_gcc_supports_ada=no
|
||||
# There is a bug in old released versions of GCC which causes the
|
||||
# driver to exit successfully when the appropriate language module
|
||||
# has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
|
||||
# Therefore we must check for the error message as well as an
|
||||
# unsuccessful exit.
|
||||
# Other compilers, like HP Tru64 UNIX cc, exit successfully when
|
||||
# given a .adb file, but produce no object file. So we must check
|
||||
# if an object file was really produced to guard against this.
|
||||
errors=`(${CC} $1[]m4_ifval([$1], [ ])-c conftest.adb) 2>&1 || echo failure`
|
||||
if test x"$errors" = x && test -f conftest.$ac_objext; then
|
||||
acx_cv_cc_gcc_supports_ada=yes
|
||||
fi
|
||||
rm -f conftest.*])
|
||||
|
||||
if test "x$GNATBIND" != xno && test "x$GNATMAKE" != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then
|
||||
have_gnat=yes
|
||||
else
|
||||
have_gnat=no
|
||||
fi
|
||||
])
|
||||
|
||||
dnl 'make compare' can be significantly faster, if cmp itself can
|
||||
dnl skip bytes instead of using tail. The test being performed is
|
||||
dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
|
||||
dnl but we need to sink errors and handle broken shells. We also test
|
||||
dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
|
||||
dnl accepted by cmp on some systems.
|
||||
AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL],
|
||||
[AC_CACHE_CHECK([how to compare bootstrapped objects], gcc_cv_prog_cmp_skip,
|
||||
[ echo abfoo >t1
|
||||
echo cdfoo >t2
|
||||
gcc_cv_prog_cmp_skip='tail +16c $$f1 > tmp-foo1; tail +16c $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2'
|
||||
if cmp t1 t2 2 2 > /dev/null 2>&1; then
|
||||
if cmp t1 t2 1 1 > /dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16'
|
||||
fi
|
||||
fi
|
||||
if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
|
||||
if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2'
|
||||
fi
|
||||
fi
|
||||
rm t1 t2
|
||||
])
|
||||
do_compare="$gcc_cv_prog_cmp_skip"
|
||||
AC_SUBST(do_compare)
|
||||
])
|
||||
|
||||
dnl See whether we can include both string.h and strings.h.
|
||||
AC_DEFUN([ACX_HEADER_STRING],
|
||||
[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
|
||||
gcc_cv_header_string,
|
||||
[AC_TRY_COMPILE([#include <string.h>
|
||||
#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
|
||||
if test $gcc_cv_header_string = yes; then
|
||||
AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl See if stdbool.h properly defines bool and true/false.
|
||||
dnl Check whether _Bool is built-in.
|
||||
AC_DEFUN([ACX_HEADER_STDBOOL],
|
||||
[AC_CACHE_CHECK([for working stdbool.h],
|
||||
ac_cv_header_stdbool_h,
|
||||
[AC_TRY_COMPILE([#include <stdbool.h>],
|
||||
[bool foo = false;],
|
||||
ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
|
||||
if test $ac_cv_header_stdbool_h = yes; then
|
||||
AC_DEFINE(HAVE_STDBOOL_H, 1,
|
||||
[Define if you have a working <stdbool.h> header file.])
|
||||
fi
|
||||
AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
|
||||
[AC_TRY_COMPILE(,
|
||||
[_Bool foo;],
|
||||
gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
|
||||
])
|
||||
if test $gcc_cv_c__bool = yes; then
|
||||
AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl See if hard links work and if not, try to substitute $1 or simple copy.
|
||||
AC_DEFUN([ACX_PROG_LN],
|
||||
[AC_MSG_CHECKING(whether ln works)
|
||||
AC_CACHE_VAL(acx_cv_prog_LN,
|
||||
[rm -f conftestdata_t
|
||||
echo >conftestdata_f
|
||||
if ln conftestdata_f conftestdata_t 2>/dev/null
|
||||
then
|
||||
acx_cv_prog_LN=ln
|
||||
else
|
||||
acx_cv_prog_LN=no
|
||||
fi
|
||||
rm -f conftestdata_f conftestdata_t
|
||||
])dnl
|
||||
if test $acx_cv_prog_LN = no; then
|
||||
LN="ifelse([$1],,cp,[$1])"
|
||||
AC_MSG_RESULT([no, using $LN])
|
||||
else
|
||||
LN="$acx_cv_prog_LN"
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
AC_SUBST(LN)dnl
|
||||
])
|
||||
|
||||
dnl GCC_TARGET_TOOL(PROGRAM, TARGET-VAR, HOST-VAR, IN-TREE-TOOL, LANGUAGE)
|
||||
AC_DEFUN([GCC_TARGET_TOOL],
|
||||
[AC_MSG_CHECKING(where to find the target $1)
|
||||
if test "x${build}" != "x${host}" ; then
|
||||
if expr "x[$]$2" : "x/" > /dev/null; then
|
||||
# We already found the complete path
|
||||
ac_dir=`dirname [$]$2`
|
||||
AC_MSG_RESULT(pre-installed in $ac_dir)
|
||||
else
|
||||
# Canadian cross, just use what we found
|
||||
AC_MSG_RESULT(pre-installed)
|
||||
fi
|
||||
else
|
||||
ifelse([$4],,,
|
||||
[ok=yes
|
||||
case " ${configdirs} " in
|
||||
*" patsubst([$4], [/.*], []) "*) ;;
|
||||
*) ok=no ;;
|
||||
esac
|
||||
ifelse([$5],,,
|
||||
[case ,${enable_languages}, in
|
||||
*,$5,*) ;;
|
||||
*) ok=no ;;
|
||||
esac])
|
||||
if test $ok = yes; then
|
||||
# An in-tree tool is available and we can use it
|
||||
$2='$$r/$(HOST_SUBDIR)/$4'
|
||||
AC_MSG_RESULT(just compiled)
|
||||
el])if expr "x[$]$2" : "x/" > /dev/null; then
|
||||
# We already found the complete path
|
||||
ac_dir=`dirname [$]$2`
|
||||
AC_MSG_RESULT(pre-installed in $ac_dir)
|
||||
elif test "x$target" = "x$host"; then
|
||||
# We can use an host tool
|
||||
$2='$($3)'
|
||||
AC_MSG_RESULT(host tool)
|
||||
else
|
||||
# We need a cross tool
|
||||
AC_MSG_RESULT(pre-installed)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST($2)])
|
||||
|
||||
|
||||
dnl Locate a program and check that its version is acceptable.
|
||||
dnl ACX_PROG_CHECK_VER(var, name, version-switch,
|
||||
dnl version-extract-regexp, version-glob)
|
||||
AC_DEFUN([ACX_CHECK_PROG_VER],[
|
||||
AC_CHECK_PROG([$1], [$2], [$2])
|
||||
if test -n "[$]$1"; then
|
||||
# Found it, now check the version.
|
||||
AC_CACHE_CHECK([for modern $2],
|
||||
[gcc_cv_prog_$2_modern],
|
||||
[ac_prog_version=`eval [$]$1 $3 2>&1 |
|
||||
sed -n 's/^.*patsubst([[$4]],/,\/).*$/\1/p'`
|
||||
|
||||
[case $ac_prog_version in
|
||||
'') gcc_cv_prog_$2_modern=no;;
|
||||
$5) gcc_cv_prog_$2_modern=yes;;
|
||||
*) gcc_cv_prog_$2_modern=no;;
|
||||
esac]
|
||||
])
|
||||
else
|
||||
gcc_cv_prog_$2_modern=no
|
||||
fi
|
||||
if test $gcc_cv_prog_$2_modern = no; then
|
||||
$1="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing $2"
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Support the --with-pkgversion configure option.
|
||||
dnl ACX_PKGVERSION(default-pkgversion)
|
||||
AC_DEFUN([ACX_PKGVERSION],[
|
||||
AC_ARG_WITH(pkgversion,
|
||||
AS_HELP_STRING([--with-pkgversion=PKG],
|
||||
[Use PKG in the version string in place of "$1"]),
|
||||
[case "$withval" in
|
||||
yes) AC_MSG_ERROR([package version not specified]) ;;
|
||||
no) PKGVERSION= ;;
|
||||
*) PKGVERSION="($withval) " ;;
|
||||
esac],
|
||||
PKGVERSION="($1) "
|
||||
)
|
||||
AC_SUBST(PKGVERSION)
|
||||
])
|
||||
|
||||
dnl Support the --with-bugurl configure option.
|
||||
dnl ACX_BUGURL(default-bugurl)
|
||||
AC_DEFUN([ACX_BUGURL],[
|
||||
AC_ARG_WITH(bugurl,
|
||||
AS_HELP_STRING([--with-bugurl=URL],
|
||||
[Direct users to URL to report a bug]),
|
||||
[case "$withval" in
|
||||
yes) AC_MSG_ERROR([bug URL not specified]) ;;
|
||||
no) BUGURL=
|
||||
;;
|
||||
*) BUGURL="$withval"
|
||||
;;
|
||||
esac],
|
||||
BUGURL="$1"
|
||||
)
|
||||
case ${BUGURL} in
|
||||
"")
|
||||
REPORT_BUGS_TO=
|
||||
REPORT_BUGS_TEXI=
|
||||
;;
|
||||
*)
|
||||
REPORT_BUGS_TO="<$BUGURL>"
|
||||
REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`}
|
||||
;;
|
||||
esac;
|
||||
AC_SUBST(REPORT_BUGS_TO)
|
||||
AC_SUBST(REPORT_BUGS_TEXI)
|
||||
])
|
||||
|
||||
dnl ####
|
||||
dnl # ACX_CHECK_CYGWIN_CAT_WORKS
|
||||
dnl # On Cygwin hosts, check that the cat command ignores
|
||||
dnl # carriage returns as otherwise builds will not work.
|
||||
dnl # See binutils PR 4334 for more details.
|
||||
AC_DEFUN([ACX_CHECK_CYGWIN_CAT_WORKS],[
|
||||
AC_MSG_CHECKING([to see if cat works as expected])
|
||||
echo a >cygwin-cat-check
|
||||
if test `cat cygwin-cat-check` = a ; then
|
||||
rm cygwin-cat-check
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
rm cygwin-cat-check
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([The cat command does not ignore carriage return characters.
|
||||
Please either mount the build directory in binary mode or run the following
|
||||
commands before running any configure script:
|
||||
set -o igncr
|
||||
export SHELLOPTS
|
||||
])
|
||||
fi
|
||||
])
|
27
config/elf.m4
Executable file
27
config/elf.m4
Executable file
|
@ -0,0 +1,27 @@
|
|||
dnl Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
||||
dnl This file is free software, distributed under the terms of the GNU
|
||||
dnl General Public License. As a special exception to the GNU General
|
||||
dnl Public License, this file may be distributed as part of a program
|
||||
dnl that contains a configuration script generated by Autoconf, under
|
||||
dnl the same distribution terms as the rest of that program.
|
||||
|
||||
dnl From Paolo Bonzini.
|
||||
|
||||
dnl usage: ACX_ELF_TARGET_IFELSE([if-elf], [if-not-elf])
|
||||
AC_DEFUN([ACX_ELF_TARGET_IFELSE], [
|
||||
AC_REQUIRE([AC_CANONICAL_TARGET])
|
||||
|
||||
target_elf=no
|
||||
case $target in
|
||||
*-darwin* | *-aix* | *-cygwin* | *-mingw* | *-aout* | *-*coff* | \
|
||||
*-msdosdjgpp* | *-vms* | *-wince* | *-*-pe* | \
|
||||
alpha*-dec-osf* | *-interix* | hppa[[12]]*-*-hpux*)
|
||||
target_elf=no
|
||||
;;
|
||||
*)
|
||||
target_elf=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
AS_IF([test $target_elf = yes], [$1], [$2])
|
||||
])
|
133
configure.ac
Executable file
133
configure.ac
Executable file
|
@ -0,0 +1,133 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
m4_include(config/acx.m4)
|
||||
m4_include(config/elf.m4)
|
||||
|
||||
AC_PREREQ(2.69)
|
||||
AC_INIT(eduOS, 0.1, slankes@eonerc.rwth-aachen.de, eduOS, http://rwth-os.github.io/eduOS/)
|
||||
AC_CONFIG_SRCDIR(kernel/main.c)
|
||||
AC_CONFIG_HEADERS(include/eduos/config.h)
|
||||
|
||||
# Find the build, host, and target systems.
|
||||
ACX_NONCANONICAL_BUILD
|
||||
ACX_NONCANONICAL_HOST
|
||||
ACX_NONCANONICAL_TARGET
|
||||
|
||||
# Find the build, host, and target systems.
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
m4_pattern_allow([^AS_FOR_TARGET$])dnl
|
||||
m4_pattern_allow([^AS_FOR_BUILD$])dnl
|
||||
|
||||
# Get 'install' or 'install-sh' and its variants.
|
||||
AC_PROG_INSTALL
|
||||
ACX_PROG_LN
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_SED
|
||||
AC_PROG_AWK
|
||||
|
||||
if test "${build}" != "${host}" ; then
|
||||
AR_FOR_BUILD=${AR_FOR_BUILD-ar}
|
||||
AS_FOR_BUILD=${AS_FOR_BUILD-as}
|
||||
CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
|
||||
CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
|
||||
GCJ_FOR_BUILD=${GCJ_FOR_BUILD-gcj}
|
||||
GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
|
||||
GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
|
||||
LD_FOR_BUILD=${LD_FOR_BUILD-ld}
|
||||
NM_FOR_BUILD=${NM_FOR_BUILD-nm}
|
||||
RANLIB_FOR_BUILD=${RANLIB_FOR_BUILD-ranlib}
|
||||
else
|
||||
AR_FOR_BUILD="\$(AR)"
|
||||
AS_FOR_BUILD="\$(AS)"
|
||||
CC_FOR_BUILD="\$(CC)"
|
||||
CXX_FOR_BUILD="\$(CXX)"
|
||||
GCJ_FOR_BUILD="\$(GCJ)"
|
||||
GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
|
||||
GOC_FOR_BUILD="\$(GOC)"
|
||||
LD_FOR_BUILD="\$(LD)"
|
||||
NM_FOR_BUILD="\$(NM)"
|
||||
RANLIB_FOR_BUILD="\$(RANLIB)"
|
||||
fi
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
|
||||
m4_pattern_allow([^AS_FOR_TARGET$])dnl
|
||||
m4_pattern_allow([^AS_FOR_BUILD$])dnl
|
||||
|
||||
# Build module lists & subconfigure args.
|
||||
AC_SUBST(build_configargs)
|
||||
AC_SUBST(build_configdirs)
|
||||
|
||||
# Host module lists & subconfigure args.
|
||||
AC_SUBST(host_configargs)
|
||||
AC_SUBST(configdirs)
|
||||
AC_SUBST(target_configdirs)
|
||||
|
||||
# Target module lists & subconfigure args.
|
||||
AC_SUBST(target_configargs)
|
||||
|
||||
NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
|
||||
NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
|
||||
NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
|
||||
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(CPP_FOR_TARGET, cpp)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(OBJCOPY_FOR_TARGET, objcopy)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
|
||||
ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
|
||||
|
||||
# define eduOS specific constants
|
||||
AC_DEFINE(HAVE_ARCH_MEMSET, 1, Define to use machine specific version of memset)
|
||||
AC_DEFINE(HAVE_ARCH_MEMCPY, 1, Define to use machine specific version of memcpy)
|
||||
AC_DEFINE(HAVE_ARCH_STRLEN, 1, Define to use machine specific version of strlen)
|
||||
AC_DEFINE(HAVE_ARCH_STRCPY, 1, Define to use machine specific version of strcpy)
|
||||
AC_DEFINE(HAVE_ARCH_STRNCPY, 1, Define to use machine specific version of strncpy)
|
||||
|
||||
AC_ARG_WITH(bitmap-size, [AS_HELP_STRING([--with-bitmap-size=N], [specify the bitmap size])])
|
||||
if test "x$with_bitmap_size" != x; then
|
||||
AC_DEFINE_UNQUOTED(BITMAP_SIZE, $with_bitmap_size, Define the bitmap isze)
|
||||
else
|
||||
AC_DEFINE(BITMAP_SIZE, 4096, Define the bitmap size)
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(max-tasks, [AS_HELP_STRING([--with-max-tasks=N], [specify the maximum number of running tasks])])
|
||||
if test "x$with_max_tasks" != x; then
|
||||
AC_DEFINE_UNQUOTED(MAX_TASKS, $with_max_tasks, Define the maximum number of running tasks)
|
||||
else
|
||||
AC_DEFINE(MAX_TASKS, 16, Define the maximum number of running tasks)
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(kernel-stack-size, [AS_HELP_STRING([--with-kernel-stack-size=SIZE], [specify the size of the kernel stack])])
|
||||
if test "x$with_kernel_stack_size" != x; then
|
||||
AC_DEFINE_UNQUOTED(KERNEL_STACK_SIZE, $with_kernel_stack_size, Define the size of the kernel stack)
|
||||
else
|
||||
AC_DEFINE(KERNEL_STACK_SIZE, 8192, Define the size of the kernel stack)
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(user-stack-size, [AS_HELP_STRING([--with-user-stack-size=SIZE], [specify the size of the user stack])])
|
||||
if test "x$with_user_stack_size" != x; then
|
||||
AC_DEFINE_UNQUOTED(DEFAULT_STACK_SIZE, $with_user_stack_size, Define the size of the user stack)
|
||||
else
|
||||
AC_DEFINE(DEFAULT_STACK_SIZE, 65536, Define the size of the user stack)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(uart, [AS_HELP_STRING([--enable-uart], [enable UART support])], [], [enable_uart=no])
|
||||
if test "x$enable_uart" = "xyes"; then
|
||||
AC_DEFINE(CONFIG_UART, 1, Enable UART support)
|
||||
fi
|
||||
|
||||
AC_DEFINE(CONFIG_PCI, 1, Enable PCI support)
|
||||
|
||||
AC_CONFIG_FILES(Makefile)
|
||||
AC_OUTPUT
|
4
fs/Makefile
Normal file
4
fs/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
|||
C_source := fs.c initrd.c
|
||||
MODULE := fs
|
||||
|
||||
include $(TOPDIR)/Makefile.inc
|
246
fs/fs.c
Normal file
246
fs/fs.c
Normal file
|
@ -0,0 +1,246 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Stefan Lankes, RWTH Aachen University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <eduos/stdlib.h>
|
||||
#include <eduos/stdio.h>
|
||||
#include <eduos/string.h>
|
||||
#include <eduos/fs.h>
|
||||
#include <eduos/errno.h>
|
||||
#include <eduos/spinlock.h>
|
||||
|
||||
vfs_node_t* fs_root = NULL; // The root of the filesystem.
|
||||
|
||||
ssize_t read_fs(fildes_t* file, uint8_t* buffer, size_t size)
|
||||
{
|
||||
vfs_node_t* node = file->node;
|
||||
ssize_t ret = -EINVAL;
|
||||
|
||||
if (BUILTIN_EXPECT(!node || !buffer, 0))
|
||||
return ret;
|
||||
|
||||
spinlock_lock(&node->lock);
|
||||
// Has the node got a read callback?
|
||||
if (node->read != 0)
|
||||
ret = node->read(file, buffer, size);
|
||||
spinlock_unlock(&node->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ssize_t write_fs(fildes_t* file, uint8_t* buffer, size_t size)
|
||||
{
|
||||
vfs_node_t* node = file->node;
|
||||
ssize_t ret = -EINVAL;
|
||||
|
||||
if (BUILTIN_EXPECT(!node || !buffer, 0))
|
||||
return ret;
|
||||
|
||||
spinlock_lock(&node->lock);
|
||||
// Has the node got a write callback?
|
||||
if (node->write != 0)
|
||||
ret = node->write(file, buffer, size);
|
||||
spinlock_unlock(&node->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int open_fs(fildes_t* file, const char* name)
|
||||
{
|
||||
uint32_t ret = 0, i, j = 1;
|
||||
vfs_node_t* file_node = NULL; /* file node */
|
||||
vfs_node_t* dir_node = NULL;
|
||||
char fname[MAX_FNAME];
|
||||
|
||||
if (BUILTIN_EXPECT(!name, 0))
|
||||
return ret;
|
||||
|
||||
if (name[0] == '/')
|
||||
file_node = fs_root;
|
||||
|
||||
while((name[j] != '\0') || ((file_node != NULL) && (file_node->type == FS_DIRECTORY))) {
|
||||
i = 0;
|
||||
while((name[j] != '/') && (name[j] != '\0')) {
|
||||
fname[i] = name[j];
|
||||
i++; j++;
|
||||
}
|
||||
fname[i] = '\0';
|
||||
dir_node = file_node; /* file must be a directory */
|
||||
file_node = finddir_fs(dir_node, fname);
|
||||
if (name[j] == '/')
|
||||
j++;
|
||||
}
|
||||
|
||||
//kprintf("dir_node = %p, file_node = %p, name = %s \n", dir_node, file_node, fname);
|
||||
|
||||
/* file exists */
|
||||
if(file_node) {
|
||||
spinlock_lock(&file_node->lock);
|
||||
file->node = file_node;
|
||||
// Has the file_node got an open callback?
|
||||
if (file_node->open != 0)
|
||||
ret = file->node->open(file, NULL);
|
||||
spinlock_unlock(&file_node->lock);
|
||||
} else if (dir_node) { /* file doesn't exist or opendir was called */
|
||||
spinlock_lock(&dir_node->lock);
|
||||
file->node = dir_node;
|
||||
// Has the dir_node got an open callback?
|
||||
if (dir_node->open != 0)
|
||||
ret = dir_node->open(file, fname);
|
||||
spinlock_unlock(&dir_node->lock);
|
||||
} else {
|
||||
ret = -ENOENT;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int close_fs(fildes_t* file)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (BUILTIN_EXPECT(!(file->node), 0))
|
||||
return ret;
|
||||
|
||||
spinlock_lock(&file->node->lock);
|
||||
// Has the node got a close callback?
|
||||
if (file->node->close != 0)
|
||||
ret = file->node->close(file);
|
||||
spinlock_unlock(&file->node->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct dirent* readdir_fs(vfs_node_t * node, uint32_t index)
|
||||
{
|
||||
struct dirent* ret = NULL;
|
||||
|
||||
if (BUILTIN_EXPECT(!node, 0))
|
||||
return ret;
|
||||
|
||||
spinlock_lock(&node->lock);
|
||||
// Is the node a directory, and does it have a callback?
|
||||
if ((node->type == FS_DIRECTORY) && node->readdir != 0)
|
||||
ret = node->readdir(node, index);
|
||||
spinlock_unlock(&node->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vfs_node_t* finddir_fs(vfs_node_t* node, const char *name)
|
||||
{
|
||||
vfs_node_t* ret = NULL;
|
||||
|
||||
if (BUILTIN_EXPECT(!node, 0))
|
||||
return ret;
|
||||
|
||||
spinlock_lock(&node->lock);
|
||||
// Is the node a directory, and does it have a callback?
|
||||
if ((node->type == FS_DIRECTORY) && node->finddir != 0)
|
||||
ret = node->finddir(node, name);
|
||||
spinlock_unlock(&node->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vfs_node_t* mkdir_fs(vfs_node_t* node, const char *name)
|
||||
{
|
||||
vfs_node_t* ret = NULL;
|
||||
|
||||
if (BUILTIN_EXPECT(!node, 0))
|
||||
return ret;
|
||||
|
||||
spinlock_lock(&node->lock);
|
||||
if (node->mkdir != 0)
|
||||
ret = node->mkdir(node, name);
|
||||
spinlock_unlock(&node->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vfs_node_t* findnode_fs(const char* name)
|
||||
{
|
||||
uint32_t i, j = 1;
|
||||
vfs_node_t* ret = NULL;
|
||||
char fname[MAX_FNAME];
|
||||
|
||||
if (BUILTIN_EXPECT(!name, 0))
|
||||
return ret;
|
||||
|
||||
if (name[0] == '/')
|
||||
ret = fs_root;
|
||||
|
||||
while((name[j] != '\0') && ret) {
|
||||
i = 0;
|
||||
while((name[j] != '/') && (name[j] != '\0')) {
|
||||
fname[i] = name[j];
|
||||
i++; j++;
|
||||
}
|
||||
fname[i] = '\0';
|
||||
ret = finddir_fs(ret, fname);
|
||||
if (name[j] == '/')
|
||||
j++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void list_fs(vfs_node_t* node, uint32_t depth)
|
||||
{
|
||||
int j, i = 0;
|
||||
dirent_t* dirent = NULL;
|
||||
fildes_t* file = kmalloc(sizeof(fildes_t));
|
||||
file->offset = 0;
|
||||
file->flags = 0;
|
||||
|
||||
|
||||
while ((dirent = readdir_fs(node, i)) != 0) {
|
||||
for(j=0; j<depth; j++)
|
||||
kputs(" ");
|
||||
kprintf("%s\n", dirent->name);
|
||||
|
||||
if (strcmp(dirent->name, ".") && strcmp(dirent->name, "..")) {
|
||||
vfs_node_t *new_node = finddir_fs(node, dirent->name);
|
||||
if (new_node) {
|
||||
if (new_node->type == FS_FILE) {
|
||||
char buff[16] = {[0 ... 15] = 0x00};
|
||||
|
||||
file->node = new_node;
|
||||
file->offset = 0;
|
||||
file->flags = 0;
|
||||
|
||||
read_fs(file, (uint8_t*)buff, 8);
|
||||
for(j=0; j<depth+1; j++)
|
||||
kputs(" ");
|
||||
kprintf("content: %s\n", buff);
|
||||
} else list_fs(new_node, depth+1);
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
kfree(file);
|
||||
}
|
563
fs/initrd.c
Normal file
563
fs/initrd.c
Normal file
|
@ -0,0 +1,563 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Stefan Lankes, RWTH Aachen University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <eduos/stdlib.h>
|
||||
#include <eduos/stdio.h>
|
||||
#include <eduos/string.h>
|
||||
#include <eduos/fs.h>
|
||||
#include <eduos/errno.h>
|
||||
#include <eduos/spinlock.h>
|
||||
#include <asm/multiboot.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
static vfs_node_t initrd_root;
|
||||
|
||||
#define INITRD_MAGIC_NUMBER 0x4711
|
||||
|
||||
/*
|
||||
* Grub maps the initrd as module into the address space of the kernel.
|
||||
* The module begins with the header "initrd_header_t", which describes
|
||||
* the number of mounted files and the mount point. The header follows
|
||||
* by the struct "initrd_file_desc_t" for each file, which will be mounted.
|
||||
* This struct describes the file properties and the position in the
|
||||
* module.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t magic;
|
||||
uint32_t nfiles;
|
||||
char mount_point[MAX_FNAME];
|
||||
} initrd_header_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t length;
|
||||
uint32_t offset;
|
||||
char fname[MAX_FNAME];
|
||||
} initrd_file_desc_t;
|
||||
|
||||
static ssize_t initrd_read(fildes_t* file, uint8_t* buffer, size_t size)
|
||||
{
|
||||
vfs_node_t* node = file->node;
|
||||
|
||||
uint32_t i, pos = 0, found = 0;
|
||||
off_t offset = 0;
|
||||
char* data = NULL;
|
||||
block_list_t* blist = &node->block_list;
|
||||
|
||||
if (file->flags & O_WRONLY)
|
||||
return -EACCES;
|
||||
|
||||
/* init the tmp offset */
|
||||
offset = file->offset;
|
||||
|
||||
/* searching for the valid data block */
|
||||
if (offset) {
|
||||
pos = offset / node->block_size;
|
||||
offset = offset % node->block_size;
|
||||
}
|
||||
do {
|
||||
for(i=0; i<MAX_DATABLOCKS && !data; i++) {
|
||||
if (blist->data[i]) {
|
||||
found++;
|
||||
if (found > pos)
|
||||
data = (char*) blist->data[i];
|
||||
}
|
||||
}
|
||||
|
||||
blist = blist->next;
|
||||
} while(blist && !data);
|
||||
|
||||
if (BUILTIN_EXPECT(!data, 0))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* If the data block is not large engough,
|
||||
* we copy only the rest of the current block.
|
||||
* The user has to restart the read operation
|
||||
* for the next block.
|
||||
*/
|
||||
if ((offset + size) >= node->block_size)
|
||||
size = node->block_size - offset;
|
||||
|
||||
memcpy(buffer, data + offset, size);
|
||||
|
||||
file->offset += size;
|
||||
return size;
|
||||
}
|
||||
|
||||
static ssize_t initrd_emu_readdir(fildes_t* file, uint8_t* buffer, size_t size)
|
||||
{
|
||||
vfs_node_t* node = file->node;
|
||||
|
||||
uint32_t i, j, k, count;
|
||||
uint32_t index = file->offset;
|
||||
dirent_t* dirent;
|
||||
dir_block_t* dirblock;
|
||||
block_list_t* blist = &node->block_list;
|
||||
|
||||
do {
|
||||
for(i=0,count=0; i<MAX_DATABLOCKS; i++) {
|
||||
dirblock = (dir_block_t*) blist->data[i];
|
||||
for(j=0; dirblock && j<MAX_DIRENTRIES; j++) {
|
||||
dirent = &dirblock->entries[j];
|
||||
if (dirent->vfs_node) {
|
||||
count++;
|
||||
if (count > index) {
|
||||
k=0;
|
||||
do {
|
||||
buffer[k] = dirent->name[k];
|
||||
k++;
|
||||
} while(dirent->name[k] != '\0');
|
||||
file->offset++;
|
||||
return k;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blist = blist->next;
|
||||
} while(blist);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static ssize_t initrd_write(fildes_t* file, uint8_t* buffer, size_t size)
|
||||
{
|
||||
uint32_t i, pos = 0, found = 0;
|
||||
off_t offset = 0;
|
||||
char* data = NULL;
|
||||
vfs_node_t* node = file->node;
|
||||
block_list_t* blist = &node->block_list;
|
||||
|
||||
if (file->flags & O_RDONLY)
|
||||
return -EACCES;
|
||||
|
||||
if (file->flags & O_APPEND)
|
||||
file->offset = node->block_size;
|
||||
|
||||
/* init the tmp offset */
|
||||
offset = file->offset;
|
||||
|
||||
/* searching for the valid data block */
|
||||
if (offset) {
|
||||
pos = offset / MAX_DATAENTRIES;
|
||||
offset = offset % MAX_DATAENTRIES;
|
||||
}
|
||||
|
||||
do {
|
||||
for (i = 0; i < MAX_DATABLOCKS && !data; i++) {
|
||||
if ((size + offset) >= MAX_DATAENTRIES)
|
||||
size = MAX_DATAENTRIES - offset;
|
||||
if(!blist->data[i]) {
|
||||
blist->data[i] = (data_block_t*)
|
||||
kmalloc(sizeof(data_block_t));
|
||||
if (blist->data[i])
|
||||
memset(blist->data[i], 0x00,
|
||||
sizeof(data_block_t));
|
||||
}
|
||||
found++;
|
||||
if (found > pos) {
|
||||
data = (char*) blist->data[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (!blist->next) {
|
||||
blist->next = (block_list_t*)
|
||||
kmalloc(sizeof(block_list_t));
|
||||
if (blist->next)
|
||||
memset(blist->next, 0x00,
|
||||
sizeof(block_list_t));
|
||||
}
|
||||
blist = blist->next;
|
||||
} while(blist && !data);
|
||||
|
||||
/* you may have to increase nodesize */
|
||||
if (node->block_size < (file->offset + size))
|
||||
node->block_size = file->offset + size;
|
||||
/*
|
||||
* If the data block is not large engough,
|
||||
* we copy only the rest of the current block.
|
||||
* The user has to restart the write operation
|
||||
* for the next block.
|
||||
*/
|
||||
memcpy(data + offset, buffer, size);
|
||||
file->offset += size;
|
||||
return size;
|
||||
}
|
||||
|
||||
static int initrd_open(fildes_t* file, const char* name)
|
||||
{
|
||||
if (file->node->type == FS_FILE) {
|
||||
if ((file->flags & O_CREAT) && (file->flags & O_EXCL))
|
||||
return -EEXIST;
|
||||
|
||||
/* in the case of O_TRUNC kfree all the nodes */
|
||||
if (file->flags & O_TRUNC) {
|
||||
uint32_t i;
|
||||
char* data = NULL;
|
||||
block_list_t* blist = &file->node->block_list;
|
||||
block_list_t* lastblist = NULL;
|
||||
|
||||
/* the first blist pointer have do remain valid. */
|
||||
for(i=0; i<MAX_DATABLOCKS && !data; i++) {
|
||||
if (blist->data[i]) {
|
||||
kfree(blist->data[i]);
|
||||
}
|
||||
}
|
||||
if (blist->next) {
|
||||
lastblist = blist;
|
||||
blist = blist->next;
|
||||
lastblist->next = NULL;
|
||||
|
||||
/* kfree all other blist pointers */
|
||||
do {
|
||||
for(i=0; i<MAX_DATABLOCKS && !data; i++) {
|
||||
if (blist->data[i]) {
|
||||
kfree(blist->data[i]);
|
||||
}
|
||||
}
|
||||
lastblist = blist;
|
||||
blist = blist->next;
|
||||
kfree(lastblist);
|
||||
} while(blist);
|
||||
}
|
||||
|
||||
/* reset the block_size */
|
||||
file->node->block_size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (file->node->type == FS_DIRECTORY) {
|
||||
|
||||
/* opendir was called: */
|
||||
if (name[0] == '\0')
|
||||
return 0;
|
||||
|
||||
/* open file was called: */
|
||||
if (!(file->flags & O_CREAT))
|
||||
return -ENOENT;
|
||||
|
||||
uint32_t i, j;
|
||||
block_list_t* blist = NULL;
|
||||
/* CREATE FILE */
|
||||
vfs_node_t* new_node = kmalloc(sizeof(vfs_node_t));
|
||||
if (BUILTIN_EXPECT(!new_node, 0))
|
||||
return -EINVAL;
|
||||
|
||||
blist = &file->node->block_list;
|
||||
dir_block_t* dir_block;
|
||||
dirent_t* dirent;
|
||||
|
||||
memset(new_node, 0x00, sizeof(vfs_node_t));
|
||||
new_node->type = FS_FILE;
|
||||
new_node->read = initrd_read;
|
||||
new_node->write = initrd_write;
|
||||
new_node->open = initrd_open;
|
||||
spinlock_init(&new_node->lock);
|
||||
|
||||
/* create a entry for the new node in the directory block of current node */
|
||||
do {
|
||||
for(i=0; i<MAX_DATABLOCKS; i++) {
|
||||
if (blist->data[i]) {
|
||||
dir_block = (dir_block_t*) blist->data[i];
|
||||
for(j=0; j<MAX_DIRENTRIES; j++) {
|
||||
dirent = &dir_block->entries[j];
|
||||
if (!dirent->vfs_node) {
|
||||
dirent->vfs_node = new_node;
|
||||
strncpy(dirent->name, (char*) name, MAX_FNAME);
|
||||
goto exit_create_file; // there might be a better Solution ***************
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* if all blocks are reserved, we have to allocate a new one */
|
||||
if (!blist->next) {
|
||||
blist->next = (block_list_t*) kmalloc(sizeof(block_list_t));
|
||||
if (blist->next)
|
||||
memset(blist->next, 0x00, sizeof(block_list_t));
|
||||
}
|
||||
|
||||
blist = blist->next;
|
||||
} while(blist);
|
||||
|
||||
exit_create_file:
|
||||
file->node = new_node;
|
||||
file->node->block_size = 0;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static dirent_t* initrd_readdir(vfs_node_t* node, uint32_t index)
|
||||
{
|
||||
uint32_t i, j, count;
|
||||
dirent_t* dirent;
|
||||
dir_block_t* dirblock;
|
||||
block_list_t* blist = &node->block_list;
|
||||
|
||||
do {
|
||||
for(i=0,count=0; i<MAX_DATABLOCKS; i++) {
|
||||
dirblock = (dir_block_t*) blist->data[i];
|
||||
for(j=0; dirblock && j<MAX_DIRENTRIES; j++) {
|
||||
dirent = &dirblock->entries[j];
|
||||
if (dirent->vfs_node) {
|
||||
count++;
|
||||
if (count > index)
|
||||
return dirent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blist = blist->next;
|
||||
} while(blist);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static vfs_node_t* initrd_finddir(vfs_node_t* node, const char *name)
|
||||
{
|
||||
uint32_t i, j;
|
||||
dir_block_t* dirblock;
|
||||
dirent_t* dirent;
|
||||
block_list_t* blist = &node->block_list;
|
||||
|
||||
do {
|
||||
for(i=0; i<MAX_DATABLOCKS; i++) {
|
||||
dirblock = (dir_block_t*) blist->data[i];
|
||||
for(j=0; dirblock && j<MAX_DIRENTRIES; j++) {
|
||||
dirent = &dirblock->entries[j];
|
||||
if (!strncmp(dirent->name, name, MAX_FNAME))
|
||||
return dirent->vfs_node;
|
||||
}
|
||||
}
|
||||
|
||||
blist = blist->next;
|
||||
} while(blist);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static vfs_node_t* initrd_mkdir(vfs_node_t* node, const char* name)
|
||||
{
|
||||
uint32_t i, j;
|
||||
dir_block_t* dir_block;
|
||||
dir_block_t* tmp;
|
||||
dirent_t* dirent;
|
||||
vfs_node_t* new_node;
|
||||
block_list_t* blist = &node->block_list;
|
||||
|
||||
if (BUILTIN_EXPECT(node->type != FS_DIRECTORY, 0))
|
||||
return NULL;
|
||||
|
||||
/* exists already a entry with same name? */
|
||||
if (initrd_finddir(node, name))
|
||||
return NULL;
|
||||
|
||||
new_node = kmalloc(sizeof(vfs_node_t));
|
||||
if (BUILTIN_EXPECT(!new_node, 0))
|
||||
return NULL;
|
||||
|
||||
memset(new_node, 0x00, sizeof(vfs_node_t));
|
||||
new_node->type = FS_DIRECTORY;
|
||||
new_node->read = &initrd_emu_readdir;
|
||||
new_node->readdir = &initrd_readdir;
|
||||
new_node->finddir = &initrd_finddir;
|
||||
new_node->mkdir = &initrd_mkdir;
|
||||
new_node->open = &initrd_open;
|
||||
spinlock_init(&new_node->lock);
|
||||
|
||||
/* create default directory entry */
|
||||
dir_block = (dir_block_t*) kmalloc(sizeof(dir_block_t));
|
||||
if (BUILTIN_EXPECT(!dir_block, 0))
|
||||
goto out;
|
||||
memset(dir_block, 0x00, sizeof(dir_block_t));
|
||||
new_node->block_list.data[0] = dir_block;
|
||||
strncpy(dir_block->entries[0].name, ".", MAX_FNAME);
|
||||
dir_block->entries[0].vfs_node = new_node;
|
||||
strncpy(dir_block->entries[1].name, "..", MAX_FNAME);
|
||||
dir_block->entries[1].vfs_node = node;
|
||||
|
||||
do {
|
||||
/* searching for a free directory block */
|
||||
for(i=0; i<MAX_DATABLOCKS; i++) {
|
||||
if (blist->data[i]) {
|
||||
tmp = (dir_block_t*) blist->data[i];
|
||||
for(j=0; j<MAX_DIRENTRIES; j++) {
|
||||
dirent = &tmp->entries[j];
|
||||
if (!dirent->vfs_node) {
|
||||
dirent->vfs_node = new_node;
|
||||
strncpy(dirent->name, name, MAX_FNAME);
|
||||
return new_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if all blocks are reserved, we have to allocate a new one */
|
||||
if (!blist->next) {
|
||||
blist->next = (block_list_t*) kmalloc(sizeof(block_list_t));
|
||||
if (blist->next)
|
||||
memset(blist->next, 0x00, sizeof(block_list_t));
|
||||
}
|
||||
|
||||
blist = blist->next;
|
||||
} while(blist);
|
||||
|
||||
kfree(dir_block);
|
||||
out:
|
||||
kfree(new_node);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int initrd_init(void)
|
||||
{
|
||||
dir_block_t* dir_block;
|
||||
vfs_node_t* tmp;
|
||||
uint32_t i, j, k, l;
|
||||
uint32_t mods_count = 0;
|
||||
multiboot_module_t* mmodule = NULL;
|
||||
|
||||
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MODS)) {
|
||||
mmodule = (multiboot_module_t*) ((size_t) mb_info->mods_addr);
|
||||
mods_count = mb_info->mods_count;
|
||||
}
|
||||
|
||||
/* Initialize the root directory. */
|
||||
fs_root = &initrd_root;
|
||||
memset(&initrd_root, 0x00, sizeof(vfs_node_t));
|
||||
initrd_root.type = FS_DIRECTORY;
|
||||
initrd_root.read = &initrd_emu_readdir;
|
||||
initrd_root.readdir = &initrd_readdir;
|
||||
initrd_root.finddir = &initrd_finddir;
|
||||
initrd_root.mkdir = &initrd_mkdir;
|
||||
initrd_root.open = &initrd_open;
|
||||
spinlock_init(&initrd_root.lock);
|
||||
|
||||
/* create default directory block */
|
||||
dir_block = (dir_block_t*) kmalloc(sizeof(dir_block_t));
|
||||
if (BUILTIN_EXPECT(!dir_block, 0))
|
||||
return -ENOMEM;
|
||||
memset(dir_block, 0x00, sizeof(dir_block_t));
|
||||
initrd_root.block_list.data[0] = dir_block;
|
||||
strncpy(dir_block->entries[0].name, ".", MAX_FNAME);
|
||||
dir_block->entries[0].vfs_node = fs_root;
|
||||
strncpy(dir_block->entries[1].name, "..", MAX_FNAME);
|
||||
dir_block->entries[1].vfs_node = fs_root;
|
||||
|
||||
/* create the directory bin and dev */
|
||||
mkdir_fs(fs_root, "bin");
|
||||
mkdir_fs(fs_root, "sbin");
|
||||
mkdir_fs(fs_root, "dev");
|
||||
mkdir_fs(fs_root, "tmp");
|
||||
|
||||
/* create the character device "kmessages" */
|
||||
tmp = mkdir_fs(fs_root, "var");
|
||||
kmsg_init(tmp, "log");
|
||||
|
||||
/* For every module.. */
|
||||
for(i=0; i<mods_count; i++) {
|
||||
initrd_header_t* header = (initrd_header_t*) ((size_t) mmodule[i].mod_start);
|
||||
|
||||
initrd_file_desc_t* file_desc;
|
||||
vfs_node_t* new_node;
|
||||
|
||||
if (BUILTIN_EXPECT(header->magic != INITRD_MAGIC_NUMBER, 0)) {
|
||||
kprintf("Invalid magic number for a init ram disk: 0x%x\n", header->magic);
|
||||
continue;
|
||||
}
|
||||
|
||||
tmp = findnode_fs(header->mount_point);
|
||||
if (BUILTIN_EXPECT(!tmp, 0)) {
|
||||
kprintf("Did not found mount point %s.\n", header->mount_point);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (BUILTIN_EXPECT(tmp->type != FS_DIRECTORY, 0)) {
|
||||
kprintf("%s is not a valid mount point.\n", header->mount_point);
|
||||
continue;
|
||||
}
|
||||
|
||||
file_desc = (initrd_file_desc_t*) (header + 1);
|
||||
for(j=0; j<header->nfiles; j++) {
|
||||
block_list_t* blist;
|
||||
dir_block_t* dir_block;
|
||||
dirent_t* dirent;
|
||||
|
||||
if (finddir_fs(tmp, file_desc->fname)) {
|
||||
kprintf("Error: %s alreay exits\n", file_desc->fname);
|
||||
goto next_file;
|
||||
}
|
||||
|
||||
/* create a new node and map the module as data block */
|
||||
new_node = kmalloc(sizeof(vfs_node_t));
|
||||
if (BUILTIN_EXPECT(!new_node, 0)) {
|
||||
kprintf("Not enough memory to create new initrd node\n");
|
||||
goto next_file;
|
||||
}
|
||||
memset(new_node, 0x00, sizeof(vfs_node_t));
|
||||
new_node->type = FS_FILE;
|
||||
new_node->read = initrd_read;
|
||||
new_node->write = initrd_write;
|
||||
new_node->open = initrd_open;
|
||||
new_node->block_size = file_desc->length;
|
||||
new_node->block_list.data[0] = ((char*) header) + file_desc->offset;
|
||||
spinlock_init(&new_node->lock);
|
||||
|
||||
/* create a entry for the new node in the directory block of current node */
|
||||
blist = &tmp->block_list;
|
||||
do {
|
||||
for(k=0; k<MAX_DATABLOCKS; k++) {
|
||||
if (blist->data[k]) {
|
||||
dir_block = (dir_block_t*) blist->data[k];
|
||||
for(l=0; l<MAX_DIRENTRIES; l++) {
|
||||
dirent = &dir_block->entries[l];
|
||||
if (!dirent->vfs_node) {
|
||||
dirent->vfs_node = new_node;
|
||||
strncpy(dirent->name, file_desc->fname, MAX_FNAME);
|
||||
goto next_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if all blocks are reserved, we have to allocate a new one */
|
||||
if (!blist->next) {
|
||||
blist->next = (block_list_t*) kmalloc(sizeof(block_list_t));
|
||||
if (blist->next)
|
||||
memset(blist->next, 0x00, sizeof(block_list_t));
|
||||
}
|
||||
|
||||
blist = blist->next;
|
||||
} while(blist);
|
||||
next_file:
|
||||
file_desc++;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
52
include/eduos/config.h.in
Normal file
52
include/eduos/config.h.in
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* include/eduos/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define the bitmap size */
|
||||
#undef BITMAP_SIZE
|
||||
|
||||
/* Enable PCI support */
|
||||
#undef CONFIG_PCI
|
||||
|
||||
/* Enable UART support */
|
||||
#undef CONFIG_UART
|
||||
|
||||
/* Define the size of the user stack */
|
||||
#undef DEFAULT_STACK_SIZE
|
||||
|
||||
/* Define to use machine specific version of memcpy */
|
||||
#undef HAVE_ARCH_MEMCPY
|
||||
|
||||
/* Define to use machine specific version of memset */
|
||||
#undef HAVE_ARCH_MEMSET
|
||||
|
||||
/* Define to use machine specific version of strcpy */
|
||||
#undef HAVE_ARCH_STRCPY
|
||||
|
||||
/* Define to use machine specific version of strlen */
|
||||
#undef HAVE_ARCH_STRLEN
|
||||
|
||||
/* Define to use machine specific version of strncpy */
|
||||
#undef HAVE_ARCH_STRNCPY
|
||||
|
||||
/* Define the size of the kernel stack */
|
||||
#undef KERNEL_STACK_SIZE
|
||||
|
||||
/* Define the maximum number of running tasks */
|
||||
#undef MAX_TASKS
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
129
include/eduos/ctype.h
Normal file
129
include/eduos/ctype.h
Normal file
|
@ -0,0 +1,129 @@
|
|||
/****************************************************************************************
|
||||
*
|
||||
* Author: Stefan Lankes
|
||||
* Chair for Operating Systems, RWTH Aachen University
|
||||
* Date: 24/03/2011
|
||||
*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Written by the Chair for Operating Systems, RWTH Aachen University
|
||||
*
|
||||
* NO Copyright (C) 2010, Stefan Lankes,
|
||||
* consider these trivial functions to be public domain.
|
||||
*
|
||||
* These functions are distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Stefan Lankes
|
||||
* @file include/eduos/ctype.h
|
||||
* @brief Functions related to alphanumerical character values
|
||||
*
|
||||
* This file contains functions helping to determine
|
||||
* the type of alphanumerical character values.
|
||||
*/
|
||||
|
||||
#ifndef __CTYPE_H_
|
||||
#define __CYTPE_H_
|
||||
|
||||
/** Returns true if the value of 'c' is an ASCII-charater */
|
||||
static inline int isascii(int c)
|
||||
{
|
||||
return (((unsigned char)(c))<=0x7f);
|
||||
}
|
||||
|
||||
/** Applies an and-operation to
|
||||
* push the value of 'c' into the ASCII-range */
|
||||
static inline int toascii(int c)
|
||||
{
|
||||
return (((unsigned char)(c))&0x7f);
|
||||
}
|
||||
|
||||
/** Returns true if the value of 'c' is the
|
||||
* space character or a control character */
|
||||
static inline int isspace(int c)
|
||||
{
|
||||
if (!isascii(c))
|
||||
return 0;
|
||||
|
||||
if (' ' == (unsigned char) c)
|
||||
return 1;
|
||||
if ('\n' == (unsigned char) c)
|
||||
return 1;
|
||||
if ('\r' == (unsigned char) c)
|
||||
return 1;
|
||||
if ('\t' == (unsigned char) c)
|
||||
return 1;
|
||||
if ('\v' == (unsigned char) c)
|
||||
return 1;
|
||||
if ('\f' == (unsigned char) c)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Returns true if the value of 'c' is a number */
|
||||
static inline int isdigit(int c)
|
||||
{
|
||||
if (!isascii(c))
|
||||
return 0;
|
||||
|
||||
if (((unsigned char) c >= '0') && ((unsigned char) c <= '9'))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Returns true if the value of 'c' is a lower case letter */
|
||||
static inline int islower(int c)
|
||||
{
|
||||
if (!isascii(c))
|
||||
return 0;
|
||||
|
||||
if (((unsigned char) c >= 'a') && ((unsigned char) c <= 'z'))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Returns true if the value of 'c' is an upper case letter */
|
||||
static inline int isupper(int c)
|
||||
{
|
||||
if (!isascii(c))
|
||||
return 0;
|
||||
|
||||
if (((unsigned char) c >= 'A') && ((unsigned char) c <= 'Z'))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Returns true if the value of 'c' is an alphabetic character */
|
||||
static inline int isalpha(int c)
|
||||
{
|
||||
if (isupper(c) || islower(c))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Makes the input character lower case.\n Will do nothing if it
|
||||
* was something different than an upper case letter before. */
|
||||
static inline unsigned char tolower(unsigned char c)
|
||||
{
|
||||
if (isupper(c))
|
||||
c -= 'A'-'a';
|
||||
return c;
|
||||
}
|
||||
|
||||
/** Makes the input character upper case.\n Will do nothing if it
|
||||
* was something different than a lower case letter before. */
|
||||
static inline unsigned char toupper(unsigned char c)
|
||||
{
|
||||
if (islower(c))
|
||||
c -= 'a'-'A';
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
293
include/eduos/fs.h
Normal file
293
include/eduos/fs.h
Normal file
|
@ -0,0 +1,293 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Stefan Lankes, RWTH Aachen University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Stefan Lankes
|
||||
* @file include/eduos/fs.h
|
||||
* @brief Filesystem related functions and structures
|
||||
*/
|
||||
|
||||
#ifndef __FS_H__
|
||||
#define __FS_H__
|
||||
|
||||
#include <eduos/stddef.h>
|
||||
#include <eduos/spinlock_types.h>
|
||||
|
||||
#define FS_FILE 0x01
|
||||
#define FS_DIRECTORY 0x02
|
||||
#define FS_CHARDEVICE 0x03
|
||||
//#define FS_BLOCKDEVICE 0x04
|
||||
//#define FS_PIPE 0x05
|
||||
//#define FS_SYMLINK 0x06
|
||||
//#define FS_MOUNTPOINT 0x08 // Is the file an active mountpoint?
|
||||
|
||||
|
||||
/*file descriptor init*/
|
||||
#define NR_OPEN 100
|
||||
|
||||
#define _FOPEN (-1) /* from sys/file.h, kernel use only */
|
||||
#define _FREAD 0x0001 /* read enabled */
|
||||
#define _FWRITE 0x0002 /* write enabled */
|
||||
#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
|
||||
#define _FMARK 0x0010 /* internal; mark during gc() */
|
||||
#define _FDEFER 0x0020 /* internal; defer for next gc pass */
|
||||
#define _FASYNC 0x0040 /* signal pgrp when data ready */
|
||||
#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
|
||||
#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
|
||||
#define _FCREAT 0x0200 /* open with file create */
|
||||
#define _FTRUNC 0x0400 /* open with truncation */
|
||||
#define _FEXCL 0x0800 /* error on open if file exists */
|
||||
#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
|
||||
#define _FSYNC 0x2000 /* do all writes synchronously */
|
||||
#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
|
||||
#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
|
||||
#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
|
||||
|
||||
/*open flags*/
|
||||
#define O_RDONLY 0
|
||||
#define O_WRONLY 1
|
||||
#define O_RDWR 2
|
||||
#define O_APPEND _FAPPEND
|
||||
#define O_CREAT _FCREAT
|
||||
#define O_TRUNC _FTRUNC
|
||||
#define O_EXCL _FEXCL
|
||||
#define O_SYNC _FSYNC
|
||||
#define O_NONBLOCK _FNONBLOCK
|
||||
#define O_NOCTTY _FNOCTTY
|
||||
|
||||
/*lseek defines*/
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0 /* set file offset to offset */
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
||||
#endif
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
||||
#endif
|
||||
|
||||
struct vfs_node;
|
||||
struct fildes;
|
||||
/** @defgroup fsprototypes FS access function prototypes
|
||||
*
|
||||
* These typedefs define the type of callbacks - called when read/write/open/close are called.\n
|
||||
* They aren't as well documented as the read_fs and so on functions. Just look there for further information.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Read function pointer */
|
||||
typedef ssize_t (*read_type_t) (struct fildes *, uint8_t*, size_t);
|
||||
/** @brief Write function pointer */
|
||||
typedef ssize_t (*write_type_t) (struct fildes *, uint8_t*, size_t);
|
||||
/** @brief Open function pointer */
|
||||
typedef int (*open_type_t) (struct fildes *, const char *name);
|
||||
/** @brief Close function pointer */
|
||||
typedef int (*close_type_t) (struct fildes *);
|
||||
/** @brief Read directory function pointer */
|
||||
typedef struct dirent *(*readdir_type_t) (struct vfs_node *, uint32_t);
|
||||
/** @brief Find directory function pointer */
|
||||
typedef struct vfs_node *(*finddir_type_t) (struct vfs_node *, const char *name);
|
||||
/** @brief Make directory function pointer */
|
||||
typedef struct vfs_node *(*mkdir_type_t) (struct vfs_node *, const char *name);
|
||||
|
||||
/** @} */
|
||||
|
||||
#define MAX_DATABLOCKS 12
|
||||
#define MAX_DIRENTRIES 32
|
||||
#define MAX_DATAENTRIES 4096
|
||||
|
||||
|
||||
/** @brief Block list structure. VFS nodes keep those in a list */
|
||||
typedef struct block_list {
|
||||
/// Array with pointers to data blocks
|
||||
void* data[MAX_DATABLOCKS];
|
||||
/// Pointer to the next block_list in the list
|
||||
struct block_list* next;
|
||||
} block_list_t;
|
||||
|
||||
typedef struct vfs_node {
|
||||
/// The permissions mask.
|
||||
uint32_t mask;
|
||||
/// The owning user.
|
||||
uint32_t uid;
|
||||
/// The owning group.
|
||||
uint32_t gid;
|
||||
/// Includes the node type. See the defines above.
|
||||
uint32_t type;
|
||||
/// Open handler function pointer
|
||||
open_type_t open;
|
||||
/// Close handler function pointer
|
||||
close_type_t close;
|
||||
/// Read handler function pointer
|
||||
read_type_t read;
|
||||
/// Write handler function pointer
|
||||
write_type_t write;
|
||||
/// Read dir handler function pointer
|
||||
readdir_type_t readdir;
|
||||
/// Find dir handler function pointer
|
||||
finddir_type_t finddir;
|
||||
/// Make dir handler function pointer
|
||||
mkdir_type_t mkdir;
|
||||
/// Lock variable to thread-protect this structure
|
||||
spinlock_t lock;
|
||||
/// Block size
|
||||
size_t block_size;
|
||||
/// List of blocks
|
||||
block_list_t block_list;
|
||||
} vfs_node_t;
|
||||
|
||||
/** @brief file descriptor structure */
|
||||
typedef struct fildes {
|
||||
vfs_node_t* node; /* */
|
||||
off_t offset; /* */
|
||||
int flags; /* */
|
||||
int mode; /* */
|
||||
int count; /* number of tasks using this fd */
|
||||
} fildes_t, *filp_t;
|
||||
|
||||
/** @brief Directory entry structure */
|
||||
typedef struct dirent {
|
||||
/// Directory name
|
||||
char name[MAX_FNAME];
|
||||
/// Corresponding VFS node pointer
|
||||
vfs_node_t* vfs_node;
|
||||
} dirent_t;
|
||||
|
||||
/** @brief Dir block structure which will keep directory entries */
|
||||
typedef struct {
|
||||
/// Array of directory entries
|
||||
dirent_t entries[MAX_DIRENTRIES];
|
||||
} dir_block_t;
|
||||
|
||||
typedef struct {
|
||||
///Array of data entries
|
||||
char entries[MAX_DATAENTRIES];
|
||||
} data_block_t;
|
||||
|
||||
|
||||
/* Time Value Specification Structures, P1003.1b-1993, p. 261 */
|
||||
struct timespec {
|
||||
long tv_sec; /* Seconds */
|
||||
long tv_nsec; /* Nanoseconds */
|
||||
};
|
||||
|
||||
struct stat
|
||||
{
|
||||
uint16_t st_dev; /* ID of device containing file */
|
||||
uint16_t st_ino; /* inode number */
|
||||
uint32_t st_mode; /* protection */
|
||||
unsigned short st_nlink; /* number of hard links */
|
||||
uint16_t st_uid; /* user ID of owner */
|
||||
uint16_t st_gid; /* group ID of owner */
|
||||
uint16_t st_rdev; /* device ID (if special file) */
|
||||
off_t st_size; /* total size, in bytes */
|
||||
struct timespec st_atim; /* time of last access */
|
||||
struct timespec st_mtim; /* time of last modification */
|
||||
struct timespec st_ctim; /* time of last status change */
|
||||
uint32_t st_blksize; /* blocksize for filesystem I/O */
|
||||
uint32_t st_blocks; /* number of blocks allocated */
|
||||
} stat_t;
|
||||
|
||||
extern vfs_node_t* fs_root; // The root of the filesystem.
|
||||
|
||||
/** @defgroup fsfunc FS related functions
|
||||
*
|
||||
* Standard read/write/open/close/mkdir functions. Note that these are all suffixed with
|
||||
* _fs to distinguish them from the read/write/open/close which deal with file descriptors,
|
||||
* not file nodes.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Read from file system into the buffer
|
||||
* @param file Pointer to the file descriptor to read from
|
||||
* @param buffer Pointer to buffer to write into
|
||||
* @param size Number of bytes to read
|
||||
* @return
|
||||
* - number of bytes copied (size)
|
||||
* - 0 on error
|
||||
*/
|
||||
ssize_t read_fs(fildes_t* file, uint8_t* buffer, size_t size);
|
||||
|
||||
/** @brief Write into the file system from the buffer
|
||||
* @param file Pointer to the file descriptor to write to
|
||||
* @param buffer Pointer to buffer to read from
|
||||
* @param size Number of bytes to read
|
||||
* @return
|
||||
* - number of bytes copied (size)
|
||||
* - 0 on error
|
||||
*/
|
||||
ssize_t write_fs(fildes_t* file, uint8_t* buffer, size_t size);
|
||||
|
||||
/** @brief Yet to be documented */
|
||||
int open_fs(fildes_t* file, const char* fname);
|
||||
|
||||
/** @brief Yet to be documented */
|
||||
int close_fs(fildes_t * file);
|
||||
|
||||
/** @brief Get dir entry at index
|
||||
* @param node VFS node to get dir entry from
|
||||
* @param index Index position of desired dir entry
|
||||
* @return
|
||||
* - The desired dir entry
|
||||
* - NULL on failure
|
||||
*/
|
||||
struct dirent *readdir_fs(vfs_node_t * node, uint32_t index);
|
||||
|
||||
/** @brief Find a directory by looking for the dir name
|
||||
* @param node The node where to start the search from
|
||||
* @param name The dir name string
|
||||
* @return
|
||||
* - a VFS node pointer
|
||||
* - NULL on failure
|
||||
*/
|
||||
vfs_node_t* finddir_fs(vfs_node_t * node, const char *name);
|
||||
|
||||
/** @brief Make a new directory in a VFS node
|
||||
* @param node Pointer to the node where the dir is to create in
|
||||
* @param name Name of the new directory
|
||||
* @return
|
||||
* - new VFS node pointer
|
||||
* - NULL on failure
|
||||
*/
|
||||
vfs_node_t* mkdir_fs(vfs_node_t* node, const char* name);
|
||||
|
||||
/** @brief Find a node within root file system
|
||||
* @param name The node name
|
||||
* @return
|
||||
* - VFS node pointer
|
||||
* - NULL on failure
|
||||
*/
|
||||
vfs_node_t* findnode_fs(const char* name);
|
||||
|
||||
/** @brief List a filesystem hirachically */
|
||||
void list_fs(vfs_node_t* node, uint32_t depth);
|
||||
|
||||
int initrd_init(void);
|
||||
|
||||
#endif
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
/**
|
||||
* @author Stefan Lankes
|
||||
* @file include/metalsvm/mailbox_types.h
|
||||
* @file include/eduos/mailbox_types.h
|
||||
* @brief Mailbox system for inter-task communication
|
||||
*/
|
||||
|
||||
|
|
85
include/eduos/malloc.h
Normal file
85
include/eduos/malloc.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (c) 2014, Steffen Vogel, RWTH Aachen University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Steffen Vogel <steffen.vogel@rwth-aachen.de>
|
||||
*/
|
||||
|
||||
#ifndef __MALLOC_H__
|
||||
#define __MALLOC_H__
|
||||
|
||||
#include <eduos/stddef.h>
|
||||
#include <eduos/stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// Binary exponent of maximal size for kmalloc()
|
||||
#define BUDDY_MAX 32 // 4 GB
|
||||
/// Binary exponent of minimal buddy size
|
||||
#define BUDDY_MIN 3 // 8 Byte >= sizeof(buddy_t)
|
||||
/// Binary exponent of the size which we allocate with buddy_fill()
|
||||
#define BUDDY_ALLOC 16 // 64 KByte = 16 * PAGE_SIZE
|
||||
|
||||
#define BUDDY_LISTS (BUDDY_MAX-BUDDY_MIN+1)
|
||||
#define BUDDY_MAGIC 0xBABE
|
||||
|
||||
union buddy;
|
||||
|
||||
/** @brief Buddy
|
||||
*
|
||||
* Every free memory block is stored in a linked list according to its size.
|
||||
* We can use this free memory to store store this buddy_t union which represents
|
||||
* this block (the buddy_t union is alligned to the front).
|
||||
* Therefore the address of the buddy_t union is equal with the address
|
||||
* of the underlying free memory block.
|
||||
*
|
||||
* Every allocated memory block is prefixed with its binary size exponent and
|
||||
* a known magic number. This prefix is hidden by the user because its located
|
||||
* before the actual memory address returned by kmalloc()
|
||||
*/
|
||||
typedef union buddy {
|
||||
/// Pointer to the next buddy in the linked list.
|
||||
union buddy* next;
|
||||
struct {
|
||||
/// The binary exponent of the block size
|
||||
uint8_t exponent;
|
||||
/// Must be equal to BUDDY_MAGIC for a valid memory block
|
||||
uint16_t magic;
|
||||
} prefix;
|
||||
} buddy_t;
|
||||
|
||||
/** @brief Dump free buddies */
|
||||
void buddy_dump(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -37,12 +37,34 @@
|
|||
#define __MEMORY_H__
|
||||
|
||||
/** @brief Initialize the memory subsystem */
|
||||
int memory_init();
|
||||
int memory_init(void);
|
||||
|
||||
/** @brief Request physical page frames */
|
||||
size_t get_pages(size_t npages);
|
||||
|
||||
/** @brief Get a single page
|
||||
*
|
||||
* Convenience function: uses get_pages(1);
|
||||
*/
|
||||
static inline size_t get_page(void) { return get_pages(1); }
|
||||
|
||||
/** @brief release physical page frames */
|
||||
int put_pages(size_t phyaddr, size_t npages);
|
||||
|
||||
/** @brief Put a single page
|
||||
*
|
||||
* Convenience function: uses put_pages(1);
|
||||
*/
|
||||
static inline int put_page(size_t phyaddr) { return put_pages(phyaddr, 1); }
|
||||
|
||||
/** @brief Copy a physical page frame
|
||||
*
|
||||
* @param psrc physical address of source page frame
|
||||
* @param pdest physical address of source page frame
|
||||
* @return
|
||||
* - 0 on success
|
||||
* - -1 on failure
|
||||
*/
|
||||
int copy_page(size_t pdest, size_t psrc);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,11 +41,41 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_FNAME 128
|
||||
#define TIMER_FREQ 100 /* in HZ */
|
||||
#define CLOCK_TICK_RATE 1193182 /* 8254 chip's internal oscillator frequency */
|
||||
#define VIDEO_MEM_ADDR 0xB8000 // the video memora address
|
||||
#define CACHE_LINE 64
|
||||
#define KERNEL_SPACE (1 << 30) /* 1 GiB */
|
||||
#define KMSG_SIZE (8*1024)
|
||||
#define INT_SYSCALL 0x80
|
||||
#define MAILBOX_SIZE 32
|
||||
#define WITH_PCI_NAMES
|
||||
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#else
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define BUILTIN_EXPECT(exp, b) __builtin_expect((exp), (b))
|
||||
#else
|
||||
#define BUILTIN_EXPECT(exp, b) (exp)
|
||||
#endif
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#define STDCALL __attribute__((stdcall))
|
||||
|
||||
#define NULL ((void*) 0)
|
||||
|
||||
/// represents a task identifier
|
||||
typedef unsigned int tid_t;
|
||||
|
||||
#define PAGE_SHIFT 12
|
||||
#define PAGE_BITS PAGE_SHIFT
|
||||
#define PAGE_SIZE (1 << PAGE_SHIFT)
|
||||
#define PAGE_MASK ~(PAGE_SIZE - 1)
|
||||
#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
|
||||
|
||||
struct task;
|
||||
/// pointer to the current (running) task
|
||||
extern struct task* current_task;
|
||||
|
|
|
@ -77,6 +77,12 @@ int ksnprintf(char *str, size_t size, const char *format, ...);
|
|||
*/
|
||||
int kvprintf(char const *fmt, void (*func) (int, void *), void *arg, int radix, va_list ap);
|
||||
|
||||
struct vfs_node;
|
||||
/**
|
||||
* Init function to create a character device which represents all kernel messages
|
||||
*/
|
||||
int kmsg_init(struct vfs_node* node, const char *name);
|
||||
|
||||
/**
|
||||
* Add UART device to dump kernel messages
|
||||
*/
|
||||
|
|
|
@ -38,18 +38,96 @@
|
|||
#define __STDLIB_H__
|
||||
|
||||
#include <eduos/config.h>
|
||||
#include <asm/stddef.h>
|
||||
#include <eduos/stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @brief General page allocator function
|
||||
*
|
||||
* This function allocates and maps whole pages.
|
||||
* Mapped memory will be tracked by the VMA subsystem.
|
||||
* The sz argument is rounded down to multiples of the page size.
|
||||
*
|
||||
* For allocations which are smaller than a page you should use
|
||||
* the buddy system allocator (kmalloc and kfree) to avoid fragmentation.
|
||||
*
|
||||
* @param sz Desired size of the new memory
|
||||
* @param flags Flags to for map_region(), vma_add()
|
||||
*
|
||||
* @return Pointer to the new memory range (page-aligned).
|
||||
*/
|
||||
void* palloc(size_t sz, uint32_t flags);
|
||||
|
||||
/** @brief Free general kernel pages
|
||||
*
|
||||
* This function removes the memory from the VMA subsystem,
|
||||
* unmap the pages and releases the physical pages.
|
||||
*
|
||||
* The pmalloc() doesn't track how much memory was allocated for which pointer,
|
||||
* so you have to specify how much memory shall be freed.
|
||||
*
|
||||
* @param addr The virtual address returned by palloc().
|
||||
* @param sz The size which should freed
|
||||
*/
|
||||
void pfree(void* addr, size_t sz);
|
||||
|
||||
/** @brief The memory allocator function
|
||||
*
|
||||
* This allocator uses a buddy system to allocate memory.
|
||||
* Attention: memory is not aligned!
|
||||
*
|
||||
* @return Pointer to the new memory range
|
||||
*/
|
||||
void* kmalloc(size_t sz);
|
||||
|
||||
/** @brief Release memory back to the buddy system
|
||||
*
|
||||
* Every block of memory allocated by kmalloc() is prefixed with a buddy_t
|
||||
* which includes the the size of the allocated block.
|
||||
* This prefix is also used to re-insert the block into the linked list
|
||||
* of free buddies.
|
||||
*
|
||||
* Released memory will still be managed by the buddy system.
|
||||
* Pages are not unmapped.
|
||||
*
|
||||
* Note: adjacent buddies are currently not merged!
|
||||
*
|
||||
* @see buddy_t
|
||||
* @param addr The address to the memory block allocated by kmalloc()
|
||||
*/
|
||||
void kfree(void* addr);
|
||||
|
||||
/** @brief Create a new stack for a new task
|
||||
*
|
||||
* @return start address of the new stack
|
||||
*/
|
||||
void* create_stack(tid_t id);
|
||||
|
||||
/** @brief String to long
|
||||
*
|
||||
* @return Long value of the parsed numerical string
|
||||
*/
|
||||
long strtol(const char* str, char** endptr, int base);
|
||||
|
||||
/** @brief String to unsigned long
|
||||
*
|
||||
* @return Unsigned long value of the parsed numerical string
|
||||
*/
|
||||
unsigned long strtoul(const char* nptr, char** endptr, int base);
|
||||
|
||||
/** @brief ASCII to integer
|
||||
*
|
||||
* Convenience function using strtol().
|
||||
*
|
||||
* @return Integer value of the parsed numerical string
|
||||
*/
|
||||
static inline int atoi(const char *str)
|
||||
{
|
||||
return (int)strtol(str, (char **)NULL, 10);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -54,11 +54,11 @@ size_t strlen(const char *str);
|
|||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_STRNCPY
|
||||
char* strncpy(char *dest, const char *src, size_t n);
|
||||
char *strncpy(char *dest, const char *src, size_t n);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_STRCPY
|
||||
char* strcpy(char *dest, const char *src);
|
||||
char *strcpy(char *dest, const char *src);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_STRCMP
|
||||
|
@ -69,6 +69,8 @@ int strcmp(const char *s1, const char *s2);
|
|||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
#endif
|
||||
|
||||
char *strstr(const char *s, const char *find);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -75,7 +75,6 @@ extern "C" {
|
|||
#define __NR_stat 30
|
||||
#define __NR_dup 31
|
||||
#define __NR_dup2 32
|
||||
#define __NR_clone 33
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -81,6 +81,18 @@ int multitasking_init(void);
|
|||
*/
|
||||
int create_kernel_task(tid_t* id, entry_point_t ep, void* args, uint8_t prio);
|
||||
|
||||
/** @brief Create a user level task.
|
||||
*
|
||||
* @param id The value behind this pointer will be set to the new task's id
|
||||
* @param fname Filename of the executable to start the task with
|
||||
* @param argv Pointer to arguments array
|
||||
*
|
||||
* @return
|
||||
* - 0 on success
|
||||
* - -EINVAL (-22) or -ENOMEM (-12)on failure
|
||||
*/
|
||||
int create_user_task(tid_t* id, const char* fame, char** argv);
|
||||
|
||||
/** @brief determine the highest priority of all tasks, which are ready
|
||||
*
|
||||
* @return
|
||||
|
@ -121,9 +133,6 @@ void NORETURN abort(void);
|
|||
/** @brief This function shall be called by leaving kernel-level tasks */
|
||||
void NORETURN leave_kernel_task(void);
|
||||
|
||||
/** @brief This function shall be called by leaving user-level tasks */
|
||||
void NORETURN leave_user_task(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include <eduos/stddef.h>
|
||||
#include <eduos/spinlock_types.h>
|
||||
|
||||
#include <eduos/vma.h>
|
||||
#include <asm/tasks_types.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
|
@ -79,12 +79,18 @@ typedef struct task {
|
|||
size_t page_map;
|
||||
/// Lock for page tables
|
||||
spinlock_irqsave_t page_lock;
|
||||
/// lock for the VMA_list
|
||||
spinlock_t vma_lock;
|
||||
/// list of VMAs
|
||||
vma_t* vma_list;
|
||||
/// the userspace heap
|
||||
vma_t* heap;
|
||||
/// usage in number of pages (including page map tables)
|
||||
atomic_int32_t user_usage;
|
||||
atomic_int32_t user_usage;
|
||||
/// next task in the queue
|
||||
struct task* next;
|
||||
struct task* next;
|
||||
/// previous task in the queue
|
||||
struct task* prev;
|
||||
struct task* prev;
|
||||
} task_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
164
include/eduos/vma.h
Normal file
164
include/eduos/vma.h
Normal file
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* Copyright (c) 2011, Stefan Lankes, RWTH Aachen University
|
||||
* 2014, Steffen Vogel, RWTH Aachen University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Stefan Lankes
|
||||
* @author Steffen Vogel <steffen.vogel@rwth-aachen.de>
|
||||
* @file include/eduos/vma.h
|
||||
* @brief VMA related sructure and functions
|
||||
*/
|
||||
|
||||
#ifndef __VMA_H__
|
||||
#define __VMA_H__
|
||||
|
||||
#include <eduos/stddef.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// Read access to this VMA is allowed
|
||||
#define VMA_READ (1 << 0)
|
||||
/// Write access to this VMA is allowed
|
||||
#define VMA_WRITE (1 << 1)
|
||||
/// Instructions fetches in this VMA are allowed
|
||||
#define VMA_EXECUTE (1 << 2)
|
||||
/// This VMA is cacheable
|
||||
#define VMA_CACHEABLE (1 << 3)
|
||||
/// This VMA is not accessable
|
||||
#define VMA_NO_ACCESS (1 << 4)
|
||||
/// This VMA should be part of the userspace
|
||||
#define VMA_USER (1 << 5)
|
||||
/// A collection of flags used for the kernel heap (kmalloc)
|
||||
#define VMA_HEAP (VMA_READ|VMA_WRITE|VMA_CACHEABLE)
|
||||
|
||||
// boundaries for VAS allocation
|
||||
#define VMA_KERN_MIN 0xC0000
|
||||
#define VMA_KERN_MAX KERNEL_SPACE
|
||||
#define VMA_USER_MIN KERNEL_SPACE
|
||||
|
||||
// last three top level entries are reserved
|
||||
#ifdef CONFIG_X86_32
|
||||
#define VMA_USER_MAX 0xFF400000
|
||||
#elif defined (CONFIG_X86_64)
|
||||
#define VMA_USER_MAX 0xFFFFFE8000000000
|
||||
#endif
|
||||
|
||||
struct vma;
|
||||
|
||||
/** @brief VMA structure definition
|
||||
*
|
||||
* Each item in this linked list marks a used part of the virtual address space.
|
||||
* Its used by vm_alloc() to find holes between them.
|
||||
*/
|
||||
typedef struct vma {
|
||||
/// Start address of the memory area
|
||||
size_t start;
|
||||
/// End address of the memory area
|
||||
size_t end;
|
||||
/// Type flags field
|
||||
uint32_t flags;
|
||||
/// Pointer of next VMA element in the list
|
||||
struct vma* next;
|
||||
/// Pointer to previous VMA element in the list
|
||||
struct vma* prev;
|
||||
} vma_t;
|
||||
|
||||
/** @brief Initalize the kernelspace VMA list
|
||||
*
|
||||
* Reserves several system-relevant virtual memory regions:
|
||||
* - SMP boot page (SMP_SETUP_ADDR)
|
||||
* - VGA video memory (VIDEO_MEM_ADDR)
|
||||
* - The kernel (kernel_start - kernel_end)
|
||||
* - Multiboot structure (mb_info)
|
||||
* - Multiboot mmap (mb_info->mmap_*)
|
||||
* - Multiboot modules (mb_info->mods_*)
|
||||
* - Init Ramdisk
|
||||
*
|
||||
* @return
|
||||
* - 0 on success
|
||||
* - <0 on failure
|
||||
*/
|
||||
int vma_init(void);
|
||||
|
||||
/** @brief Add a new virtual memory area to the list of VMAs
|
||||
*
|
||||
* @param start Start address of the new area
|
||||
* @param end End address of the new area
|
||||
* @param flags Type flags the new area shall have
|
||||
*
|
||||
* @return
|
||||
* - 0 on success
|
||||
* - -EINVAL (-22) or -EINVAL (-12) on failure
|
||||
*/
|
||||
int vma_add(size_t start, size_t end, uint32_t flags);
|
||||
|
||||
/** @brief Search for a free memory area
|
||||
*
|
||||
* @param size Size of requestes VMA in bytes
|
||||
* @param flags
|
||||
* @return Type flags the new area shall have
|
||||
* - 0 on failure
|
||||
* - the start address of a free area
|
||||
*/
|
||||
size_t vma_alloc(size_t size, uint32_t flags);
|
||||
|
||||
/** @brief Free an allocated memory area
|
||||
*
|
||||
* @param start Start address of the area to be freed
|
||||
* @param end End address of the to be freed
|
||||
* @return
|
||||
* - 0 on success
|
||||
* - -EINVAL (-22) on failure
|
||||
*/
|
||||
int vma_free(size_t start, size_t end);
|
||||
|
||||
/** @brief Free all virtual memory areas
|
||||
*
|
||||
* @return
|
||||
* - 0 on success
|
||||
*/
|
||||
int drop_vma_list(struct task* task);
|
||||
|
||||
/** @brief Copy the VMA list of the current task to task
|
||||
*
|
||||
* @param task The task where the list should be copied to
|
||||
* @return
|
||||
* - 0 on success
|
||||
*/
|
||||
int copy_vma_list(struct task* src, struct task* dest);
|
||||
|
||||
/** @brief Dump information about this task's VMAs into the terminal. */
|
||||
void vma_dump(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
501
install-sh
Executable file
501
install-sh
Executable file
|
@ -0,0 +1,501 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2013-12-25.23; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -34,6 +34,8 @@
|
|||
#include <eduos/tasks.h>
|
||||
#include <eduos/syscall.h>
|
||||
#include <eduos/memory.h>
|
||||
#include <eduos/vma.h>
|
||||
#include <eduos/fs.h>
|
||||
|
||||
#include <asm/irq.h>
|
||||
#include <asm/irqflags.h>
|
||||
|
@ -57,50 +59,11 @@ extern atomic_int32_t total_pages;
|
|||
extern atomic_int32_t total_allocated_pages;
|
||||
extern atomic_int32_t total_available_pages;
|
||||
|
||||
static void NORETURN userfoo(void* arg)
|
||||
{
|
||||
|
||||
SYSCALL1(__NR_write, "hello from userfoo\n");
|
||||
SYSCALL1(__NR_exit, 0);
|
||||
|
||||
while(1) ;
|
||||
}
|
||||
|
||||
static char ustack[KERNEL_STACK_SIZE] __attribute__ ((aligned (PAGE_SIZE)));
|
||||
|
||||
static int wrapper(void* arg)
|
||||
{
|
||||
size_t* stack = (size_t*) (ustack+KERNEL_STACK_SIZE-16);
|
||||
|
||||
memset(ustack, 0xCD, KERNEL_STACK_SIZE);
|
||||
*stack-- = (size_t) arg;
|
||||
*stack = (size_t) NULL; // put exit function as caller on the stack
|
||||
|
||||
#if 0
|
||||
// this triggers a page fault because a user task is not able to access the kernel space
|
||||
return jump_to_user_code((uint32_t) userfoo, (uint32_t) stack);
|
||||
#else
|
||||
// dirty hack, map userfoo to the user space
|
||||
size_t phys = page_virt_to_phys(((size_t) userfoo) & PAGE_MASK);
|
||||
size_t vuserfoo = 0x40000000;
|
||||
page_map(vuserfoo, phys, 2, PG_PRESENT | PG_USER);
|
||||
vuserfoo += (size_t)userfoo & 0xFFF;
|
||||
|
||||
// dirty hack, map ustack to the user space
|
||||
phys = page_virt_to_phys((size_t) ustack);
|
||||
size_t vstack = 0x80000000;
|
||||
page_map(vstack, phys, KERNEL_STACK_SIZE >> PAGE_BITS, PG_PRESENT | PG_RW | PG_USER);
|
||||
vstack = (vstack + KERNEL_STACK_SIZE - 16 - sizeof(size_t));
|
||||
|
||||
return jump_to_user_code(vuserfoo, vstack);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int foo(void* arg)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<10; i++) {
|
||||
for(i=0; i<2; i++) {
|
||||
kprintf("hello from %s\n", (char*) arg);
|
||||
}
|
||||
|
||||
|
@ -126,28 +89,33 @@ static int eduos_init(void)
|
|||
#ifdef CONFIG_UART
|
||||
uart_init();
|
||||
#endif
|
||||
initrd_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
tid_t id1;
|
||||
tid_t id2;
|
||||
char* argv[] = {"/bin/hello", NULL};
|
||||
|
||||
eduos_init();
|
||||
irq_enable();
|
||||
system_calibration();
|
||||
|
||||
kprintf("This is eduOS %s Build %u, %u\n", EDUOS_VERSION, &__BUILD_DATE, &__BUILD_TIME);
|
||||
kprintf("This is %s Build %u, %u\n", PACKAGE_STRING, &__BUILD_DATE, &__BUILD_TIME);
|
||||
kprintf("Kernel starts at %p and ends at %p\n", &kernel_start, &kernel_end);
|
||||
kprintf("Processor frequency: %u MHz\n", get_cpu_frequency());
|
||||
kprintf("Total memory: %lu KiB\n", atomic_int32_read(&total_pages) * PAGE_SIZE / 1024);
|
||||
kprintf("Total memory available: %lu KiB\n", atomic_int32_read(&total_available_pages) * PAGE_SIZE / 1024);
|
||||
kprintf("Current allocated memory: %lu KiB\n", atomic_int32_read(&total_allocated_pages) * PAGE_SIZE / 1024);
|
||||
kprintf("Curren available memory: %lu KiB\n", atomic_int32_read(&total_available_pages) * PAGE_SIZE / 1024);
|
||||
|
||||
create_kernel_task(NULL, foo, "foo", NORMAL_PRIO);
|
||||
create_user_task(NULL, "/bin/hello", argv);
|
||||
|
||||
create_kernel_task(&id1, foo, "foo1", NORMAL_PRIO);
|
||||
create_kernel_task(&id2, wrapper, "userfoo", NORMAL_PRIO);
|
||||
#if 0
|
||||
kputs("Filesystem:\n");
|
||||
list_fs(fs_root, 1);
|
||||
#endif
|
||||
|
||||
while(1) {
|
||||
HALT;
|
||||
|
|
|
@ -30,14 +30,46 @@
|
|||
#include <eduos/tasks.h>
|
||||
#include <eduos/errno.h>
|
||||
#include <eduos/syscall.h>
|
||||
#include <eduos/spinlock.h>
|
||||
|
||||
static int sys_write(const char* buff)
|
||||
static int sys_write(int fd, const char* buf, size_t len)
|
||||
{
|
||||
kputs(buff);
|
||||
//TODO: Currently, we ignore the file descriptor
|
||||
|
||||
if (BUILTIN_EXPECT(!buf, 0))
|
||||
return -1;
|
||||
|
||||
kputs(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sys_sbrk(int incr)
|
||||
{
|
||||
task_t* task = current_task;
|
||||
vma_t* heap = task->heap;
|
||||
int ret;
|
||||
|
||||
spinlock_lock(&task->vma_lock);
|
||||
|
||||
if (BUILTIN_EXPECT(!heap,0 )) {
|
||||
kprintf("sys_sbrk: missing heap!\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
ret = heap->end;
|
||||
heap->end += incr;
|
||||
if (heap->end < heap->start)
|
||||
heap->end = heap->start;
|
||||
|
||||
// allocation and mapping of new pages for the heap
|
||||
// is catched by the pagefault handler
|
||||
|
||||
spinlock_unlock(&task->vma_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int syscall_handler(uint32_t sys_nr, ...)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
@ -51,11 +83,26 @@ int syscall_handler(uint32_t sys_nr, ...)
|
|||
sys_exit(va_arg(vl, uint32_t));
|
||||
ret = 0;
|
||||
break;
|
||||
case __NR_write:
|
||||
ret = sys_write(va_arg(vl, const char*));
|
||||
case __NR_write: {
|
||||
int fd = va_arg(vl, int);
|
||||
const char* buf = va_arg(vl, const char*);
|
||||
size_t len = va_arg(vl, size_t);
|
||||
ret = sys_write(fd, buf, len);
|
||||
break;
|
||||
}
|
||||
//TODO: Currently, we ignore file descriptors
|
||||
case __NR_open:
|
||||
case __NR_close:
|
||||
ret = 0;
|
||||
break;
|
||||
case __NR_sbrk: {
|
||||
int incr = va_arg(vl, int);
|
||||
|
||||
ret = sys_sbrk(incr);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
kputs("invalid system call\n");
|
||||
kprintf("invalid system call: %u\n", sys_nr);
|
||||
ret = -ENOSYS;
|
||||
break;
|
||||
};
|
||||
|
|
318
kernel/tasks.c
318
kernel/tasks.c
|
@ -35,7 +35,9 @@
|
|||
#include <eduos/errno.h>
|
||||
#include <eduos/syscall.h>
|
||||
#include <eduos/memory.h>
|
||||
|
||||
#include <eduos/fs.h>
|
||||
#include <eduos/vma.h>
|
||||
#include <asm/elf.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
/** @brief Array of task structures (aka PCB)
|
||||
|
@ -43,8 +45,8 @@
|
|||
* A task's id will be its position in this array.
|
||||
*/
|
||||
static task_t task_table[MAX_TASKS] = { \
|
||||
[0] = {0, TASK_IDLE, NULL, NULL, 0, 0, SPINLOCK_IRQSAVE_INIT, ATOMIC_INIT(0), NULL, NULL}, \
|
||||
[1 ... MAX_TASKS-1] = {0, TASK_INVALID, NULL, NULL, 0, 0, SPINLOCK_IRQSAVE_INIT, ATOMIC_INIT(0), NULL, NULL}};
|
||||
[0] = {0, TASK_IDLE, NULL, NULL, 0, 0, SPINLOCK_IRQSAVE_INIT, SPINLOCK_INIT, NULL, NULL, ATOMIC_INIT(0), NULL, NULL}, \
|
||||
[1 ... MAX_TASKS-1] = {0, TASK_INVALID, NULL, NULL, 0, 0, SPINLOCK_IRQSAVE_INIT, SPINLOCK_INIT, NULL, NULL,ATOMIC_INIT(0), NULL, NULL}};
|
||||
|
||||
static spinlock_irqsave_t table_lock = SPINLOCK_IRQSAVE_INIT;
|
||||
|
||||
|
@ -112,6 +114,9 @@ void finish_task_switch(void)
|
|||
}
|
||||
|
||||
spinlock_irqsave_unlock(&readyqueues.lock);
|
||||
|
||||
if (current_task->heap)
|
||||
kfree(current_task->heap);
|
||||
}
|
||||
|
||||
/** @brief A procedure to be called by
|
||||
|
@ -146,15 +151,6 @@ void NORETURN leave_kernel_task(void) {
|
|||
do_exit(result);
|
||||
}
|
||||
|
||||
/** @brief This function shall be called by leaving user-level tasks */
|
||||
void NORETURN leave_user_task(void)
|
||||
{
|
||||
SYSCALL1(__NR_exit, 0);
|
||||
|
||||
// this point should never reached
|
||||
while(1) {}
|
||||
}
|
||||
|
||||
/** @brief To be called by the systemcall to exit tasks */
|
||||
void NORETURN sys_exit(int arg) {
|
||||
do_exit(arg);
|
||||
|
@ -200,6 +196,9 @@ static int create_task(tid_t* id, entry_point_t ep, void* arg, uint8_t prio)
|
|||
task_table[i].last_stack_pointer = NULL;
|
||||
task_table[i].stack = create_stack(i);
|
||||
task_table[i].prio = prio;
|
||||
spinlock_init(&task_table[i].vma_lock);
|
||||
task_table[i].vma_list = NULL;
|
||||
task_table[i].heap = NULL;
|
||||
|
||||
spinlock_irqsave_init(&task_table[i].page_lock);
|
||||
atomic_int32_set(&task_table[i].user_usage, 0);
|
||||
|
@ -250,6 +249,301 @@ int create_kernel_task(tid_t* id, entry_point_t ep, void* args, uint8_t prio)
|
|||
return create_task(id, ep, args, prio);
|
||||
}
|
||||
|
||||
#define MAX_ARGS (PAGE_SIZE - 2*sizeof(int) - sizeof(vfs_node_t*))
|
||||
|
||||
/** @brief Structure which keeps all
|
||||
* relevant data for a new user task to start */
|
||||
typedef struct {
|
||||
/// Points to the node with the executable in the file system
|
||||
vfs_node_t* node;
|
||||
/// Argument count
|
||||
int argc;
|
||||
/// Environment var count
|
||||
int envc;
|
||||
/// Buffer for env and argv values
|
||||
char buffer[MAX_ARGS];
|
||||
} load_args_t;
|
||||
|
||||
/** @brief Internally used function to load tasks with a load_args_t structure
|
||||
* keeping all the information needed to launch.
|
||||
*
|
||||
* This is where the serious loading action is done.
|
||||
*/
|
||||
static int load_task(load_args_t* largs)
|
||||
{
|
||||
uint32_t i, offset, idx;
|
||||
uint32_t addr, npages, flags;
|
||||
size_t stack = 0, heap = 0;
|
||||
elf_header_t header;
|
||||
elf_program_header_t prog_header;
|
||||
//elf_section_header_t sec_header;
|
||||
fildes_t file;
|
||||
|
||||
//TODO: init the hole fildes_t struct!
|
||||
task_t* curr_task = current_task;
|
||||
int err;
|
||||
|
||||
if (!largs)
|
||||
return -EINVAL;
|
||||
|
||||
memset(&file, 0x00, sizeof(file));
|
||||
file.node = largs->node;
|
||||
if (!file.node)
|
||||
return -EINVAL;
|
||||
|
||||
err = read_fs(&file, (uint8_t*)&header, sizeof(elf_header_t));
|
||||
if (err < 0) {
|
||||
kprintf("read_fs failed: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (BUILTIN_EXPECT(header.ident.magic != ELF_MAGIC, 0))
|
||||
goto invalid;
|
||||
|
||||
if (BUILTIN_EXPECT(header.type != ELF_ET_EXEC, 0))
|
||||
goto invalid;
|
||||
|
||||
if (BUILTIN_EXPECT(header.machine != ELF_EM_386, 0))
|
||||
goto invalid;
|
||||
|
||||
if (BUILTIN_EXPECT(header.ident._class != ELF_CLASS_32, 0))
|
||||
goto invalid;
|
||||
|
||||
if (BUILTIN_EXPECT(header.ident.data != ELF_DATA_2LSB, 0))
|
||||
goto invalid;
|
||||
|
||||
if (header.entry <= KERNEL_SPACE)
|
||||
goto invalid;
|
||||
|
||||
// interpret program header table
|
||||
for (i=0; i<header.ph_entry_count; i++) {
|
||||
file.offset = header.ph_offset+i*header.ph_entry_size;
|
||||
if (read_fs(&file, (uint8_t*)&prog_header, sizeof(elf_program_header_t)) == 0) {
|
||||
kprintf("Could not read programm header!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(prog_header.type)
|
||||
{
|
||||
case ELF_PT_LOAD: // load program segment
|
||||
if (!prog_header.virt_addr)
|
||||
continue;
|
||||
|
||||
npages = (prog_header.mem_size >> PAGE_BITS);
|
||||
if (prog_header.mem_size & (PAGE_SIZE-1))
|
||||
npages++;
|
||||
|
||||
addr = get_pages(npages);
|
||||
|
||||
flags = PG_USER; //TODO: support of XD flags is missing
|
||||
|
||||
// map page frames in the address space of the current task
|
||||
if (page_map(prog_header.virt_addr, addr, npages, flags|PG_RW))
|
||||
kprintf("Could not map 0x%x at 0x%x\n", addr, prog_header.virt_addr);
|
||||
|
||||
// clear pages
|
||||
memset((void*) prog_header.virt_addr, 0x00, npages*PAGE_SIZE);
|
||||
|
||||
// update heap location
|
||||
if (heap < prog_header.virt_addr + prog_header.mem_size)
|
||||
heap = prog_header.virt_addr + prog_header.mem_size;
|
||||
|
||||
// load program
|
||||
file.offset = prog_header.offset;
|
||||
read_fs(&file, (uint8_t*)prog_header.virt_addr, prog_header.file_size);
|
||||
|
||||
flags = VMA_CACHEABLE;
|
||||
if (prog_header.flags & PF_R)
|
||||
flags |= VMA_READ;
|
||||
if (prog_header.flags & PF_W)
|
||||
flags |= VMA_WRITE;
|
||||
if (prog_header.flags & PF_X)
|
||||
flags |= VMA_EXECUTE;
|
||||
vma_add(prog_header.virt_addr, prog_header.virt_addr+npages*PAGE_SIZE-1, flags);
|
||||
|
||||
if (!(prog_header.flags & PF_W))
|
||||
page_set_flags(prog_header.virt_addr, npages, flags);
|
||||
break;
|
||||
|
||||
case ELF_PT_GNU_STACK: // Indicates stack executability
|
||||
// create user-level stack
|
||||
npages = DEFAULT_STACK_SIZE >> PAGE_BITS;
|
||||
if (DEFAULT_STACK_SIZE & (PAGE_SIZE-1))
|
||||
npages++;
|
||||
|
||||
addr = get_pages(npages);
|
||||
stack = header.entry*2; // virtual address of the stack
|
||||
|
||||
if (page_map(stack, addr, npages, PG_USER|PG_RW)) {
|
||||
kprintf("Could not map stack at 0x%x\n", stack);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset((void*) stack, 0x00, npages*PAGE_SIZE);
|
||||
|
||||
// create vma regions for the user-level stack
|
||||
flags = VMA_CACHEABLE;
|
||||
if (prog_header.flags & PF_R)
|
||||
flags |= VMA_READ;
|
||||
if (prog_header.flags & PF_W)
|
||||
flags |= VMA_WRITE;
|
||||
if (prog_header.flags & PF_X)
|
||||
flags |= VMA_EXECUTE;
|
||||
vma_add(stack, stack+npages*PAGE_SIZE-1, flags);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// setup heap
|
||||
if (!curr_task->heap)
|
||||
curr_task->heap = (vma_t*) kmalloc(sizeof(vma_t));
|
||||
|
||||
if (BUILTIN_EXPECT(!curr_task->heap || !heap, 0)) {
|
||||
kprintf("load_task: heap is missing!\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
curr_task->heap->flags = VMA_HEAP|VMA_USER;
|
||||
curr_task->heap->start = heap;
|
||||
curr_task->heap->end = heap;
|
||||
|
||||
if (BUILTIN_EXPECT(!stack, 0)) {
|
||||
kprintf("Stack is missing!\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
// push strings on the stack
|
||||
offset = DEFAULT_STACK_SIZE-8;
|
||||
memset((void*) (stack+offset), 0, 4);
|
||||
offset -= MAX_ARGS;
|
||||
memcpy((void*) (stack+offset), largs->buffer, MAX_ARGS);
|
||||
idx = offset;
|
||||
|
||||
// push argv on the stack
|
||||
offset -= largs->argc * sizeof(char*);
|
||||
for(i=0; i<largs->argc; i++) {
|
||||
((char**) (stack+offset))[i] = (char*) (stack+idx);
|
||||
|
||||
while(((char*) stack)[idx] != '\0')
|
||||
idx++;
|
||||
idx++;
|
||||
}
|
||||
|
||||
// push env on the stack
|
||||
offset -= (largs->envc+1) * sizeof(char*);
|
||||
for(i=0; i<largs->envc; i++) {
|
||||
((char**) (stack+offset))[i] = (char*) (stack+idx);
|
||||
|
||||
while(((char*) stack)[idx] != '\0')
|
||||
idx++;
|
||||
idx++;
|
||||
}
|
||||
((char**) (stack+offset))[largs->envc] = NULL;
|
||||
|
||||
// push pointer to env
|
||||
offset -= sizeof(char**);
|
||||
if (!(largs->envc))
|
||||
*((char***) (stack+offset)) = NULL;
|
||||
else
|
||||
*((char***) (stack+offset)) = (char**) (stack + offset + sizeof(char**));
|
||||
|
||||
// push pointer to argv
|
||||
offset -= sizeof(char**);
|
||||
*((char***) (stack+offset)) = (char**) (stack + offset + 2*sizeof(char**) + (largs->envc+1) * sizeof(char*));
|
||||
|
||||
// push argc on the stack
|
||||
offset -= sizeof(int);
|
||||
*((int*) (stack+offset)) = largs->argc;
|
||||
|
||||
kfree(largs);
|
||||
|
||||
// clear fpu state => currently not supported
|
||||
//curr_task->flags &= ~(TASK_FPU_USED|TASK_FPU_INIT);
|
||||
|
||||
jump_to_user_code(header.entry, stack+offset);
|
||||
|
||||
return 0;
|
||||
|
||||
invalid:
|
||||
kprintf("Invalid executable!\n");
|
||||
kprintf("magic number 0x%x\n", (uint32_t) header.ident.magic);
|
||||
kprintf("header type 0x%x\n", (uint32_t) header.type);
|
||||
kprintf("machine type 0x%x\n", (uint32_t) header.machine);
|
||||
kprintf("elf ident class 0x%x\n", (uint32_t) header.ident._class);
|
||||
kprintf("elf identdata !0x%x\n", header.ident.data);
|
||||
kprintf("program entry point 0x%x\n", (size_t) header.entry);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/** @brief This call is used to adapt create_task calls
|
||||
* which want to have a start function and argument list */
|
||||
static int user_entry(void* arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
finish_task_switch();
|
||||
|
||||
if (BUILTIN_EXPECT(!arg, 0))
|
||||
return -EINVAL;
|
||||
|
||||
ret = load_task((load_args_t*) arg);
|
||||
|
||||
kfree(arg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** @brief Luxus-edition of create_user_task functions. Just call with an exe name
|
||||
*
|
||||
* @param id Pointer to the tid_t structure which shall be filles
|
||||
* @param fname Executable's path and filename
|
||||
* @param argv Arguments list
|
||||
* @return
|
||||
* - 0 on success
|
||||
* - -ENOMEM (-12) or -EINVAL (-22) on failure
|
||||
*/
|
||||
int create_user_task(tid_t* id, const char* fname, char** argv)
|
||||
{
|
||||
vfs_node_t* node;
|
||||
int argc = 0;
|
||||
size_t i, buffer_size = 0;
|
||||
load_args_t* load_args = NULL;
|
||||
char *dest, *src;
|
||||
|
||||
node = findnode_fs((char*) fname);
|
||||
if (!node || !(node->type == FS_FILE))
|
||||
return -EINVAL;
|
||||
|
||||
// determine buffer size of argv
|
||||
if (argv) {
|
||||
while (argv[argc]) {
|
||||
buffer_size += (strlen(argv[argc]) + 1);
|
||||
argc++;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc <= 0)
|
||||
return -EINVAL;
|
||||
if (buffer_size >= MAX_ARGS)
|
||||
return -EINVAL;
|
||||
|
||||
load_args = kmalloc(sizeof(load_args_t));
|
||||
if (BUILTIN_EXPECT(!load_args, 0))
|
||||
return -ENOMEM;
|
||||
load_args->node = node;
|
||||
load_args->argc = argc;
|
||||
load_args->envc = 0;
|
||||
dest = load_args->buffer;
|
||||
for (i=0; i<argc; i++) {
|
||||
src = argv[i];
|
||||
while ((*dest++ = *src++) != 0);
|
||||
}
|
||||
|
||||
|
||||
/* create new task */
|
||||
return create_task(id, user_entry, load_args, NORMAL_PRIO);
|
||||
}
|
||||
|
||||
/** @brief Wakeup a blocked task
|
||||
* @param id The task's tid_t structure
|
||||
* @return
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
C_source := string.c stdio.c printf.c sprintf.c moddi3.c umoddi3.c divdi3.c udivdi3.c qdivrem.c
|
||||
C_source := string.c stdio.c printf.c sprintf.c strtol.c strtoul.c strstr.c moddi3.c umoddi3.c divdi3.c udivdi3.c qdivrem.c
|
||||
MODULE := libkern
|
||||
|
||||
include $(TOPDIR)/Makefile.inc
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* The code has been taken from FreeBSD (sys/libkern/divdi3.c) and is therefore
|
||||
* The code has been taken from FreeBSD (sys/libkern/divdi3.c) and is consequently
|
||||
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
|
||||
* have been added in quad.h.
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* The code has been taken from FreeBSD (sys/libkern/moddi3.c) and is therefore
|
||||
* The code has been taken from FreeBSD (sys/libkern/moddi3.c) and is consequently
|
||||
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
|
||||
* have been added quad.h.
|
||||
*/
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
* published at http://www.pagetable.com/?p=298.
|
||||
* The authors built a full-featured standalone version of printf(). The
|
||||
* base code has been taken from FreeBSD (sys/kern/subr_prf.c) and is
|
||||
* therefore BSD-licensed. Unnecessary functions have been removed and
|
||||
* consequently BSD-licensed. Unnecessary functions have been removed and
|
||||
* all typedefs required have been added.
|
||||
*/
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* The code has been taken from FreeBSD (sys/libkern/qdivrem.c) and is therefore
|
||||
* The code has been taken from FreeBSD (sys/libkern/qdivrem.c) and is consequently
|
||||
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
|
||||
* have been added.
|
||||
*/
|
||||
|
|
121
libkern/stdio.c
121
libkern/stdio.c
|
@ -26,14 +26,15 @@
|
|||
*/
|
||||
|
||||
#include <eduos/stdio.h>
|
||||
#include <eduos/stdlib.h>
|
||||
#include <eduos/string.h>
|
||||
#include <eduos/stdarg.h>
|
||||
#include <eduos/spinlock.h>
|
||||
#include <eduos/fs.h>
|
||||
#include <asm/atomic.h>
|
||||
#include <asm/processor.h>
|
||||
#ifdef CONFIG_VGA
|
||||
#include <asm/multiboot.h>
|
||||
#include <asm/vga.h>
|
||||
#endif
|
||||
#ifdef CONFIG_UART
|
||||
#include <asm/uart.h>
|
||||
#endif
|
||||
|
@ -42,19 +43,118 @@
|
|||
#define VGA_EARLY_PRINT 0x01
|
||||
#define UART_EARLY_PRINT 0x02
|
||||
|
||||
#ifdef CONFIG_VGA
|
||||
static uint32_t early_print = VGA_EARLY_PRINT;
|
||||
#ifdef CONFIG_UART
|
||||
static uint32_t early_print = UART_EARLY_PRINT;
|
||||
#else
|
||||
static uint32_t early_print = NO_EARLY_PRINT;
|
||||
static uint32_t early_print = VGA_EARLY_PRINT;
|
||||
#endif
|
||||
static spinlock_irqsave_t olock = SPINLOCK_IRQSAVE_INIT;
|
||||
static atomic_int32_t kmsg_counter = ATOMIC_INIT(0);
|
||||
static unsigned char kmessages[KMSG_SIZE] __attribute__ ((section(".kmsg"))) = {[0 ... KMSG_SIZE-1] = 0x00};
|
||||
|
||||
static ssize_t kmsg_read(fildes_t* file, uint8_t* buffer, size_t size)
|
||||
{
|
||||
size_t start, i = 0;
|
||||
|
||||
if (BUILTIN_EXPECT(!buffer, 0))
|
||||
return -EINVAL;
|
||||
if (BUILTIN_EXPECT(!size, 0))
|
||||
return 0;
|
||||
|
||||
if (kmessages[(atomic_int32_read(&kmsg_counter) + 1) % KMSG_SIZE] == 0)
|
||||
start = 0;
|
||||
else
|
||||
start = (atomic_int32_read(&kmsg_counter) + 1) % KMSG_SIZE;
|
||||
|
||||
if (((start + file->offset) % KMSG_SIZE) == atomic_int32_read(&kmsg_counter))
|
||||
return 0;
|
||||
if (file->offset >= KMSG_SIZE)
|
||||
return 0;
|
||||
|
||||
for(i=0; i<size; i++, file->offset++) {
|
||||
buffer[i] = kmessages[(start + file->offset) % KMSG_SIZE];
|
||||
if (((start + file->offset) % KMSG_SIZE) == atomic_int32_read(&kmsg_counter))
|
||||
return i;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static int kmsg_open(fildes_t* file, const char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kmsg_close(fildes_t* file)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Init Functions */
|
||||
int kmsg_init(vfs_node_t * node, const char *name)
|
||||
{
|
||||
uint32_t i, j;
|
||||
vfs_node_t* new_node;
|
||||
dir_block_t* blockdir;
|
||||
dirent_t* dirent;
|
||||
block_list_t* blist;
|
||||
|
||||
if (BUILTIN_EXPECT(!node || !name, 0))
|
||||
return -EINVAL;
|
||||
|
||||
if (BUILTIN_EXPECT(node->type != FS_DIRECTORY, 0))
|
||||
return -EINVAL;
|
||||
|
||||
if (finddir_fs(node, name))
|
||||
return -EINVAL;
|
||||
|
||||
new_node = kmalloc(sizeof(vfs_node_t));
|
||||
if (BUILTIN_EXPECT(!new_node, 0))
|
||||
return -ENOMEM;
|
||||
|
||||
memset(new_node, 0x00, sizeof(vfs_node_t));
|
||||
new_node->type = FS_CHARDEVICE;
|
||||
new_node->open = &kmsg_open;
|
||||
new_node->close = &kmsg_close;
|
||||
new_node->read = &kmsg_read;
|
||||
new_node->write = NULL;
|
||||
spinlock_init(&new_node->lock);
|
||||
|
||||
blist = &node->block_list;
|
||||
do {
|
||||
for (i = 0; i < MAX_DATABLOCKS; i++) {
|
||||
if (blist->data[i]) {
|
||||
blockdir = (dir_block_t *) blist->data[i];
|
||||
for (j = 0; j < MAX_DIRENTRIES; j++) {
|
||||
dirent = &blockdir->entries[j];
|
||||
if (!dirent->vfs_node) {
|
||||
dirent->vfs_node = new_node;
|
||||
strncpy(dirent->name, name, MAX_FNAME);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!blist->next) {
|
||||
blist->next = (block_list_t *) kmalloc(sizeof(block_list_t));
|
||||
if (blist->next)
|
||||
memset(blist->next, 0x00, sizeof(block_list_t));
|
||||
}
|
||||
} while (blist);
|
||||
|
||||
kfree(new_node);
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
int koutput_init(void)
|
||||
{
|
||||
#ifdef CONFIG_VGA
|
||||
vga_init();
|
||||
#ifdef CONFIG_UART
|
||||
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_CMDLINE))
|
||||
if (!uart_early_init((char*) mb_info->cmdline))
|
||||
early_print |= UART_EARLY_PRINT;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -70,10 +170,8 @@ int kputchar(int c)
|
|||
pos = atomic_int32_inc(&kmsg_counter);
|
||||
kmessages[pos % KMSG_SIZE] = (unsigned char) c;
|
||||
|
||||
#ifdef CONFIG_VGA
|
||||
if (early_print & VGA_EARLY_PRINT)
|
||||
vga_putchar(c);
|
||||
#endif
|
||||
#ifdef CONFIG_UART
|
||||
if (early_print & UART_EARLY_PRINT)
|
||||
uart_putchar(c);
|
||||
|
@ -95,10 +193,8 @@ int kputs(const char *str)
|
|||
for(i=0; i<len; i++) {
|
||||
pos = atomic_int32_inc(&kmsg_counter);
|
||||
kmessages[pos % KMSG_SIZE] = str[i];
|
||||
#ifdef CONFIG_VGA
|
||||
if (early_print & VGA_EARLY_PRINT)
|
||||
vga_putchar(str[i]);
|
||||
#endif
|
||||
#ifdef CONFIG_UART
|
||||
if (early_print & UART_EARLY_PRINT)
|
||||
uart_putchar(str[i]);
|
||||
|
@ -114,13 +210,8 @@ int kputs(const char *str)
|
|||
int koutput_add_uart(void)
|
||||
{
|
||||
#ifdef CONFIG_UART
|
||||
uint32_t i;
|
||||
|
||||
early_print |= UART_EARLY_PRINT;
|
||||
|
||||
for(i=0; i<atomic_int32_read(&kmsg_counter); i++)
|
||||
uart_putchar(kmessages[i % KMSG_SIZE]);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return -EINVAL;
|
||||
|
|
73
libkern/strstr.c
Normal file
73
libkern/strstr.c
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* $NetBSD: strstr.c,v 1.1 2005/12/20 19:28:52 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Chris Torek.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code has been taken from NetBSD (sys/libkern/strstr.c) and is consequently
|
||||
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
|
||||
* have been added.
|
||||
*/
|
||||
|
||||
/* eduOS prelude */
|
||||
#include <eduos/stdlib.h>
|
||||
#include <eduos/string.h>
|
||||
#include <eduos/ctype.h>
|
||||
#include <asm/limits.h>
|
||||
|
||||
/*
|
||||
* Find the first occurrence of find in s.
|
||||
*/
|
||||
char *
|
||||
strstr(s, find)
|
||||
const char *s, *find;
|
||||
{
|
||||
char c, sc;
|
||||
size_t len;
|
||||
|
||||
if (BUILTIN_EXPECT(!s, 0))
|
||||
return NULL;
|
||||
if (BUILTIN_EXPECT(!find, 0))
|
||||
return NULL;
|
||||
|
||||
if ((c = *find++) != 0) {
|
||||
len = strlen(find);
|
||||
do {
|
||||
do {
|
||||
if ((sc = *s++) == 0)
|
||||
return (NULL);
|
||||
} while (sc != c);
|
||||
} while (strncmp(s, find, len) != 0);
|
||||
s--;
|
||||
}
|
||||
return ((char *) s);
|
||||
}
|
133
libkern/strtol.c
Normal file
133
libkern/strtol.c
Normal file
|
@ -0,0 +1,133 @@
|
|||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Chris Torek.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* From: @(#)strtol.c 8.1 (Berkeley) 6/4/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code has been taken from FreeBSD (sys/libkern/strtol.c) and is consequently
|
||||
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
|
||||
* have been added.
|
||||
*/
|
||||
|
||||
/* eduOS prelude */
|
||||
#include <eduos/stddef.h>
|
||||
#include <eduos/ctype.h>
|
||||
#include <asm/limits.h>
|
||||
|
||||
/*
|
||||
* Convert a string to a long integer.
|
||||
*
|
||||
* Ignores `locale' stuff. Assumes that the upper and lower case
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
long
|
||||
strtol(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
{
|
||||
const char *s = nptr;
|
||||
unsigned long acc;
|
||||
unsigned char c;
|
||||
unsigned long cutoff;
|
||||
int neg = 0, any, cutlim;
|
||||
|
||||
/*
|
||||
* Skip white space and pick up leading +/- sign if any.
|
||||
* If base is 0, allow 0x for hex and 0 for octal, else
|
||||
* assume decimal; if base is already 16, allow 0x.
|
||||
*/
|
||||
do {
|
||||
c = *s++;
|
||||
} while (isspace(c));
|
||||
if (c == '-') {
|
||||
neg = 1;
|
||||
c = *s++;
|
||||
} else if (c == '+')
|
||||
c = *s++;
|
||||
if ((base == 0 || base == 16) &&
|
||||
c == '0' && (*s == 'x' || *s == 'X')) {
|
||||
c = s[1];
|
||||
s += 2;
|
||||
base = 16;
|
||||
}
|
||||
if (base == 0)
|
||||
base = c == '0' ? 8 : 10;
|
||||
|
||||
/*
|
||||
* Compute the cutoff value between legal numbers and illegal
|
||||
* numbers. That is the largest legal value, divided by the
|
||||
* base. An input number that is greater than this value, if
|
||||
* followed by a legal input character, is too big. One that
|
||||
* is equal to this value may be valid or not; the limit
|
||||
* between valid and invalid numbers is then based on the last
|
||||
* digit. For instance, if the range for longs is
|
||||
* [-2147483648..2147483647] and the input base is 10,
|
||||
* cutoff will be set to 214748364 and cutlim to either
|
||||
* 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
|
||||
* a value > 214748364, or equal but the next digit is > 7 (or 8),
|
||||
* the number is too big, and we will return a range error.
|
||||
*
|
||||
* Set any if any `digits' consumed; make it negative to indicate
|
||||
* overflow.
|
||||
*/
|
||||
cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
|
||||
cutlim = cutoff % (unsigned long)base;
|
||||
cutoff /= (unsigned long)base;
|
||||
for (acc = 0, any = 0;; c = *s++) {
|
||||
if (!isascii(c))
|
||||
break;
|
||||
if (isdigit(c))
|
||||
c -= '0';
|
||||
else if (isalpha(c))
|
||||
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||
else
|
||||
break;
|
||||
if (c >= base)
|
||||
break;
|
||||
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||
any = -1;
|
||||
else {
|
||||
any = 1;
|
||||
acc *= base;
|
||||
acc += c;
|
||||
}
|
||||
}
|
||||
if (any < 0) {
|
||||
acc = neg ? LONG_MIN : LONG_MAX;
|
||||
} else if (neg)
|
||||
acc = -acc;
|
||||
if (endptr != 0)
|
||||
*((const char **)endptr) = any ? s - 1 : nptr;
|
||||
return (acc);
|
||||
}
|
||||
|
112
libkern/strtoul.c
Normal file
112
libkern/strtoul.c
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Chris Torek.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* From: @(#)strtoul.c 8.1 (Berkeley) 6/4/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code has been taken from FreeBSD (sys/libkern/strtoul.c) and is consequently
|
||||
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
|
||||
* have been added.
|
||||
*/
|
||||
|
||||
/* eduOS prelude */
|
||||
#include <eduos/stddef.h>
|
||||
#include <eduos/ctype.h>
|
||||
#include <asm/limits.h>
|
||||
|
||||
/*
|
||||
* Convert a string to an unsigned long integer.
|
||||
*
|
||||
* Ignores `locale' stuff. Assumes that the upper and lower case
|
||||
* alphabets and digits are each contiguous.
|
||||
*/
|
||||
unsigned long
|
||||
strtoul(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
{
|
||||
const char *s = nptr;
|
||||
unsigned long acc;
|
||||
unsigned char c;
|
||||
unsigned long cutoff;
|
||||
int neg = 0, any, cutlim;
|
||||
|
||||
/*
|
||||
* See strtol for comments as to the logic used.
|
||||
*/
|
||||
do {
|
||||
c = *s++;
|
||||
} while (isspace(c));
|
||||
if (c == '-') {
|
||||
neg = 1;
|
||||
c = *s++;
|
||||
} else if (c == '+')
|
||||
c = *s++;
|
||||
if ((base == 0 || base == 16) &&
|
||||
c == '0' && (*s == 'x' || *s == 'X')) {
|
||||
c = s[1];
|
||||
s += 2;
|
||||
base = 16;
|
||||
}
|
||||
if (base == 0)
|
||||
base = c == '0' ? 8 : 10;
|
||||
cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
|
||||
cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
|
||||
for (acc = 0, any = 0;; c = *s++) {
|
||||
if (!isascii(c))
|
||||
break;
|
||||
if (isdigit(c))
|
||||
c -= '0';
|
||||
else if (isalpha(c))
|
||||
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||
else
|
||||
break;
|
||||
if (c >= base)
|
||||
break;
|
||||
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||
any = -1;
|
||||
else {
|
||||
any = 1;
|
||||
acc *= base;
|
||||
acc += c;
|
||||
}
|
||||
}
|
||||
if (any < 0) {
|
||||
acc = ULONG_MAX;
|
||||
} else if (neg)
|
||||
acc = -acc;
|
||||
if (endptr != 0)
|
||||
*((const char **)endptr) = any ? s - 1 : nptr;
|
||||
return (acc);
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* The code has been taken from FreeBSD (sys/libkern/udivdi3.c) and is therefore
|
||||
* The code has been taken from FreeBSD (sys/libkern/udivdi3.c) and is consequently
|
||||
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
|
||||
* have been added.
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* The code has been taken from FreeBSD (sys/libkern/umoddi3.c) and is therefore
|
||||
* The code has been taken from FreeBSD (sys/libkern/umoddi3.c) and is consequently
|
||||
* BSD-licensed. Unnecessary functions have been removed and all typedefs required
|
||||
* have been added.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
C_source := memory.c
|
||||
C_source := memory.c malloc.c vma.c
|
||||
MODULE := mm
|
||||
|
||||
include $(TOPDIR)/Makefile.inc
|
||||
|
|
223
mm/malloc.c
Normal file
223
mm/malloc.c
Normal file
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
* Copyright (c) 2014, Steffen Vogel, RWTH Aachen University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Steffen Vogel <steffen.vogel@rwth-aachen.de>
|
||||
*/
|
||||
|
||||
#include <eduos/stdio.h>
|
||||
#include <eduos/malloc.h>
|
||||
#include <eduos/spinlock.h>
|
||||
#include <eduos/memory.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
/// A linked list for each binary size exponent
|
||||
static buddy_t* buddy_lists[BUDDY_LISTS] = { [0 ... BUDDY_LISTS-1] = NULL };
|
||||
/// Lock for the buddy lists
|
||||
static spinlock_t buddy_lock = SPINLOCK_INIT;
|
||||
|
||||
/** @brief Check if larger free buddies are available */
|
||||
static inline int buddy_large_avail(uint8_t exp)
|
||||
{
|
||||
while (exp<BUDDY_MAX && !buddy_lists[exp-BUDDY_MIN])
|
||||
exp++;
|
||||
|
||||
return exp != BUDDY_MAX;
|
||||
}
|
||||
|
||||
/** @brief Calculate the required buddy size */
|
||||
static inline int buddy_exp(size_t sz)
|
||||
{
|
||||
int exp;
|
||||
for (exp=0; sz>(1<<exp); exp++);
|
||||
|
||||
if (exp > BUDDY_MAX)
|
||||
exp = 0;
|
||||
if (exp < BUDDY_MIN)
|
||||
exp = BUDDY_MIN;
|
||||
|
||||
return exp;
|
||||
}
|
||||
|
||||
/** @brief Get a free buddy by potentially splitting a larger one */
|
||||
static buddy_t* buddy_get(int exp)
|
||||
{
|
||||
spinlock_lock(&buddy_lock);
|
||||
buddy_t** list = &buddy_lists[exp-BUDDY_MIN];
|
||||
buddy_t* buddy = *list;
|
||||
buddy_t* split;
|
||||
|
||||
if (buddy)
|
||||
// there is already a free buddy =>
|
||||
// we remove it from the list
|
||||
*list = buddy->next;
|
||||
else if (exp >= BUDDY_ALLOC && !buddy_large_avail(exp))
|
||||
// theres no free buddy larger than exp =>
|
||||
// we can allocate new memory
|
||||
buddy = (buddy_t*) palloc(1<<exp, 0);
|
||||
else {
|
||||
// we recursivly request a larger buddy...
|
||||
buddy = buddy_get(exp+1);
|
||||
if (BUILTIN_EXPECT(!buddy, 0))
|
||||
goto out;
|
||||
|
||||
// ... and split it, by putting the second half back to the list
|
||||
split = (buddy_t*) ((size_t) buddy + (1<<exp));
|
||||
split->next = *list;
|
||||
*list = split;
|
||||
}
|
||||
|
||||
out:
|
||||
spinlock_unlock(&buddy_lock);
|
||||
|
||||
return buddy;
|
||||
}
|
||||
|
||||
/** @brief Put a buddy back to its free list
|
||||
*
|
||||
* TODO: merge adjacent buddies (memory compaction)
|
||||
*/
|
||||
static void buddy_put(buddy_t* buddy)
|
||||
{
|
||||
spinlock_lock(&buddy_lock);
|
||||
buddy_t** list = &buddy_lists[buddy->prefix.exponent-BUDDY_MIN];
|
||||
buddy->next = *list;
|
||||
*list = buddy;
|
||||
spinlock_unlock(&buddy_lock);
|
||||
}
|
||||
|
||||
void buddy_dump(void)
|
||||
{
|
||||
size_t free = 0;
|
||||
int i;
|
||||
for (i=0; i<BUDDY_LISTS; i++) {
|
||||
buddy_t* buddy;
|
||||
int exp = i+BUDDY_MIN;
|
||||
|
||||
if (buddy_lists[i])
|
||||
kprintf("buddy_list[%u] (exp=%u, size=%lu bytes):\n", i, exp, 1<<exp);
|
||||
|
||||
for (buddy=buddy_lists[i]; buddy; buddy=buddy->next) {
|
||||
kprintf(" %p -> %p \n", buddy, buddy->next);
|
||||
free += 1<<exp;
|
||||
}
|
||||
}
|
||||
kprintf("free buddies: %lu bytes\n", free);
|
||||
}
|
||||
|
||||
void* palloc(size_t sz, uint32_t flags)
|
||||
{
|
||||
size_t phyaddr, viraddr;
|
||||
uint32_t npages = PAGE_FLOOR(sz) >> PAGE_BITS;
|
||||
int err;
|
||||
|
||||
//kprintf("palloc(%lu) (%lu pages)\n", sz, npages);
|
||||
|
||||
// get free virtual address space
|
||||
viraddr = vma_alloc(npages*PAGE_SIZE, VMA_HEAP);
|
||||
if (BUILTIN_EXPECT(!viraddr, 0))
|
||||
return NULL;
|
||||
|
||||
// get continous physical pages
|
||||
phyaddr = get_pages(npages);
|
||||
if (BUILTIN_EXPECT(!phyaddr, 0)) {
|
||||
vma_free(viraddr, viraddr+npages*PAGE_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// map physical pages to VMA
|
||||
err = page_map(viraddr, phyaddr, npages, PG_RW|PG_GLOBAL);
|
||||
if (BUILTIN_EXPECT(err, 0)) {
|
||||
vma_free(viraddr, viraddr+npages*PAGE_SIZE);
|
||||
put_pages(phyaddr, npages);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (void*) viraddr;
|
||||
}
|
||||
|
||||
void pfree(void* addr, size_t sz)
|
||||
{
|
||||
if (BUILTIN_EXPECT(!addr || !sz, 0))
|
||||
return;
|
||||
|
||||
size_t i;
|
||||
size_t phyaddr;
|
||||
size_t viraddr = (size_t) addr & PAGE_MASK;
|
||||
uint32_t npages = PAGE_FLOOR(sz) >> PAGE_BITS;
|
||||
|
||||
// memory is probably not continuously mapped! (userspace heap)
|
||||
for (i=0; i<npages; i++) {
|
||||
phyaddr = virt_to_phys(viraddr+i*PAGE_SIZE);
|
||||
put_page(phyaddr);
|
||||
}
|
||||
|
||||
page_unmap(viraddr, npages);
|
||||
vma_free(viraddr, viraddr+npages*PAGE_SIZE);
|
||||
}
|
||||
|
||||
void* kmalloc(size_t sz)
|
||||
{
|
||||
if (BUILTIN_EXPECT(!sz, 0))
|
||||
return NULL;
|
||||
|
||||
// add space for the prefix
|
||||
sz += sizeof(buddy_t);
|
||||
|
||||
int exp = buddy_exp(sz);
|
||||
if (BUILTIN_EXPECT(!exp, 0))
|
||||
return NULL;
|
||||
|
||||
buddy_t* buddy = buddy_get(exp);
|
||||
if (BUILTIN_EXPECT(!buddy, 0))
|
||||
return NULL;
|
||||
|
||||
// setup buddy prefix
|
||||
buddy->prefix.magic = BUDDY_MAGIC;
|
||||
buddy->prefix.exponent = exp;
|
||||
|
||||
//kprintf("kmalloc(%lu) = %p\n", sz, buddy+1);
|
||||
|
||||
// pointer arithmetic: we hide the prefix
|
||||
return buddy+1;
|
||||
}
|
||||
|
||||
void kfree(void *addr)
|
||||
{
|
||||
if (BUILTIN_EXPECT(!addr, 0))
|
||||
return;
|
||||
|
||||
//kprintf("kfree(%lu)\n", addr);
|
||||
|
||||
buddy_t* buddy = (buddy_t*) addr - 1; // get prefix
|
||||
|
||||
// check magic
|
||||
if (BUILTIN_EXPECT(buddy->prefix.magic != BUDDY_MAGIC, 0))
|
||||
return;
|
||||
|
||||
buddy_put(buddy);
|
||||
}
|
88
mm/memory.c
88
mm/memory.c
|
@ -157,6 +157,43 @@ int put_pages(size_t phyaddr, size_t npages)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int copy_page(size_t pdest, size_t psrc)
|
||||
{
|
||||
int err;
|
||||
|
||||
static size_t viraddr;
|
||||
if (!viraddr) { // statically allocate virtual memory area
|
||||
viraddr = vma_alloc(2 * PAGE_SIZE, VMA_HEAP);
|
||||
if (BUILTIN_EXPECT(!viraddr, 0))
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
// map pages
|
||||
size_t vsrc = viraddr;
|
||||
err = page_map(vsrc, psrc, 1, PG_GLOBAL|PG_RW);
|
||||
if (BUILTIN_EXPECT(err, 0)) {
|
||||
page_unmap(viraddr, 1);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
size_t vdest = viraddr + PAGE_SIZE;
|
||||
err = page_map(vdest, pdest, 1, PG_GLOBAL|PG_RW);
|
||||
if (BUILTIN_EXPECT(err, 0)) {
|
||||
page_unmap(viraddr + PAGE_SIZE, 1);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
kprintf("copy_page: copy page frame from: %#lx (%#lx) to %#lx (%#lx)\n", vsrc, psrc, vdest, pdest); // TODO remove
|
||||
|
||||
// copy the whole page
|
||||
memcpy((void*) vdest, (void*) vsrc, PAGE_SIZE);
|
||||
|
||||
// householding
|
||||
page_unmap(viraddr, 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int memory_init(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -166,25 +203,39 @@ int memory_init(void)
|
|||
// mark all memory as used
|
||||
memset(bitmap, 0xff, BITMAP_SIZE);
|
||||
|
||||
// enable paging and map Multiboot modules etc.
|
||||
ret = page_init();
|
||||
if (BUILTIN_EXPECT(ret, 0)) {
|
||||
kputs("Failed to initialize paging!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
// parse multiboot information for available memory
|
||||
if (mb_info) {
|
||||
if (mb_info->flags & MULTIBOOT_INFO_MEM_MAP) {
|
||||
size_t end_addr;
|
||||
multiboot_memory_map_t* mmap = (multiboot_memory_map_t*) ((size_t) mb_info->mmap_addr);
|
||||
multiboot_memory_map_t* mmap_end = (void*) ((size_t) mb_info->mmap_addr + mb_info->mmap_length);
|
||||
|
||||
// mark available memory as free
|
||||
while (mmap < mmap_end) {
|
||||
if (mmap->type == MULTIBOOT_MEMORY_AVAILABLE) {
|
||||
for (addr=mmap->addr; addr < mmap->addr + mmap->len; addr += PAGE_SIZE) {
|
||||
page_clear_mark(addr >> PAGE_BITS);
|
||||
atomic_int32_inc(&total_pages);
|
||||
atomic_int32_inc(&total_available_pages);
|
||||
/* set the available memory as "unused" */
|
||||
addr = mmap->addr;
|
||||
end_addr = addr + mmap->len;
|
||||
|
||||
while ((addr < end_addr) && (addr < (BITMAP_SIZE*8*PAGE_SIZE))) {
|
||||
if (page_marked(addr >> PAGE_BITS)) {
|
||||
page_clear_mark(addr >> PAGE_BITS);
|
||||
atomic_int32_inc(&total_pages);
|
||||
atomic_int32_inc(&total_available_pages);
|
||||
}
|
||||
addr += PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
mmap++;
|
||||
mmap = (multiboot_memory_map_t*) ((size_t) mmap + sizeof(uint32_t) + mmap->size);
|
||||
}
|
||||
}
|
||||
else if (mb_info->flags & MULTIBOOT_INFO_MEM) {
|
||||
} else if (mb_info->flags & MULTIBOOT_INFO_MEM) {
|
||||
size_t page;
|
||||
size_t pages_lower = mb_info->mem_lower >> 2; /* KiB to page number */
|
||||
size_t pages_upper = mb_info->mem_upper >> 2;
|
||||
|
@ -192,6 +243,9 @@ int memory_init(void)
|
|||
for (page=0; page<pages_lower; page++)
|
||||
page_clear_mark(page);
|
||||
|
||||
if (pages_upper > BITMAP_SIZE*8-256)
|
||||
pages_upper = BITMAP_SIZE*8-256;
|
||||
|
||||
for (page=0; page<pages_upper; page++)
|
||||
page_clear_mark(page + 256); /* 1 MiB == 256 pages offset */
|
||||
|
||||
|
@ -236,12 +290,26 @@ int memory_init(void)
|
|||
atomic_int32_dec(&total_available_pages);
|
||||
}
|
||||
|
||||
// enable paging and map SMP, VGA, Multiboot modules etc.
|
||||
ret = page_init();
|
||||
ret = vma_init();
|
||||
if (BUILTIN_EXPECT(ret, 0)) {
|
||||
kputs("Failed to initialize paging!\n");
|
||||
kprintf("Failed to initialize VMA regions: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Modules like the init ram disk are already loaded.
|
||||
* Therefore, we set these pages as used.
|
||||
*/
|
||||
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_MODS)) {
|
||||
multiboot_module_t* mmodule = (multiboot_module_t*) ((size_t) mb_info->mods_addr);
|
||||
for(i=0; i<mb_info->mods_count; i++) {
|
||||
for(addr=mmodule[i].mod_start; addr<mmodule[i].mod_end; addr+=PAGE_SIZE) {
|
||||
page_set_mark(addr >> PAGE_BITS);
|
||||
atomic_int32_inc(&total_allocated_pages);
|
||||
atomic_int32_dec(&total_available_pages);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
398
mm/vma.c
Normal file
398
mm/vma.c
Normal file
|
@ -0,0 +1,398 @@
|
|||
/*
|
||||
* Copyright (c) 2014, Steffen Vogel, RWTH Aachen University
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <eduos/vma.h>
|
||||
#include <eduos/stdlib.h>
|
||||
#include <eduos/stdio.h>
|
||||
#include <eduos/tasks_types.h>
|
||||
#include <eduos/spinlock.h>
|
||||
#include <eduos/errno.h>
|
||||
#include <asm/multiboot.h>
|
||||
|
||||
/*
|
||||
* Note that linker symbols are not variables, they have no memory allocated for
|
||||
* maintaining a value, rather their address is their value.
|
||||
*/
|
||||
extern const void kernel_start;
|
||||
extern const void kernel_end;
|
||||
|
||||
/*
|
||||
* Kernel space VMA list and lock
|
||||
*
|
||||
* For bootstrapping we initialize the VMA list with one empty VMA
|
||||
* (start == end) and expand this VMA by calls to vma_alloc()
|
||||
*/
|
||||
static vma_t vma_boot = { VMA_KERN_MIN, VMA_KERN_MIN, VMA_HEAP };
|
||||
static vma_t* vma_list = &vma_boot;
|
||||
static spinlock_t vma_lock = SPINLOCK_INIT;
|
||||
|
||||
// TODO: we might move the architecture specific VMA regions to a
|
||||
// seperate function arch_vma_init()
|
||||
int vma_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
// add Kernel
|
||||
ret = vma_add(PAGE_CEIL((size_t) &kernel_start),
|
||||
PAGE_FLOOR((size_t) &kernel_end),
|
||||
VMA_READ|VMA_WRITE|VMA_EXECUTE|VMA_CACHEABLE);
|
||||
if (BUILTIN_EXPECT(ret, 0))
|
||||
goto out;
|
||||
|
||||
// add VGA video memory
|
||||
ret = vma_add(VIDEO_MEM_ADDR, VIDEO_MEM_ADDR + PAGE_SIZE, VMA_READ|VMA_WRITE);
|
||||
if (BUILTIN_EXPECT(ret, 0))
|
||||
goto out;
|
||||
|
||||
// add Multiboot structures as modules
|
||||
if (mb_info) {
|
||||
ret = vma_add(PAGE_CEIL((size_t) mb_info),
|
||||
PAGE_FLOOR((size_t) mb_info + sizeof(multiboot_info_t)),
|
||||
VMA_READ|VMA_CACHEABLE);
|
||||
if (BUILTIN_EXPECT(ret, 0))
|
||||
goto out;
|
||||
|
||||
if (mb_info->flags & MULTIBOOT_INFO_MODS) {
|
||||
multiboot_module_t* mmodule = (multiboot_module_t*) ((size_t) mb_info->mods_addr);
|
||||
|
||||
ret = vma_add(PAGE_CEIL((size_t) mb_info->mods_addr),
|
||||
PAGE_FLOOR((size_t) mb_info->mods_addr + mb_info->mods_count*sizeof(multiboot_module_t)),
|
||||
VMA_READ|VMA_CACHEABLE);
|
||||
|
||||
//TODO: Why do we get error code -22 (-EINVAL);
|
||||
ret = 0; // TODO: Remove workaround
|
||||
|
||||
int i;
|
||||
for(i=0; i<mb_info->mods_count; i++) {
|
||||
ret = vma_add(PAGE_CEIL(mmodule[i].mod_start),
|
||||
PAGE_FLOOR(mmodule[i].mod_end),
|
||||
VMA_READ|VMA_WRITE|VMA_CACHEABLE);
|
||||
if (BUILTIN_EXPECT(ret, 0))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t vma_alloc(size_t size, uint32_t flags)
|
||||
{
|
||||
task_t* task = current_task;
|
||||
spinlock_t* lock;
|
||||
vma_t** list;
|
||||
|
||||
//kprintf("vma_alloc: size = %#lx, flags = %#x\n", size, flags);
|
||||
|
||||
size_t base, limit; // boundaries for search
|
||||
size_t start, end; // boundaries of free gaps
|
||||
|
||||
if (flags & VMA_USER) {
|
||||
base = VMA_USER_MIN;
|
||||
limit = VMA_USER_MAX;
|
||||
list = &task->vma_list;
|
||||
lock = &task->vma_lock;
|
||||
}
|
||||
else {
|
||||
base = VMA_KERN_MIN;
|
||||
limit = VMA_KERN_MAX;
|
||||
list = &vma_list;
|
||||
lock = &vma_lock;
|
||||
}
|
||||
|
||||
spinlock_lock(lock);
|
||||
|
||||
// first fit search for free memory area
|
||||
vma_t* pred = NULL; // vma before current gap
|
||||
vma_t* succ = *list; // vma after current gap
|
||||
do {
|
||||
start = (pred) ? pred->end : base;
|
||||
end = (succ) ? succ->start : limit;
|
||||
|
||||
if (start + size < end && start >= base && start + size < limit)
|
||||
goto found; // we found a gap which is large enough and in the bounds
|
||||
|
||||
pred = succ;
|
||||
succ = (pred) ? pred->next : NULL;
|
||||
} while (pred || succ);
|
||||
|
||||
fail:
|
||||
spinlock_unlock(lock); // we were unlucky to find a free gap
|
||||
|
||||
return 0;
|
||||
|
||||
found:
|
||||
if (pred && pred->flags == flags)
|
||||
pred->end = start + size; // resize VMA
|
||||
else {
|
||||
// insert new VMA
|
||||
vma_t* new = kmalloc(sizeof(vma_t));
|
||||
if (BUILTIN_EXPECT(!new, 0))
|
||||
goto fail;
|
||||
|
||||
new->start = start;
|
||||
new->end = start + size;
|
||||
new->flags = flags;
|
||||
new->next = succ;
|
||||
new->prev = pred;
|
||||
|
||||
if (succ)
|
||||
succ->prev = new;
|
||||
if (pred)
|
||||
pred->next = new;
|
||||
else
|
||||
*list = new;
|
||||
}
|
||||
|
||||
spinlock_unlock(lock);
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
int vma_free(size_t start, size_t end)
|
||||
{
|
||||
task_t* task = current_task;
|
||||
spinlock_t* lock;
|
||||
vma_t* vma;
|
||||
vma_t** list = NULL;
|
||||
|
||||
//kprintf("vma_free: start = %#lx, end = %#lx\n", start, end);
|
||||
|
||||
if (BUILTIN_EXPECT(start >= end, 0))
|
||||
return -EINVAL;
|
||||
|
||||
if (end < VMA_KERN_MAX) {
|
||||
lock = &vma_lock;
|
||||
list = &vma_list;
|
||||
}
|
||||
else if (start >= VMA_KERN_MAX) {
|
||||
lock = &task->vma_lock;
|
||||
list = &task->vma_list;
|
||||
}
|
||||
|
||||
if (BUILTIN_EXPECT(!list || !*list, 0))
|
||||
return -EINVAL;
|
||||
|
||||
spinlock_lock(lock);
|
||||
|
||||
// search vma
|
||||
vma = *list;
|
||||
while (vma) {
|
||||
if (start >= vma->start && end <= vma->end) break;
|
||||
vma = vma->next;
|
||||
}
|
||||
|
||||
if (BUILTIN_EXPECT(!vma, 0)) {
|
||||
spinlock_unlock(lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// free/resize vma
|
||||
if (start == vma->start && end == vma->end) {
|
||||
if (vma == *list)
|
||||
*list = vma->next; // update list head
|
||||
if (vma->prev)
|
||||
vma->prev->next = vma->next;
|
||||
if (vma->next)
|
||||
vma->next->prev = vma->prev;
|
||||
kfree(vma);
|
||||
}
|
||||
else if (start == vma->start)
|
||||
vma->start = end;
|
||||
else if (end == vma->end)
|
||||
vma->end = start;
|
||||
else {
|
||||
vma_t* new = kmalloc(sizeof(vma_t));
|
||||
if (BUILTIN_EXPECT(!new, 0)) {
|
||||
spinlock_unlock(lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
new->end = vma->end;
|
||||
vma->end = start;
|
||||
new->start = end;
|
||||
|
||||
new->next = vma->next;
|
||||
vma->next = new;
|
||||
new->prev = vma;
|
||||
}
|
||||
|
||||
spinlock_unlock(lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vma_add(size_t start, size_t end, uint32_t flags)
|
||||
{
|
||||
task_t* task = current_task;
|
||||
spinlock_t* lock;
|
||||
vma_t** list;
|
||||
|
||||
if (BUILTIN_EXPECT(start >= end, 0))
|
||||
return -EINVAL;
|
||||
|
||||
if (flags & VMA_USER) {
|
||||
list = &task->vma_list;
|
||||
lock = &task->vma_lock;
|
||||
|
||||
// check if address is in userspace
|
||||
if (BUILTIN_EXPECT(start < VMA_KERN_MAX, 0))
|
||||
return -EINVAL;
|
||||
}
|
||||
else {
|
||||
list = &vma_list;
|
||||
lock = &vma_lock;
|
||||
|
||||
// check if address is in kernelspace
|
||||
if (BUILTIN_EXPECT(end >= VMA_KERN_MAX, 0))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
//kprintf("vma_add: start = %#lx, end = %#lx, flags = %#x\n", start, end, flags);
|
||||
|
||||
spinlock_lock(lock);
|
||||
|
||||
// search gap
|
||||
vma_t* pred = NULL;
|
||||
vma_t* succ = *list;
|
||||
|
||||
while (pred || succ) {
|
||||
if ((!pred || pred->end <= start) &&
|
||||
(!succ || succ->start >= end))
|
||||
break;
|
||||
|
||||
pred = succ;
|
||||
succ = (succ) ? succ->next : NULL;
|
||||
}
|
||||
|
||||
if (BUILTIN_EXPECT(*list && !pred && !succ, 0)) {
|
||||
spinlock_unlock(lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// insert new VMA
|
||||
vma_t* new = kmalloc(sizeof(vma_t));
|
||||
if (BUILTIN_EXPECT(!new, 0)) {
|
||||
spinlock_unlock(lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
new->start = start;
|
||||
new->end = end;
|
||||
new->flags = flags;
|
||||
new->next = succ;
|
||||
new->prev = pred;
|
||||
|
||||
if (succ)
|
||||
succ->prev = new;
|
||||
if (pred)
|
||||
pred->next = new;
|
||||
else
|
||||
*list = new;
|
||||
|
||||
spinlock_unlock(lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int copy_vma_list(task_t* src, task_t* dest)
|
||||
{
|
||||
spinlock_init(&dest->vma_lock);
|
||||
|
||||
spinlock_lock(&src->vma_lock);
|
||||
spinlock_lock(&dest->vma_lock);
|
||||
|
||||
vma_t* last = NULL;
|
||||
vma_t* old;
|
||||
for (old=src->vma_list; old; old=old->next) {
|
||||
vma_t *new = kmalloc(sizeof(vma_t));
|
||||
if (BUILTIN_EXPECT(!new, 0)) {
|
||||
spinlock_unlock(&dest->vma_lock);
|
||||
spinlock_unlock(&src->vma_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
new->start = old->start;
|
||||
new->end = old->end;
|
||||
new->flags = old->flags;
|
||||
new->prev = last;
|
||||
|
||||
if (last)
|
||||
last->next = new;
|
||||
else
|
||||
dest->vma_list = new;
|
||||
|
||||
last = new;
|
||||
}
|
||||
|
||||
spinlock_unlock(&dest->vma_lock);
|
||||
spinlock_unlock(&src->vma_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int drop_vma_list(task_t *task)
|
||||
{
|
||||
vma_t* vma;
|
||||
|
||||
spinlock_lock(&task->vma_lock);
|
||||
|
||||
while ((vma = task->vma_list)) {
|
||||
task->vma_list = vma->next;
|
||||
kfree(vma);
|
||||
}
|
||||
|
||||
spinlock_unlock(&task->vma_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vma_dump(void)
|
||||
{
|
||||
void print_vma(vma_t *vma) {
|
||||
while (vma) {
|
||||
kprintf("0x%lx - 0x%lx: size=%x, flags=%c%c%c\n", vma->start, vma->end, vma->end - vma->start,
|
||||
(vma->flags & VMA_READ) ? 'r' : '-',
|
||||
(vma->flags & VMA_WRITE) ? 'w' : '-',
|
||||
(vma->flags & VMA_EXECUTE) ? 'x' : '-');
|
||||
vma = vma->next;
|
||||
}
|
||||
}
|
||||
|
||||
task_t* task = current_task;
|
||||
|
||||
kputs("Kernelspace VMAs:\n");
|
||||
spinlock_lock(&vma_lock);
|
||||
print_vma(vma_list);
|
||||
spinlock_unlock(&vma_lock);
|
||||
|
||||
kputs("Userspace VMAs:\n");
|
||||
spinlock_lock(&task->vma_lock);
|
||||
print_vma(task->vma_list);
|
||||
spinlock_unlock(&task->vma_lock);
|
||||
}
|
46
newlib/Makefile
Normal file
46
newlib/Makefile
Normal file
|
@ -0,0 +1,46 @@
|
|||
TOPDIR = $(shell pwd)
|
||||
ARCH = x86
|
||||
BIT = 32
|
||||
|
||||
ifeq ($(ARCH),x86)
|
||||
ifeq ($(BIT),32)
|
||||
TARGET=i386-eduos-elf32
|
||||
endif
|
||||
ifeq ($(BIT),64)
|
||||
TARGET=x86_64-eduos-elf64
|
||||
endif
|
||||
endif
|
||||
|
||||
NEWLIB = $(TOPDIR)/$(ARCH)/$(TARGET)
|
||||
RM = rm -rf
|
||||
CD = cd
|
||||
MKDIR = mkdir
|
||||
TMP = $(TOPDIR)/tmp
|
||||
OPT = --disable-shared --disable-multilib --enable-newlib-hw-fp --disable-newlib-multithread --disable-newlib-reent-small
|
||||
|
||||
# Prettify output
|
||||
V = 0
|
||||
ifeq ($V,0)
|
||||
Q = @
|
||||
P = > /dev/null
|
||||
endif
|
||||
|
||||
default: $(ARCH)
|
||||
$Q$(MAKE) ARCH=$(ARCH) BIT=$(BIT) TARGET=$(TARGET) CFLAGS+="-ffreestanding -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C examples depend
|
||||
$Q$(MAKE) ARCH=$(ARCH) BIT=$(BIT) TARGET=$(TARGET) CFLAGS+="-ffreestanding -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C examples
|
||||
|
||||
$(ARCH):
|
||||
@echo Build newlib
|
||||
$Q$(RM) $(TMP)
|
||||
$Q$(MKDIR) $(TMP)
|
||||
$Q$(CD) $(TMP); $(TOPDIR)/src/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) $(OPT) && $(MAKE) && $(MAKE) install
|
||||
|
||||
clean:
|
||||
@echo Cleaning newlib
|
||||
$Q$(MAKE) -C examples clean
|
||||
$Q$(RM) $(TMP)
|
||||
|
||||
veryclean:
|
||||
@echo Propper cleaning newlib
|
||||
$Q$(MAKE) -C examples veryclean
|
||||
$Q$(RM) $(TOPDIR)/$(ARCH)
|
53
newlib/examples/Makefile
Normal file
53
newlib/examples/Makefile
Normal file
|
@ -0,0 +1,53 @@
|
|||
ARCH = x86
|
||||
BIT = 32
|
||||
|
||||
NEWLIB = ../x86/i386-eduos-elf32
|
||||
MAKE = make
|
||||
STRIP_DEBUG = --strip-debug
|
||||
KEEP_DEBUG = --only-keep-debug
|
||||
|
||||
override LDFLAGS += -T link.ld
|
||||
|
||||
ifeq ($(BIT),64)
|
||||
# Default section offsets in x86-64 ELF files are aligned to the page-size.
|
||||
# For x86-64 the pagesize is huge (2 MB) with the consquence of large sparse
|
||||
# ELF files (which lead to a huge initrd). To solve this, we manually set the page-size to 4 KB.
|
||||
override LDFLAGS += -Wl,-n,-z,max-page-size=0x1000
|
||||
endif
|
||||
|
||||
# Prettify output
|
||||
V = 0
|
||||
ifeq ($V,0)
|
||||
Q = @
|
||||
P = > /dev/null
|
||||
endif
|
||||
|
||||
# other implicit rules
|
||||
%.o : %.c
|
||||
@echo [CC] $@
|
||||
$Q$(CC_FOR_TARGET) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
default: all
|
||||
|
||||
all: hello
|
||||
|
||||
hello: hello.o
|
||||
@echo [LD] $@
|
||||
$Q$(CC_FOR_TARGET) $(LDFLAGS) -o $@ $<
|
||||
$Q$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym
|
||||
$Q$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@
|
||||
$Qchmod a-x $@.sym
|
||||
|
||||
clean:
|
||||
@echo Cleaning examples
|
||||
$Q$(RM) hello *.sym *.o *~
|
||||
|
||||
veryclean:
|
||||
@echo Propper cleaning examples
|
||||
$Q$(RM) hello *.sym *.o *~
|
||||
|
||||
depend:
|
||||
$Q$(CC_FOR_TARGET) -MM $(CFLAGS) *.c > Makefile.dep
|
||||
|
||||
-include Makefile.dep
|
||||
# DO NOT DELETE
|
|
@ -25,44 +25,23 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H__
|
||||
#define __CONFIG_H__
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
#define EDUOS_VERSION "0.1"
|
||||
#define MAX_TASKS 16
|
||||
#define TIMER_FREQ 100 /* in HZ */
|
||||
#define CLOCK_TICK_RATE 1193182 /* 8254 chip's internal oscillator frequency */
|
||||
#define VIDEO_MEM_ADDR 0xB8000 /* the video memory address */
|
||||
#define CACHE_LINE 64
|
||||
#define KERNEL_STACK_SIZE (8<<10) /* 8 KiB */
|
||||
#define BITMAP_SIZE (128<<5) /* for 128 MiB of RAM */
|
||||
#define KMSG_SIZE (8*1024)
|
||||
#define INT_SYSCALL 0x80
|
||||
#define MAILBOX_SIZE 32
|
||||
printf("Hello World!!!\n");
|
||||
//for(i=0; environ[i]; i++)
|
||||
// printf("environ[%d] = %s\n", i, environ[i]);
|
||||
//for(i=0; i<argc; i++)
|
||||
// printf("argv[%d] = %s\n", i, argv[i]);
|
||||
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
#define CONFIG_VGA
|
||||
#define CONFIG_PCI
|
||||
#define CONFIG_UART
|
||||
|
||||
#define BUILTIN_EXPECT(exp, b) __builtin_expect((exp), (b))
|
||||
//#define BUILTIN_EXPECT(exp, b) (exp)
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#define STDCALL __attribute__((stdcall))
|
||||
|
||||
#define HAVE_ARCH_MEMSET
|
||||
#define HAVE_ARCH_MEMCPY
|
||||
#define HAVE_ARCH_STRLEN
|
||||
#define HAVE_ARCH_STRCPY
|
||||
#define HAVE_ARCH_STRNCPY
|
||||
|
||||
#ifdef __cplusplus
|
||||
return errno;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
340
newlib/src/COPYING
Normal file
340
newlib/src/COPYING
Normal file
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
482
newlib/src/COPYING.LIB
Normal file
482
newlib/src/COPYING.LIB
Normal file
|
@ -0,0 +1,482 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
324
newlib/src/COPYING.LIBGLOSS
Normal file
324
newlib/src/COPYING.LIBGLOSS
Normal file
|
@ -0,0 +1,324 @@
|
|||
The libgloss subdirectory is a collection of software from several sources.
|
||||
|
||||
Each file may have its own copyright/license that is embedded in the source
|
||||
file. Unless otherwise noted in the body of the source file(s), the following copyright
|
||||
notices will apply to the contents of the libgloss subdirectory:
|
||||
|
||||
(1) Red Hat Incorporated
|
||||
|
||||
Copyright (c) 1994-2009 Red Hat, Inc. All rights reserved.
|
||||
|
||||
This copyrighted material is made available to anyone wishing to use, modify,
|
||||
copy, or redistribute it subject to the terms and conditions of the BSD
|
||||
License. This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license
|
||||
is available at http://www.opensource.org/licenses. Any Red Hat trademarks that
|
||||
are incorporated in the source code or documentation are not subject to the BSD
|
||||
License and may only be used or replicated with the express permission of
|
||||
Red Hat, Inc.
|
||||
|
||||
(2) University of California, Berkeley
|
||||
|
||||
Copyright (c) 1981-2000 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the University nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
|
||||
(3) DJ Delorie
|
||||
|
||||
Copyright (C) 1993 DJ Delorie
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms is permitted
|
||||
provided that the above copyright notice and following paragraph are
|
||||
duplicated in all such forms.
|
||||
|
||||
This file is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
(4) (formerly GPL for fr30)
|
||||
|
||||
The GPL is no longer applicable to the fr30 platform. The piece of
|
||||
code (syscalls.c) referencing the GPL has been officially relicensed.
|
||||
|
||||
(5) Advanced Micro Devices
|
||||
|
||||
Copyright 1989, 1990 Advanced Micro Devices, Inc.
|
||||
|
||||
This software is the property of Advanced Micro Devices, Inc (AMD) which
|
||||
specifically grants the user the right to modify, use and distribute this
|
||||
software provided this notice is not removed or altered. All other rights
|
||||
are reserved by AMD.
|
||||
|
||||
AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
|
||||
SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
|
||||
DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
|
||||
USE OF THIS SOFTWARE.
|
||||
|
||||
So that all may benefit from your experience, please report any problems
|
||||
or suggestions about this software to the 29K Technical Support Center at
|
||||
800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
|
||||
0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
|
||||
|
||||
Advanced Micro Devices, Inc.
|
||||
29K Support Products
|
||||
Mail Stop 573
|
||||
5900 E. Ben White Blvd.
|
||||
Austin, TX 78741
|
||||
800-292-9263
|
||||
|
||||
(6) Array Technology Corporation and MIPS (mips/lsi33k-stub.h)
|
||||
|
||||
COPYRIGHT (C) 1991, 1992 ARRAY TECHNOLOGY CORPORATION
|
||||
All Rights Reserved
|
||||
|
||||
This software is confidential information which is proprietary to and
|
||||
a trade secret of ARRAY Technology Corporation. Use, duplication, or
|
||||
disclosure is subject to the terms of a separate license agreement.
|
||||
|
||||
Copyright 1985 by MIPS Computer Systems, Inc.
|
||||
|
||||
(7) University of Utah and the Computer Systems Laboratory (CSL)
|
||||
[applies only to hppa*-*-pro* targets]
|
||||
Copyright (c) 1990,1994 The University of Utah and
|
||||
the Computer Systems Laboratory (CSL). All rights reserved.
|
||||
|
||||
Permission to use, copy, modify and distribute this software is hereby
|
||||
granted provided that (1) source code retains these copyright, permission,
|
||||
and disclaimer notices, and (2) redistributions including binaries
|
||||
reproduce the notices in supporting documentation, and (3) all advertising
|
||||
materials mentioning features or use of this software display the following
|
||||
acknowledgement: ``This product includes software developed by the
|
||||
Computer Systems Laboratory at the University of Utah.''
|
||||
|
||||
THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
|
||||
IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
|
||||
ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
|
||||
CSL requests users of this software to return to csl-dist@cs.utah.edu any
|
||||
improvements that they make and grant CSL redistribution rights.
|
||||
|
||||
(8) Sun Microsystems
|
||||
|
||||
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
|
||||
Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software is freely granted, provided that this notice is preserved.
|
||||
|
||||
(9) Hewlett Packard
|
||||
|
||||
(c) Copyright 1986 HEWLETT-PACKARD COMPANY
|
||||
|
||||
To anyone who acknowledges that this file is provided "AS IS"
|
||||
without any express or implied warranty:
|
||||
|
||||
permission to use, copy, modify, and distribute this file
|
||||
for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice and this notice appears in all
|
||||
copies, and that the name of Hewlett-Packard Company not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific, written prior permission.
|
||||
Hewlett-Packard Company makes no representations about the
|
||||
suitability of this software for any purpose.
|
||||
|
||||
(10) Hans-Peter Nilsson
|
||||
|
||||
Copyright (C) 2001 Hans-Peter Nilsson
|
||||
|
||||
Permission to use, copy, modify, and distribute this software is
|
||||
freely granted, provided that the above copyright notice, this notice
|
||||
and the following disclaimer are preserved with no changes.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
(11) IBM Corp. spu processor (only spu-* targets)
|
||||
|
||||
(C) Copyright IBM Corp. 2005, 2006
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of IBM nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
(12) Jon Beniston (only lm32-* targets)
|
||||
|
||||
Contributed by Jon Beniston <jon@beniston.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(13) - Xilinx, Inc. (microblaze-* and powerpc-* targets)
|
||||
|
||||
Copyright (c) 2004, 2009 Xilinx, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Xilinx nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
(14) - National Semiconductor Corporation
|
||||
|
||||
Copyright (c) 2004 National Semiconductor Corporation
|
||||
|
||||
The authors hereby grant permission to use, copy, modify, distribute,
|
||||
and license this software and its documentation for any purpose, provided
|
||||
that existing copyright notices are retained in all copies and that this
|
||||
notice is included verbatim in any distributions. No written agreement,
|
||||
license, or royalty fee is required for any of the authorized uses.
|
||||
Modifications to this software may be copyrighted by their authors
|
||||
and need not follow the licensing terms described here, provided that
|
||||
the new terms are clearly indicated on the first page of each file where
|
||||
they apply.
|
||||
|
||||
|
||||
(15) - CodeSourcery, Inc. (tic6x-* targets)
|
||||
|
||||
Copyright (c) 2010 CodeSourcery, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of CodeSourcery nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL CODESOURCERY BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
(16) - GPL with exception (sparc-*leon*, crx-*, cr16-* targets only)
|
||||
|
||||
Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
Written By David Vinayak Henkel-Wallace, June 1992
|
||||
|
||||
This file is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
|
||||
In addition to the permissions in the GNU General Public License, the
|
||||
Free Software Foundation gives you unlimited permission to link the
|
||||
compiled version of this file with other programs, and to distribute
|
||||
those programs without any restriction coming from the use of this
|
||||
file. (The General Public License restrictions do apply in other
|
||||
respects; for example, they cover modification of the file, and
|
||||
distribution when not linked into another program.)
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with GCC to produce an executable, this does not cause
|
||||
the resulting executable to be covered by the GNU General Public License.
|
||||
This exception does not however invalidate any other reasons why
|
||||
the executable file might be covered by the GNU General Public License.
|
||||
|
||||
|
879
newlib/src/COPYING.NEWLIB
Normal file
879
newlib/src/COPYING.NEWLIB
Normal file
|
@ -0,0 +1,879 @@
|
|||
The newlib subdirectory is a collection of software from several sources.
|
||||
|
||||
Each file may have its own copyright/license that is embedded in the source
|
||||
file. Unless otherwise noted in the body of the source file(s), the following copyright
|
||||
notices will apply to the contents of the newlib subdirectory:
|
||||
|
||||
(1) Red Hat Incorporated
|
||||
|
||||
Copyright (c) 1994-2009 Red Hat, Inc. All rights reserved.
|
||||
|
||||
This copyrighted material is made available to anyone wishing to use,
|
||||
modify, copy, or redistribute it subject to the terms and conditions
|
||||
of the BSD License. This program is distributed in the hope that
|
||||
it will be useful, but WITHOUT ANY WARRANTY expressed or implied,
|
||||
including the implied warranties of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. A copy of this license is available at
|
||||
http://www.opensource.org/licenses. Any Red Hat trademarks that are
|
||||
incorporated in the source code or documentation are not subject to
|
||||
the BSD License and may only be used or replicated with the express
|
||||
permission of Red Hat, Inc.
|
||||
|
||||
(2) University of California, Berkeley
|
||||
|
||||
Copyright (c) 1981-2000 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
|
||||
(3) David M. Gay (AT&T 1991, Lucent 1998)
|
||||
|
||||
The author of this software is David M. Gay.
|
||||
|
||||
Copyright (c) 1991 by AT&T.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose without fee is hereby granted, provided that this entire notice
|
||||
is included in all copies of any software which is or includes a copy
|
||||
or modification of this software and in all copies of the supporting
|
||||
documentation for such software.
|
||||
|
||||
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
|
||||
WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY
|
||||
REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
||||
OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
The author of this software is David M. Gay.
|
||||
|
||||
Copyright (C) 1998-2001 by Lucent Technologies
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of Lucent or any of its entities
|
||||
not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
|
||||
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
|
||||
|
||||
(4) Advanced Micro Devices
|
||||
|
||||
Copyright 1989, 1990 Advanced Micro Devices, Inc.
|
||||
|
||||
This software is the property of Advanced Micro Devices, Inc (AMD) which
|
||||
specifically grants the user the right to modify, use and distribute this
|
||||
software provided this notice is not removed or altered. All other rights
|
||||
are reserved by AMD.
|
||||
|
||||
AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
|
||||
SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
|
||||
DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
|
||||
USE OF THIS SOFTWARE.
|
||||
|
||||
So that all may benefit from your experience, please report any problems
|
||||
or suggestions about this software to the 29K Technical Support Center at
|
||||
800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
|
||||
0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
|
||||
|
||||
Advanced Micro Devices, Inc.
|
||||
29K Support Products
|
||||
Mail Stop 573
|
||||
5900 E. Ben White Blvd.
|
||||
Austin, TX 78741
|
||||
800-292-9263
|
||||
|
||||
(5) C.W. Sandmann
|
||||
|
||||
Copyright (C) 1993 C.W. Sandmann
|
||||
|
||||
This file may be freely distributed as long as the author's name remains.
|
||||
|
||||
(6) Eric Backus
|
||||
|
||||
(C) Copyright 1992 Eric Backus
|
||||
|
||||
This software may be used freely so long as this copyright notice is
|
||||
left intact. There is no warrantee on this software.
|
||||
|
||||
(7) Sun Microsystems
|
||||
|
||||
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
|
||||
Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software is freely granted, provided that this notice is preserved.
|
||||
|
||||
(8) Hewlett Packard
|
||||
|
||||
(c) Copyright 1986 HEWLETT-PACKARD COMPANY
|
||||
|
||||
To anyone who acknowledges that this file is provided "AS IS"
|
||||
without any express or implied warranty:
|
||||
permission to use, copy, modify, and distribute this file
|
||||
for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice and this notice appears in all
|
||||
copies, and that the name of Hewlett-Packard Company not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific, written prior permission.
|
||||
Hewlett-Packard Company makes no representations about the
|
||||
suitability of this software for any purpose.
|
||||
|
||||
(9) Hans-Peter Nilsson
|
||||
|
||||
Copyright (C) 2001 Hans-Peter Nilsson
|
||||
|
||||
Permission to use, copy, modify, and distribute this software is
|
||||
freely granted, provided that the above copyright notice, this notice
|
||||
and the following disclaimer are preserved with no changes.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
(10) Stephane Carrez (m68hc11-elf/m68hc12-elf targets only)
|
||||
|
||||
Copyright (C) 1999, 2000, 2001, 2002 Stephane Carrez (stcarrez@nerim.fr)
|
||||
|
||||
The authors hereby grant permission to use, copy, modify, distribute,
|
||||
and license this software and its documentation for any purpose, provided
|
||||
that existing copyright notices are retained in all copies and that this
|
||||
notice is included verbatim in any distributions. No written agreement,
|
||||
license, or royalty fee is required for any of the authorized uses.
|
||||
Modifications to this software may be copyrighted by their authors
|
||||
and need not follow the licensing terms described here, provided that
|
||||
the new terms are clearly indicated on the first page of each file where
|
||||
they apply.
|
||||
|
||||
(11) Christopher G. Demetriou
|
||||
|
||||
Copyright (c) 2001 Christopher G. Demetriou
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
(12) SuperH, Inc.
|
||||
|
||||
Copyright 2002 SuperH, Inc. All rights reserved
|
||||
|
||||
This software is the property of SuperH, Inc (SuperH) which specifically
|
||||
grants the user the right to modify, use and distribute this software
|
||||
provided this notice is not removed or altered. All other rights are
|
||||
reserved by SuperH.
|
||||
|
||||
SUPERH MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO
|
||||
THIS SOFTWARE. IN NO EVENT SHALL SUPERH BE LIABLE FOR INDIRECT, SPECIAL,
|
||||
INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING FROM
|
||||
THE FURNISHING, PERFORMANCE, OR USE OF THIS SOFTWARE.
|
||||
|
||||
So that all may benefit from your experience, please report any problems
|
||||
or suggestions about this software to the SuperH Support Center via
|
||||
e-mail at softwaresupport@superh.com .
|
||||
|
||||
SuperH, Inc.
|
||||
405 River Oaks Parkway
|
||||
San Jose
|
||||
CA 95134
|
||||
USA
|
||||
|
||||
(13) Royal Institute of Technology
|
||||
|
||||
Copyright (c) 1999 Kungliga Tekniska Högskolan
|
||||
(Royal Institute of Technology, Stockholm, Sweden).
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of KTH nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
(14) Alexey Zelkin
|
||||
|
||||
Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(15) Andrey A. Chernov
|
||||
|
||||
Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(16) FreeBSD
|
||||
|
||||
Copyright (c) 1997-2002 FreeBSD Project.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(17) S. L. Moshier
|
||||
|
||||
Author: S. L. Moshier.
|
||||
|
||||
Copyright (c) 1984,2000 S.L. Moshier
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose without fee is hereby granted, provided that this entire notice
|
||||
is included in all copies of any software which is or includes a copy
|
||||
or modification of this software and in all copies of the supporting
|
||||
documentation for such software.
|
||||
|
||||
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
|
||||
WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
|
||||
OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
|
||||
SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||
|
||||
(18) Citrus Project
|
||||
|
||||
Copyright (c)1999 Citrus Project,
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(19) Todd C. Miller
|
||||
|
||||
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
(20) DJ Delorie (i386)
|
||||
Copyright (C) 1991 DJ Delorie
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms is permitted
|
||||
provided that the above copyright notice and following paragraph are
|
||||
duplicated in all such forms.
|
||||
|
||||
This file is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
(21) Free Software Foundation LGPL License (*-linux* targets only)
|
||||
|
||||
Copyright (C) 1990-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
(22) Xavier Leroy LGPL License (i[3456]86-*-linux* targets only)
|
||||
|
||||
Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr)
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
(23) Intel (i960)
|
||||
|
||||
Copyright (c) 1993 Intel Corporation
|
||||
|
||||
Intel hereby grants you permission to copy, modify, and distribute this
|
||||
software and its documentation. Intel grants this permission provided
|
||||
that the above copyright notice appears in all copies and that both the
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation. In addition, Intel grants this permission provided that
|
||||
you prominently mark as "not part of the original" any modifications
|
||||
made to this software or documentation, and that the name of Intel
|
||||
Corporation not be used in advertising or publicity pertaining to
|
||||
distribution of the software or the documentation without specific,
|
||||
written prior permission.
|
||||
|
||||
Intel Corporation provides this AS IS, WITHOUT ANY WARRANTY, EXPRESS OR
|
||||
IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY
|
||||
OR FITNESS FOR A PARTICULAR PURPOSE. Intel makes no guarantee or
|
||||
representations regarding the use of, or the results of the use of,
|
||||
the software and documentation in terms of correctness, accuracy,
|
||||
reliability, currentness, or otherwise; and you rely on the software,
|
||||
documentation and results solely at your own risk.
|
||||
|
||||
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
|
||||
LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
|
||||
OF ANY KIND. IN NO EVENT SHALL INTEL'S TOTAL LIABILITY EXCEED THE SUM
|
||||
PAID TO INTEL FOR THE PRODUCT LICENSED HEREUNDER.
|
||||
|
||||
(24) Hewlett-Packard (hppa targets only)
|
||||
|
||||
(c) Copyright 1986 HEWLETT-PACKARD COMPANY
|
||||
|
||||
To anyone who acknowledges that this file is provided "AS IS"
|
||||
without any express or implied warranty:
|
||||
permission to use, copy, modify, and distribute this file
|
||||
for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice and this notice appears in all
|
||||
copies, and that the name of Hewlett-Packard Company not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific, written prior permission.
|
||||
Hewlett-Packard Company makes no representations about the
|
||||
suitability of this software for any purpose.
|
||||
|
||||
(25) Henry Spencer (only *-linux targets)
|
||||
|
||||
Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
|
||||
This software is not subject to any license of the American Telephone
|
||||
and Telegraph Company or of the Regents of the University of California.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose on
|
||||
any computer system, and to alter it and redistribute it, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. The author is not responsible for the consequences of use of this
|
||||
software, no matter how awful, even if they arise from flaws in it.
|
||||
|
||||
2. The origin of this software must not be misrepresented, either by
|
||||
explicit claim or by omission. Since few users ever read sources,
|
||||
credits must appear in the documentation.
|
||||
|
||||
3. Altered versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software. Since few users
|
||||
ever read sources, credits must appear in the documentation.
|
||||
|
||||
4. This notice may not be removed or altered.
|
||||
|
||||
(26) Mike Barcroft
|
||||
|
||||
Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(27) Konstantin Chuguev (--enable-newlib-iconv)
|
||||
|
||||
Copyright (c) 1999, 2000
|
||||
Konstantin Chuguev. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
iconv (Charset Conversion Library) v2.0
|
||||
|
||||
(28) Artem Bityuckiy (--enable-newlib-iconv)
|
||||
|
||||
Copyright (c) 2003, Artem B. Bityuckiy, SoftMine Corporation.
|
||||
Rights transferred to Franklin Electronic Publishers.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(29) IBM, Sony, Toshiba (only spu-* targets)
|
||||
|
||||
(C) Copyright 2001,2006,
|
||||
International Business Machines Corporation,
|
||||
Sony Computer Entertainment, Incorporated,
|
||||
Toshiba Corporation,
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
(30) - Alex Tatmanjants (targets using libc/posix)
|
||||
|
||||
Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
|
||||
at Electronni Visti IA, Kiev, Ukraine.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(31) - M. Warner Losh (targets using libc/posix)
|
||||
|
||||
Copyright (c) 1998, M. Warner Losh <imp@freebsd.org>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(32) - Andrey A. Chernov (targets using libc/posix)
|
||||
|
||||
Copyright (C) 1996 by Andrey A. Chernov, Moscow, Russia.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
(33) - Daniel Eischen (targets using libc/posix)
|
||||
|
||||
Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
|
||||
(34) - Jon Beniston (only lm32-* targets)
|
||||
|
||||
Contributed by Jon Beniston <jon@beniston.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
|
||||
(35) - ARM Ltd (arm and thumb variant targets only)
|
||||
|
||||
Copyright (c) 2009 ARM Ltd
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the company may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
(36) - Xilinx, Inc. (microblaze-* and powerpc-* targets)
|
||||
|
||||
Copyright (c) 2004, 2009 Xilinx, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Xilinx nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
(37) Texas Instruments Incorporated (tic6x-* targets)
|
||||
|
||||
Copyright (c) 1996-2010 Texas Instruments Incorporated
|
||||
http://www.ti.com/
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
Neither the name of Texas Instruments Incorporated nor the names
|
||||
of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
(38) National Semiconductor (cr16-* and crx-* targets)
|
||||
|
||||
Copyright (c) 2004 National Semiconductor Corporation
|
||||
|
||||
The authors hereby grant permission to use, copy, modify, distribute,
|
||||
and license this software and its documentation for any purpose, provided
|
||||
that existing copyright notices are retained in all copies and that this
|
||||
notice is included verbatim in any distributions. No written agreement,
|
||||
license, or royalty fee is required for any of the authorized uses.
|
||||
Modifications to this software may be copyrighted by their authors
|
||||
and need not follow the licensing terms described here, provided that
|
||||
the new terms are clearly indicated on the first page of each file where
|
||||
they apply.
|
||||
|
674
newlib/src/COPYING3
Normal file
674
newlib/src/COPYING3
Normal file
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
165
newlib/src/COPYING3.LIB
Normal file
165
newlib/src/COPYING3.LIB
Normal file
|
@ -0,0 +1,165 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
14527
newlib/src/ChangeLog
Normal file
14527
newlib/src/ChangeLog
Normal file
File diff suppressed because it is too large
Load diff
121
newlib/src/MAINTAINERS
Normal file
121
newlib/src/MAINTAINERS
Normal file
|
@ -0,0 +1,121 @@
|
|||
Please feel free to add, edit, delete this file.
|
||||
Please do not make ChangeLog entries.
|
||||
|
||||
COPYING, COPYING.LIB, README
|
||||
http://gnu.org.
|
||||
|
||||
Makefile.*; configure; configure.ac; src-release
|
||||
Any global maintainer can approve changes to these
|
||||
files, but they should be aware that they need to
|
||||
be kept in sync with their counterparts in the GCC
|
||||
repository. Also please notify the following of
|
||||
any committed patches:
|
||||
binutils@sourceware.org
|
||||
gdb-patches@sourceware.org
|
||||
|
||||
bfd/; binutils/; elfcpp/; gas/; gold/; gprof/; ld/; opcodes/; cpu/;
|
||||
BFD's part of include/
|
||||
|
||||
binutils: http://sourceware.org/binutils/
|
||||
Patches to binutils@sourceware.org.
|
||||
Please notify the following of any interface changes:
|
||||
gdb-patches@sourceware.org
|
||||
|
||||
cgen/; cgen parts of opcodes/, sim/ & include/
|
||||
cgen: http://sourceware.org/cgen/
|
||||
Patches to cgen@sourceware.org
|
||||
May need separate opcodes/ or sim/ approval for
|
||||
commits of regenerated files there.
|
||||
|
||||
config.guess; config.sub; readline/support/config.{sub,guess}
|
||||
config: http://savannah.gnu.org/projects/config
|
||||
Patches to config-patches@gnu.org.
|
||||
Changes need to be done in tandem with the official CONFIG
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge. When updating any of these files, please be
|
||||
sure to update all of them.
|
||||
Please notify the following of any committed patches:
|
||||
binutils@sourceware.org
|
||||
gdb-patches@sourceware.org
|
||||
|
||||
depcomp; mkinstalldirs
|
||||
Send bug reports and patches to bug-automake@gnu.org.
|
||||
|
||||
gdb/; readline/; sim/; GDB's part of include/
|
||||
GDB: http://www.gnu.org/software/gdb/
|
||||
Patches to gdb-patches@sourceware.org.
|
||||
See also gdb/MAINTAINERS and sim/MAINTAINERS.
|
||||
|
||||
include/
|
||||
See binutils/, gdb/, sid/, gcc/, libiberty/ etc.
|
||||
|
||||
intl/; config.rhost; libiberty/; libiberty's part of include/
|
||||
gcc: http://gcc.gnu.org
|
||||
Changes need to be done in tandem with the official GCC
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge. Note: approved patches in gcc's libiberty or
|
||||
intl are automatically approved in this libiberty and intl also;
|
||||
feel free to merge them yourself if needed sooner than the next
|
||||
merge. Otherwise, changes are automatically merged, usually
|
||||
within a day.
|
||||
|
||||
libdecnumber/
|
||||
See libiberty. The master copy of this directory is in the GCC
|
||||
repository.
|
||||
|
||||
ltconfig; ltmain.sh; ltcf-*.sh
|
||||
libtool: http://www.gnu.org/software/libtool/
|
||||
Changes need to be done in tandem with the official LIBTOOL
|
||||
sources or submitted to the master file maintainer and brought
|
||||
in via a merge.
|
||||
|
||||
move-if-change
|
||||
Send bug reports and patches to bug-gnulib@gnu.org.
|
||||
|
||||
symlink-tree
|
||||
gcc: http://gcc.gnu.org
|
||||
See libiberty.
|
||||
|
||||
newlib/; libgloss/
|
||||
http://sourceware.org/newlib/
|
||||
Patches to newlib@sourceware.org.
|
||||
|
||||
sid/; SID's part of cgen/
|
||||
sid: http://sourceware.org/sid/
|
||||
Patches to sid@sourceware.org
|
||||
|
||||
texinfo/texinfo.tex
|
||||
texinfo: http://ftp.gnu.org.
|
||||
Latest version can be found on ftp://ftp.gnu.org and can be
|
||||
imported at any (reasonable) time.
|
||||
Please not use GCC's texinfo. Please do not import texinfo.
|
||||
|
||||
tcl/; tix/; itcl/; tk/; libgui/
|
||||
insight: http://sourceware.org/insight/
|
||||
Contact insight@sourceware.org.
|
||||
|
||||
winsup/
|
||||
cygwin: http://sourceware.org/cygwin
|
||||
Patches to cygwin-patches@cygwin.com.
|
||||
General discussion cygwin@cygwin.com.
|
||||
|
||||
config-ml.in; makefile.vms; mkdep; setup.com;
|
||||
etc/; utils/;
|
||||
Any global maintainer can approve changes to these
|
||||
files and directories.
|
||||
|
||||
compile; depcomp; install-sh; missing; ylwrap;
|
||||
config/
|
||||
Any global maintainer can approve changes to these
|
||||
files and directories, but they should be aware
|
||||
that they need to be kept in sync with their
|
||||
counterparts in the GCC repository.
|
||||
|
||||
modules file
|
||||
If you understand the file format (or can cut-and-paste existing
|
||||
entries), modify it. If it scares you, get someone who does
|
||||
understand it to help you. Be prepared to fix it if you do break it.
|
||||
|
||||
/* Local variables: */
|
||||
/* change-log-default-name: "/dev/null" */
|
||||
/* End: */
|
549
newlib/src/Makefile.def
Normal file
549
newlib/src/Makefile.def
Normal file
|
@ -0,0 +1,549 @@
|
|||
#! /usr/bin/autogen
|
||||
AutoGen definitions Makefile.tpl;
|
||||
|
||||
// Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
|
||||
// This file was originally written by Nathanael Nerode.
|
||||
//
|
||||
// Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
// Free Software Foundation
|
||||
//
|
||||
// This file is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
// "missing" indicates that that module doesn't supply
|
||||
// that recursive target in its Makefile.
|
||||
|
||||
build_modules= { module= libiberty; };
|
||||
build_modules= { module= bison; };
|
||||
build_modules= { module= flex; };
|
||||
build_modules= { module= m4; };
|
||||
build_modules= { module= texinfo; };
|
||||
build_modules= { module= fixincludes; };
|
||||
|
||||
host_modules= { module= bfd; lib_path=.libs; bootstrap=true; };
|
||||
host_modules= { module= opcodes; lib_path=.libs; bootstrap=true; };
|
||||
host_modules= { module= binutils; bootstrap=true; };
|
||||
host_modules= { module= bison; no_check_cross= true; };
|
||||
host_modules= { module= cgen; };
|
||||
host_modules= { module= dejagnu; };
|
||||
host_modules= { module= etc; };
|
||||
host_modules= { module= fastjar; no_check_cross= true; };
|
||||
host_modules= { module= fixincludes;
|
||||
missing= TAGS; };
|
||||
host_modules= { module= flex; no_check_cross= true; };
|
||||
host_modules= { module= gas; bootstrap=true; };
|
||||
host_modules= { module= gcc; bootstrap=true;
|
||||
extra_make_flags="$(EXTRA_GCC_FLAGS)"; };
|
||||
host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
|
||||
extra_configure_flags='--disable-shared';
|
||||
no_install= true;
|
||||
// none-*-* disables asm optimizations, bootstrap-testing
|
||||
// the compiler more thoroughly.
|
||||
host="none-${host_vendor}-${host_os}";
|
||||
// gmp's configure will complain if given anything
|
||||
// different from host for target.
|
||||
target="none-${host_vendor}-${host_os}"; };
|
||||
host_modules= { module= mpfr; lib_path=.libs; bootstrap=true;
|
||||
extra_configure_flags='--disable-shared @extra_mpfr_configure_flags@';
|
||||
no_install= true; };
|
||||
host_modules= { module= mpc; lib_path=.libs; bootstrap=true;
|
||||
extra_configure_flags='--disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@';
|
||||
no_install= true; };
|
||||
host_modules= { module= ppl; lib_path=src/.libs; bootstrap=true;
|
||||
extra_configure_flags='--disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/';
|
||||
no_install= true; };
|
||||
host_modules= { module= cloog; lib_path=.libs; bootstrap=true;
|
||||
extra_configure_flags='--disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl';
|
||||
extra_exports='CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; ';
|
||||
extra_make_flags='CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"';
|
||||
no_install= true; };
|
||||
host_modules= { module= libelf; lib_path=.libs; bootstrap=true;
|
||||
extra_configure_flags='--disable-shared';
|
||||
no_install= true; };
|
||||
host_modules= { module= gold; bootstrap=true; };
|
||||
host_modules= { module= gprof; };
|
||||
host_modules= { module= intl; bootstrap=true; };
|
||||
host_modules= { module= tcl;
|
||||
missing=mostlyclean; };
|
||||
host_modules= { module= itcl; };
|
||||
host_modules= { module= ld; bootstrap=true; };
|
||||
host_modules= { module= libcpp; bootstrap=true; };
|
||||
host_modules= { module= libdecnumber; bootstrap=true; };
|
||||
host_modules= { module= libgui; };
|
||||
host_modules= { module= libiberty; bootstrap=true;
|
||||
extra_configure_flags='@extra_host_libiberty_configure_flags@';};
|
||||
// We abuse missing to avoid installing anything for libiconv.
|
||||
host_modules= { module= libiconv;
|
||||
extra_configure_flags='--disable-shared';
|
||||
no_install= true;
|
||||
missing= install-info;
|
||||
missing= install-pdf;
|
||||
missing= install-html;
|
||||
missing= install-info; };
|
||||
host_modules= { module= m4; };
|
||||
host_modules= { module= readline; };
|
||||
host_modules= { module= sid; };
|
||||
host_modules= { module= sim; };
|
||||
host_modules= { module= texinfo; no_install= true; };
|
||||
host_modules= { module= zlib; no_install=true; no_check=true; bootstrap=true; };
|
||||
host_modules= { module= gdb; };
|
||||
host_modules= { module= expect; };
|
||||
host_modules= { module= guile; };
|
||||
host_modules= { module= tk; };
|
||||
host_modules= { module= libtermcap; no_check=true;
|
||||
missing=mostlyclean;
|
||||
missing=clean;
|
||||
missing=distclean;
|
||||
missing=maintainer-clean; };
|
||||
host_modules= { module= utils; no_check=true; };
|
||||
host_modules= { module= gnattools; };
|
||||
host_modules= { module= lto-plugin; bootstrap=true;
|
||||
extra_configure_flags=--enable-shared; };
|
||||
|
||||
target_modules = { module= libstdc++-v3;
|
||||
bootstrap=true;
|
||||
lib_path=src/.libs;
|
||||
raw_cxx=true; };
|
||||
target_modules = { module= libmudflap; lib_path=.libs; };
|
||||
target_modules = { module= libssp; lib_path=.libs; };
|
||||
target_modules = { module= newlib; };
|
||||
target_modules = { module= libgcc; bootstrap=true; no_check=true; };
|
||||
target_modules = { module= libquadmath; };
|
||||
target_modules = { module= libgfortran; };
|
||||
target_modules = { module= libobjc; };
|
||||
target_modules = { module= libgo; };
|
||||
target_modules = { module= libtermcap; no_check=true;
|
||||
missing=mostlyclean;
|
||||
missing=clean;
|
||||
missing=distclean;
|
||||
missing=maintainer-clean; };
|
||||
target_modules = { module= winsup; };
|
||||
target_modules = { module= libgloss; no_check=true; };
|
||||
target_modules = { module= libffi; };
|
||||
target_modules = { module= libjava; raw_cxx=true;
|
||||
extra_configure_flags="$(EXTRA_CONFIGARGS_LIBJAVA)"; };
|
||||
target_modules = { module= zlib; };
|
||||
target_modules = { module= boehm-gc; };
|
||||
target_modules = { module= rda; };
|
||||
target_modules = { module= libada; };
|
||||
target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; };
|
||||
|
||||
// These are (some of) the make targets to be done in each subdirectory.
|
||||
// Not all; these are the ones which don't have special options.
|
||||
// "depend" indicates that a target depends on another target uniformly
|
||||
// for each subdirectory. There can be several such lines per target.
|
||||
recursive_targets = { make_target= info;
|
||||
depend=configure; };
|
||||
recursive_targets = { make_target= dvi;
|
||||
depend=configure; };
|
||||
recursive_targets = { make_target= pdf;
|
||||
depend=configure; };
|
||||
recursive_targets = { make_target= html;
|
||||
depend=configure; };
|
||||
recursive_targets = { make_target= TAGS;
|
||||
depend=configure; };
|
||||
recursive_targets = { make_target= install-info;
|
||||
depend=configure;
|
||||
depend=info; };
|
||||
recursive_targets = { make_target= install-pdf;
|
||||
depend=configure;
|
||||
depend=pdf; };
|
||||
recursive_targets = { make_target= install-html;
|
||||
depend=configure;
|
||||
depend=html; };
|
||||
recursive_targets = { make_target= installcheck;
|
||||
depend=configure; };
|
||||
recursive_targets = { make_target= mostlyclean; };
|
||||
recursive_targets = { make_target= clean; };
|
||||
recursive_targets = { make_target= distclean; };
|
||||
recursive_targets = { make_target= maintainer-clean; };
|
||||
|
||||
// Flags which need to be passed down.
|
||||
|
||||
// Directories etc.
|
||||
flags_to_pass = { flag= DESTDIR ; };
|
||||
flags_to_pass = { flag= RPATH_ENVVAR ; };
|
||||
flags_to_pass = { flag= TARGET_SUBDIR ; };
|
||||
flags_to_pass = { flag= bindir ; };
|
||||
flags_to_pass = { flag= datadir ; };
|
||||
flags_to_pass = { flag= exec_prefix ; };
|
||||
flags_to_pass = { flag= includedir ; };
|
||||
flags_to_pass = { flag= datarootdir ; };
|
||||
flags_to_pass = { flag= docdir ; };
|
||||
flags_to_pass = { flag= infodir ; };
|
||||
flags_to_pass = { flag= pdfdir ; };
|
||||
flags_to_pass = { flag= htmldir ; };
|
||||
flags_to_pass = { flag= libdir ; };
|
||||
flags_to_pass = { flag= libexecdir ; };
|
||||
flags_to_pass = { flag= lispdir ; };
|
||||
flags_to_pass = { flag= localstatedir ; };
|
||||
flags_to_pass = { flag= mandir ; };
|
||||
flags_to_pass = { flag= oldincludedir ; };
|
||||
flags_to_pass = { flag= prefix ; };
|
||||
flags_to_pass = { flag= sbindir ; };
|
||||
flags_to_pass = { flag= sharedstatedir ; };
|
||||
flags_to_pass = { flag= sysconfdir ; };
|
||||
flags_to_pass = { flag= tooldir ; };
|
||||
flags_to_pass = { flag= build_tooldir ; };
|
||||
flags_to_pass = { flag= target_alias ; };
|
||||
|
||||
// Build tools
|
||||
flags_to_pass = { flag= AWK ; };
|
||||
flags_to_pass = { flag= BISON ; };
|
||||
flags_to_pass = { flag= CC_FOR_BUILD ; };
|
||||
flags_to_pass = { flag= CFLAGS_FOR_BUILD ; };
|
||||
flags_to_pass = { flag= CXX_FOR_BUILD ; };
|
||||
flags_to_pass = { flag= EXPECT ; };
|
||||
flags_to_pass = { flag= FLEX ; };
|
||||
flags_to_pass = { flag= INSTALL ; };
|
||||
flags_to_pass = { flag= INSTALL_DATA ; };
|
||||
flags_to_pass = { flag= INSTALL_PROGRAM ; };
|
||||
flags_to_pass = { flag= INSTALL_SCRIPT ; };
|
||||
flags_to_pass = { flag= LDFLAGS_FOR_BUILD ; };
|
||||
flags_to_pass = { flag= LEX ; };
|
||||
flags_to_pass = { flag= M4 ; };
|
||||
flags_to_pass = { flag= MAKE ; };
|
||||
flags_to_pass = { flag= RUNTEST ; };
|
||||
flags_to_pass = { flag= RUNTESTFLAGS ; };
|
||||
flags_to_pass = { flag= SED ; };
|
||||
flags_to_pass = { flag= SHELL ; };
|
||||
flags_to_pass = { flag= YACC ; };
|
||||
|
||||
// Host tools
|
||||
flags_to_pass = { flag= ADAFLAGS ; optional=true ; };
|
||||
flags_to_pass = { flag= ADA_CFLAGS ; };
|
||||
flags_to_pass = { flag= AR_FLAGS ; };
|
||||
flags_to_pass = { flag= BOOT_ADAFLAGS ; optional=true ; };
|
||||
flags_to_pass = { flag= BOOT_CFLAGS ; };
|
||||
flags_to_pass = { flag= BOOT_LDFLAGS ; };
|
||||
flags_to_pass = { flag= CFLAGS ; };
|
||||
flags_to_pass = { flag= CXXFLAGS ; };
|
||||
flags_to_pass = { flag= LDFLAGS ; };
|
||||
flags_to_pass = { flag= LIBCFLAGS ; };
|
||||
flags_to_pass = { flag= LIBCXXFLAGS ; };
|
||||
flags_to_pass = { flag= STAGE1_CHECKING ; };
|
||||
flags_to_pass = { flag= STAGE1_LANGUAGES ; };
|
||||
flags_to_pass = { flag= GNATBIND ; };
|
||||
flags_to_pass = { flag= GNATMAKE ; };
|
||||
|
||||
// Target tools
|
||||
flags_to_pass = { flag= AR_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= AS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= CC_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= CFLAGS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= CPPFLAGS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= CXXFLAGS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= DLLTOOL_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= FLAGS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= GCJ_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= GOC_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= LD_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= LIPO_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= LIBCFLAGS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= LIBCXXFLAGS_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= NM_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= OBJDUMP_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= RANLIB_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= READELF_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= STRIP_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= WINDRES_FOR_TARGET ; };
|
||||
flags_to_pass = { flag= WINDMC_FOR_TARGET ; };
|
||||
|
||||
// Miscellaneous
|
||||
flags_to_pass = { flag= BUILD_CONFIG ; };
|
||||
flags_to_pass = { flag= LANGUAGES ; optional=true ; };
|
||||
flags_to_pass = { flag= LEAN ; };
|
||||
|
||||
// Inter-module dependencies
|
||||
|
||||
// Build modules
|
||||
dependencies = { module=all-build-bison; on=all-build-texinfo; };
|
||||
dependencies = { module=all-build-flex; on=all-build-texinfo; };
|
||||
dependencies = { module=all-build-flex; on=all-build-bison; };
|
||||
dependencies = { module=all-build-flex; on=all-build-m4; };
|
||||
dependencies = { module=all-build-libiberty; on=all-build-texinfo; };
|
||||
dependencies = { module=all-build-m4; on=all-build-texinfo; };
|
||||
dependencies = { module=all-build-fixincludes; on=all-build-libiberty; };
|
||||
|
||||
// Host modules specific to gcc.
|
||||
dependencies = { module=configure-gcc; on=configure-intl; };
|
||||
dependencies = { module=configure-gcc; on=all-lto-plugin; };
|
||||
dependencies = { module=configure-gcc; on=all-binutils; };
|
||||
dependencies = { module=configure-gcc; on=all-gas; };
|
||||
dependencies = { module=configure-gcc; on=all-ld; };
|
||||
dependencies = { module=configure-gcc; on=all-gold; };
|
||||
dependencies = { module=configure-gcc; on=all-libelf; };
|
||||
dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
|
||||
dependencies = { module=all-gcc; on=all-gmp; };
|
||||
dependencies = { module=all-gcc; on=all-intl; };
|
||||
dependencies = { module=all-gcc; on=all-mpfr; };
|
||||
dependencies = { module=all-gcc; on=all-mpc; };
|
||||
dependencies = { module=all-gcc; on=all-ppl; };
|
||||
dependencies = { module=all-gcc; on=all-cloog; };
|
||||
dependencies = { module=all-gcc; on=all-build-texinfo; };
|
||||
dependencies = { module=all-gcc; on=all-build-bison; };
|
||||
dependencies = { module=all-gcc; on=all-build-flex; };
|
||||
dependencies = { module=all-gcc; on=all-build-libiberty; };
|
||||
dependencies = { module=all-gcc; on=all-build-fixincludes; };
|
||||
dependencies = { module=all-gcc; on=all-zlib; };
|
||||
dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
|
||||
dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; };
|
||||
dependencies = { module=all-gcc; on=all-libiberty; };
|
||||
dependencies = { module=all-gcc; on=all-fixincludes; };
|
||||
dependencies = { module=all-gcc; on=all-lto-plugin; };
|
||||
dependencies = { module=info-gcc; on=all-build-libiberty; };
|
||||
dependencies = { module=dvi-gcc; on=all-build-libiberty; };
|
||||
dependencies = { module=pdf-gcc; on=all-build-libiberty; };
|
||||
dependencies = { module=html-gcc; on=all-build-libiberty; };
|
||||
dependencies = { module=install-gcc ; on=install-fixincludes; };
|
||||
dependencies = { module=install-gcc ; on=install-lto-plugin; };
|
||||
dependencies = { module=install-strip-gcc ; on=install-strip-fixincludes; };
|
||||
|
||||
dependencies = { module=configure-libcpp; on=configure-libiberty; hard=true; };
|
||||
dependencies = { module=configure-libcpp; on=configure-intl; };
|
||||
dependencies = { module=all-libcpp; on=all-libiberty; hard=true; };
|
||||
dependencies = { module=all-libcpp; on=all-intl; };
|
||||
|
||||
dependencies = { module=all-fixincludes; on=all-libiberty; };
|
||||
|
||||
dependencies = { module=all-gnattools; on=all-target-libada; };
|
||||
|
||||
dependencies = { module=all-lto-plugin; on=all-libiberty; };
|
||||
|
||||
dependencies = { module=all-utils; on=all-libiberty; };
|
||||
|
||||
dependencies = { module=configure-mpfr; on=all-gmp; };
|
||||
dependencies = { module=configure-mpc; on=all-mpfr; };
|
||||
dependencies = { module=configure-ppl; on=all-gmp; };
|
||||
dependencies = { module=configure-ppl; on=all-mpfr; };
|
||||
dependencies = { module=configure-cloog; on=all-ppl; };
|
||||
|
||||
// Host modules specific to gdb.
|
||||
dependencies = { module=configure-gdb; on=all-intl; };
|
||||
dependencies = { module=configure-gdb; on=configure-sim; };
|
||||
dependencies = { module=configure-gdb; on=all-bfd; };
|
||||
// Depend on all-libiconv so that configure checks for iconv
|
||||
// functions will work.
|
||||
dependencies = { module=configure-gdb; on=all-libiconv; };
|
||||
dependencies = { module=all-gdb; on=all-libiberty; };
|
||||
dependencies = { module=all-gdb; on=all-libiconv; };
|
||||
dependencies = { module=all-gdb; on=all-opcodes; };
|
||||
dependencies = { module=all-gdb; on=all-readline; };
|
||||
dependencies = { module=all-gdb; on=all-build-bison; };
|
||||
dependencies = { module=all-gdb; on=all-sim; };
|
||||
dependencies = { module=all-gdb; on=all-libdecnumber; };
|
||||
dependencies = { module=all-gdb; on=all-libtermcap; };
|
||||
|
||||
dependencies = { module=configure-libgui; on=configure-tcl; };
|
||||
dependencies = { module=configure-libgui; on=configure-tk; };
|
||||
dependencies = { module=all-libgui; on=all-tcl; };
|
||||
dependencies = { module=all-libgui; on=all-tk; };
|
||||
dependencies = { module=all-libgui; on=all-itcl; };
|
||||
|
||||
// Host modules specific to binutils.
|
||||
dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
|
||||
dependencies = { module=configure-bfd; on=configure-intl; };
|
||||
dependencies = { module=all-bfd; on=all-libiberty; };
|
||||
dependencies = { module=all-bfd; on=all-intl; };
|
||||
dependencies = { module=configure-opcodes; on=configure-libiberty; hard=true; };
|
||||
dependencies = { module=all-opcodes; on=all-libiberty; };
|
||||
|
||||
dependencies = { module=configure-binutils; on=configure-intl; };
|
||||
dependencies = { module=all-binutils; on=all-libiberty; };
|
||||
dependencies = { module=all-binutils; on=all-opcodes; };
|
||||
dependencies = { module=all-binutils; on=all-bfd; };
|
||||
dependencies = { module=all-binutils; on=all-build-flex; };
|
||||
dependencies = { module=all-binutils; on=all-build-bison; };
|
||||
dependencies = { module=all-binutils; on=all-intl; };
|
||||
|
||||
// We put install-opcodes before install-binutils because the installed
|
||||
// binutils might be on PATH, and they might need the shared opcodes
|
||||
// library.
|
||||
dependencies = { module=install-binutils; on=install-opcodes; };
|
||||
dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
|
||||
|
||||
// libopcodes depends on libbfd
|
||||
dependencies = { module=install-opcodes; on=install-bfd; };
|
||||
dependencies = { module=install-strip-opcodes; on=install-strip-bfd; };
|
||||
|
||||
dependencies = { module=configure-gas; on=configure-intl; };
|
||||
dependencies = { module=all-gas; on=all-libiberty; };
|
||||
dependencies = { module=all-gas; on=all-opcodes; };
|
||||
dependencies = { module=all-gas; on=all-bfd; };
|
||||
dependencies = { module=all-gas; on=all-intl; };
|
||||
dependencies = { module=configure-gprof; on=configure-intl; };
|
||||
dependencies = { module=all-gprof; on=all-libiberty; };
|
||||
dependencies = { module=all-gprof; on=all-bfd; };
|
||||
dependencies = { module=all-gprof; on=all-opcodes; };
|
||||
dependencies = { module=all-gprof; on=all-intl; };
|
||||
dependencies = { module=configure-ld; on=configure-intl; };
|
||||
dependencies = { module=all-ld; on=all-libiberty; };
|
||||
dependencies = { module=all-ld; on=all-bfd; };
|
||||
dependencies = { module=all-ld; on=all-opcodes; };
|
||||
dependencies = { module=all-ld; on=all-build-bison; };
|
||||
dependencies = { module=all-ld; on=all-build-flex; };
|
||||
dependencies = { module=all-ld; on=all-intl; };
|
||||
dependencies = { module=install-ld; on=install-gold; };
|
||||
dependencies = { module=install-strip-ld; on=install-strip-gold; };
|
||||
dependencies = { module=configure-gold; on=configure-intl; };
|
||||
dependencies = { module=all-gold; on=all-libiberty; };
|
||||
dependencies = { module=all-gold; on=all-intl; };
|
||||
dependencies = { module=all-gold; on=all-bfd; };
|
||||
dependencies = { module=all-gold; on=all-build-bison; };
|
||||
dependencies = { module=check-gold; on=all-binutils; };
|
||||
dependencies = { module=check-gold; on=all-gas; };
|
||||
|
||||
dependencies = { module=configure-opcodes; on=configure-intl; };
|
||||
dependencies = { module=all-opcodes; on=all-bfd; };
|
||||
dependencies = { module=all-opcodes; on=all-libiberty; };
|
||||
dependencies = { module=all-opcodes; on=all-intl; };
|
||||
|
||||
// Other host modules in the 'src' repository.
|
||||
dependencies = { module=all-dejagnu; on=all-tcl; };
|
||||
dependencies = { module=all-dejagnu; on=all-expect; };
|
||||
dependencies = { module=all-dejagnu; on=all-tk; };
|
||||
dependencies = { module=configure-expect; on=configure-tcl; };
|
||||
dependencies = { module=configure-expect; on=configure-tk; };
|
||||
dependencies = { module=all-expect; on=all-tcl; };
|
||||
dependencies = { module=all-expect; on=all-tk; };
|
||||
|
||||
// We put install-tcl before install-itcl because itcl wants to run a
|
||||
// program on installation which uses the Tcl libraries.
|
||||
dependencies = { module=configure-itcl; on=configure-tcl; };
|
||||
dependencies = { module=configure-itcl; on=configure-tk; };
|
||||
dependencies = { module=all-itcl; on=all-tcl; };
|
||||
dependencies = { module=all-itcl; on=all-tk; };
|
||||
dependencies = { module=install-itcl; on=install-tcl; };
|
||||
dependencies = { module=install-strip-itcl; on=install-strip-tcl; };
|
||||
|
||||
dependencies = { module=configure-tk; on=configure-tcl; };
|
||||
dependencies = { module=all-tk; on=all-tcl; };
|
||||
|
||||
dependencies = { module=all-sid; on=all-libiberty; };
|
||||
dependencies = { module=all-sid; on=all-bfd; };
|
||||
dependencies = { module=all-sid; on=all-opcodes; };
|
||||
dependencies = { module=all-sid; on=all-tcl; };
|
||||
dependencies = { module=all-sid; on=all-tk; };
|
||||
dependencies = { module=install-sid; on=install-tcl; };
|
||||
dependencies = { module=install-strip-sid; on=install-strip-tcl; };
|
||||
dependencies = { module=install-sid; on=install-tk; };
|
||||
dependencies = { module=install-strip-sid; on=install-strip-tk; };
|
||||
|
||||
dependencies = { module=configure-sim; on=configure-intl; };
|
||||
dependencies = { module=all-sim; on=all-intl; };
|
||||
dependencies = { module=all-sim; on=all-libiberty; };
|
||||
dependencies = { module=all-sim; on=all-bfd; };
|
||||
dependencies = { module=all-sim; on=all-opcodes; };
|
||||
dependencies = { module=all-sim; on=all-readline; };
|
||||
dependencies = { module=all-sim; on=configure-gdb; };
|
||||
|
||||
// Other host modules.
|
||||
dependencies = { module=all-fastjar; on=all-zlib; };
|
||||
dependencies = { module=all-fastjar; on=all-build-texinfo; };
|
||||
dependencies = { module=all-fastjar; on=all-libiberty; };
|
||||
|
||||
// Warning, these are not well tested.
|
||||
dependencies = { module=all-bison; on=all-intl; };
|
||||
dependencies = { module=all-bison; on=all-build-texinfo; };
|
||||
dependencies = { module=all-flex; on=all-build-bison; };
|
||||
dependencies = { module=all-flex; on=all-intl; };
|
||||
dependencies = { module=all-flex; on=all-m4; };
|
||||
dependencies = { module=all-flex; on=all-build-texinfo; };
|
||||
dependencies = { module=all-m4; on=all-intl; };
|
||||
dependencies = { module=all-m4; on=all-build-texinfo; };
|
||||
|
||||
// Target modules. These can also have dependencies on the language
|
||||
// environment (e.g. on libstdc++). By default target modules depend
|
||||
// on libgcc and newlib/libgloss.
|
||||
lang_env_dependencies = { module=libjava; cxx=true; };
|
||||
lang_env_dependencies = { module=newlib; no_c=true; };
|
||||
lang_env_dependencies = { module=libgloss; no_c=true; };
|
||||
lang_env_dependencies = { module=libgcc; no_gcc=true; no_c=true; };
|
||||
// libiberty does not depend on newlib or libgloss because it must be
|
||||
// built newlib on some targets (e.g. Cygwin). It still needs
|
||||
// a dependency on libgcc for native targets to configure.
|
||||
lang_env_dependencies = { module=libiberty; no_c=true; };
|
||||
|
||||
dependencies = { module=configure-target-boehm-gc; on=all-target-libstdc++-v3; };
|
||||
dependencies = { module=configure-target-fastjar; on=configure-target-zlib; };
|
||||
dependencies = { module=all-target-fastjar; on=all-target-zlib; };
|
||||
dependencies = { module=configure-target-libgo; on=configure-target-libffi; };
|
||||
dependencies = { module=configure-target-libgo; on=all-target-libstdc++-v3; };
|
||||
dependencies = { module=all-target-libgo; on=all-target-libffi; };
|
||||
dependencies = { module=configure-target-libjava; on=configure-target-zlib; };
|
||||
dependencies = { module=configure-target-libjava; on=configure-target-boehm-gc; };
|
||||
dependencies = { module=configure-target-libjava; on=configure-target-libffi; };
|
||||
dependencies = { module=all-target-libjava; on=all-fastjar; };
|
||||
dependencies = { module=all-target-libjava; on=all-target-zlib; };
|
||||
dependencies = { module=all-target-libjava; on=all-target-boehm-gc; };
|
||||
dependencies = { module=all-target-libjava; on=all-target-libffi; };
|
||||
dependencies = { module=configure-target-libobjc; on=configure-target-boehm-gc; };
|
||||
dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
|
||||
dependencies = { module=configure-target-libstdc++-v3; on=configure-target-libgomp; };
|
||||
// parallel_list.o and parallel_settings.o depend on omp.h, which is
|
||||
// generated by the libgomp configure. Unfortunately, due to the use of
|
||||
// recursive make, we can't be that specific.
|
||||
dependencies = { module=all-target-libstdc++-v3; on=configure-target-libgomp; };
|
||||
|
||||
// Target modules in the 'src' repository.
|
||||
lang_env_dependencies = { module=libtermcap; };
|
||||
lang_env_dependencies = { module=rda; };
|
||||
lang_env_dependencies = { module=winsup; };
|
||||
|
||||
dependencies = { module=all-target-libgloss; on=all-target-newlib; };
|
||||
dependencies = { module=all-target-winsup; on=all-target-libtermcap; };
|
||||
dependencies = { module=configure-target-newlib; on=all-binutils; };
|
||||
dependencies = { module=configure-target-newlib; on=all-ld; };
|
||||
dependencies = { module=configure-target-libgfortran; on=all-target-libquadmath; };
|
||||
|
||||
languages = { language=c; gcc-check-target=check-gcc; };
|
||||
languages = { language=c++; gcc-check-target="check-c++ check-c++0x";
|
||||
lib-check-target=check-target-libstdc++-v3;
|
||||
lib-check-target=check-target-libmudflap-c++; };
|
||||
languages = { language=fortran; gcc-check-target=check-fortran;
|
||||
lib-check-target=check-target-libquadmath;
|
||||
lib-check-target=check-target-libgfortran; };
|
||||
languages = { language=java; gcc-check-target=check-java;
|
||||
lib-check-target=check-target-libjava; };
|
||||
languages = { language=ada; gcc-check-target=check-ada;
|
||||
lib-check-target=check-target-libada; };
|
||||
languages = { language=objc; gcc-check-target=check-objc;
|
||||
lib-check-target=check-target-libobjc; };
|
||||
languages = { language=obj-c++; gcc-check-target=check-obj-c++; };
|
||||
languages = { language=go; gcc-check-target=check-go;
|
||||
lib-check-target=check-target-libgo; };
|
||||
|
||||
// Toplevel bootstrap
|
||||
bootstrap_stage = { id=1 ; };
|
||||
bootstrap_stage = {
|
||||
id=2 ; prev=1 ;
|
||||
bootstrap_target=bootstrap2 ; };
|
||||
bootstrap_stage = {
|
||||
id=3 ; prev=2 ; lean=1 ;
|
||||
compare_target=compare ;
|
||||
bootstrap_target=bootstrap ;
|
||||
cleanstrap_target=cleanstrap ; };
|
||||
bootstrap_stage = {
|
||||
id=4 ; prev=3 ; lean=2 ;
|
||||
compare_target=compare3 ;
|
||||
bootstrap_target=bootstrap4 ; };
|
||||
bootstrap_stage = {
|
||||
id=profile ; prev=1 ; };
|
||||
bootstrap_stage = {
|
||||
id=feedback ; prev=profile ;
|
||||
bootstrap_target=profiledbootstrap ; };
|
43121
newlib/src/Makefile.in
Normal file
43121
newlib/src/Makefile.in
Normal file
File diff suppressed because it is too large
Load diff
1903
newlib/src/Makefile.tpl
Normal file
1903
newlib/src/Makefile.tpl
Normal file
File diff suppressed because it is too large
Load diff
47
newlib/src/README
Normal file
47
newlib/src/README
Normal file
|
@ -0,0 +1,47 @@
|
|||
README for GNU development tools
|
||||
|
||||
This directory contains various GNU compilers, assemblers, linkers,
|
||||
debuggers, etc., plus their support routines, definitions, and documentation.
|
||||
|
||||
If you are receiving this as part of a GDB release, see the file gdb/README.
|
||||
If with a binutils release, see binutils/README; if with a libg++ release,
|
||||
see libg++/README, etc. That'll give you info about this
|
||||
package -- supported targets, how to use it, how to report bugs, etc.
|
||||
|
||||
It is now possible to automatically configure and build a variety of
|
||||
tools with one command. To build all of the tools contained herein,
|
||||
run the ``configure'' script here, e.g.:
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
To install them (by default in /usr/local/bin, /usr/local/lib, etc),
|
||||
then do:
|
||||
make install
|
||||
|
||||
(If the configure script can't determine your type of computer, give it
|
||||
the name as an argument, for instance ``./configure sun4''. You can
|
||||
use the script ``config.sub'' to test whether a name is recognized; if
|
||||
it is, config.sub translates it to a triplet specifying CPU, vendor,
|
||||
and OS.)
|
||||
|
||||
If you have more than one compiler on your system, it is often best to
|
||||
explicitly set CC in the environment before running configure, and to
|
||||
also set CC when running make. For example (assuming sh/bash/ksh):
|
||||
|
||||
CC=gcc ./configure
|
||||
make
|
||||
|
||||
A similar example using csh:
|
||||
|
||||
setenv CC gcc
|
||||
./configure
|
||||
make
|
||||
|
||||
Much of the code and documentation enclosed is copyright by
|
||||
the Free Software Foundation, Inc. See the file COPYING or
|
||||
COPYING.LIB in the various directories, for a description of the
|
||||
GNU General Public License terms under which you can copy the files.
|
||||
|
||||
REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
|
||||
on where and how to report problems.
|
25
newlib/src/README-maintainer-mode
Normal file
25
newlib/src/README-maintainer-mode
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Notes on enabling maintainer mode
|
||||
|
||||
Note that if you configure with --enable-maintainer-mode, you will need
|
||||
special versions of automake, autoconf, libtool and gettext. You will
|
||||
find the sources for these in the respective upstream directories:
|
||||
|
||||
ftp://ftp.gnu.org/gnu/autoconf
|
||||
ftp://ftp.gnu.org/gnu/automake
|
||||
ftp://ftp.gnu.org/gnu/libtool
|
||||
ftp://ftp.gnu.org/gnu/gettext
|
||||
|
||||
The required versions of the tools for this tree are
|
||||
autoconf 2.64
|
||||
automake 1.11
|
||||
libtool 2.2.6
|
||||
gettext 0.14.5
|
||||
|
||||
Note - "make distclean" does not work with maintainer mode enabled.
|
||||
The Makefiles in the some of the po/ subdirectories depend upon the
|
||||
Makefiles in their parent directories, and distclean will delete the
|
||||
Makefiles in the parent directories before running the Makefiles in
|
||||
the child directories. There is no easy way around this (short of
|
||||
changing the automake macros) as these dependencies need to exist in
|
||||
order to correctly build the NLS files.
|
143
newlib/src/compile
Executable file
143
newlib/src/compile
Executable file
|
@ -0,0 +1,143 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
877
newlib/src/config-ml.in
Normal file
877
newlib/src/config-ml.in
Normal file
|
@ -0,0 +1,877 @@
|
|||
# Configure fragment invoked in the post-target section for subdirs
|
||||
# wanting multilib support.
|
||||
#
|
||||
# Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# Please report bugs to <gcc-bugs@gnu.org>
|
||||
# and send patches to <gcc-patches@gnu.org>.
|
||||
|
||||
# It is advisable to support a few --enable/--disable options to let the
|
||||
# user select which libraries s/he really wants.
|
||||
#
|
||||
# Subdirectories wishing to use multilib should put the following lines
|
||||
# in the "post-target" section of configure.in.
|
||||
#
|
||||
# if [ "${srcdir}" = "." ] ; then
|
||||
# if [ "${with_target_subdir}" != "." ] ; then
|
||||
# . ${with_multisrctop}../../config-ml.in
|
||||
# else
|
||||
# . ${with_multisrctop}../config-ml.in
|
||||
# fi
|
||||
# else
|
||||
# . ${srcdir}/../config-ml.in
|
||||
# fi
|
||||
#
|
||||
#
|
||||
# Things are complicated because 6 separate cases must be handled:
|
||||
# 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
|
||||
#
|
||||
# srcdir=. is special. It must handle make programs that don't handle VPATH.
|
||||
# To implement this, a symlink tree is built for each library and for each
|
||||
# multilib subdir.
|
||||
#
|
||||
# The build tree is layed out as
|
||||
#
|
||||
# ./
|
||||
# newlib
|
||||
# m68020/
|
||||
# newlib
|
||||
# m68881/
|
||||
# newlib
|
||||
#
|
||||
# The nice feature about this arrangement is that inter-library references
|
||||
# in the build tree work without having to care where you are. Note that
|
||||
# inter-library references also work in the source tree because symlink trees
|
||||
# are built when srcdir=.
|
||||
#
|
||||
# Unfortunately, trying to access the libraries in the build tree requires
|
||||
# the user to manually choose which library to use as GCC won't be able to
|
||||
# find the right one. This is viewed as the lesser of two evils.
|
||||
#
|
||||
# Configure variables:
|
||||
# ${with_target_subdir} = "." for native, or ${target_alias} for cross.
|
||||
# Set by top level Makefile.
|
||||
# ${with_multisrctop} = how many levels of multilibs there are in the source
|
||||
# tree. It exists to handle the case of configuring in the source tree:
|
||||
# ${srcdir} is not constant.
|
||||
# ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
|
||||
#
|
||||
# Makefile variables:
|
||||
# MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
|
||||
# (FIXME: note that this is different than ${with_multisrctop}. Check out.).
|
||||
# MULTIBUILDTOP = number of multilib levels in build tree
|
||||
# MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
|
||||
# (only defined in each library's main Makefile).
|
||||
# MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000)
|
||||
# (only defined in each multilib subdir).
|
||||
|
||||
# FIXME: Multilib is currently disabled by default for everything other than
|
||||
# newlib. It is up to each target to turn on multilib support for the other
|
||||
# libraries as desired.
|
||||
|
||||
# Autoconf incoming variables:
|
||||
# srcdir, host, ac_configure_args
|
||||
#
|
||||
# We *could* figure srcdir and host out, but we'd have to do work that
|
||||
# our caller has already done to figure them out and requiring these two
|
||||
# seems reasonable.
|
||||
# Note that `host' in this case is GCC's `target'. Target libraries are
|
||||
# configured for a particular host.
|
||||
|
||||
Makefile=${ac_file-Makefile}
|
||||
ml_config_shell=${CONFIG_SHELL-/bin/sh}
|
||||
ml_realsrcdir=${srcdir}
|
||||
|
||||
# Scan all the arguments and set all the ones we need.
|
||||
|
||||
ml_verbose=--verbose
|
||||
for option in ${ac_configure_args}
|
||||
do
|
||||
# strip single quotes surrounding individual options
|
||||
case $option in
|
||||
\'*\') eval option=$option ;;
|
||||
esac
|
||||
|
||||
case $option in
|
||||
--*) ;;
|
||||
-*) option=-$option ;;
|
||||
esac
|
||||
|
||||
case $option in
|
||||
--*=*)
|
||||
optarg=`echo $option | sed -e 's/^[^=]*=//'`
|
||||
;;
|
||||
esac
|
||||
|
||||
case $option in
|
||||
--disable-*)
|
||||
enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
|
||||
eval $enableopt=no
|
||||
;;
|
||||
--enable-*)
|
||||
case "$option" in
|
||||
*=*) ;;
|
||||
*) optarg=yes ;;
|
||||
esac
|
||||
enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
|
||||
# enable_shared and enable_static are handled by configure.
|
||||
# Don't undo its work.
|
||||
case $enableopt in
|
||||
enable_shared | enable_static) ;;
|
||||
*) eval $enableopt="$optarg" ;;
|
||||
esac
|
||||
;;
|
||||
--norecursion | --no-recursion)
|
||||
ml_norecursion=yes
|
||||
;;
|
||||
--silent | --sil* | --quiet | --q*)
|
||||
ml_verbose=--silent
|
||||
;;
|
||||
--verbose | --v | --verb*)
|
||||
ml_verbose=--verbose
|
||||
;;
|
||||
--with-*)
|
||||
case "$option" in
|
||||
*=*) ;;
|
||||
*) optarg=yes ;;
|
||||
esac
|
||||
withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
|
||||
eval $withopt="$optarg"
|
||||
;;
|
||||
--without-*)
|
||||
withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
|
||||
eval $withopt=no
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Only do this if --enable-multilib.
|
||||
if [ "${enable_multilib}" = yes ]; then
|
||||
|
||||
# Compute whether this is the library's top level directory
|
||||
# (ie: not a multilib subdirectory, and not a subdirectory like newlib/src).
|
||||
# ${with_multisubdir} tells us we're in the right branch, but we could be
|
||||
# in a subdir of that.
|
||||
# ??? The previous version could void this test by separating the process into
|
||||
# two files: one that only the library's toplevel configure.in ran (to
|
||||
# configure the multilib subdirs), and another that all configure.in's ran to
|
||||
# update the Makefile. It seemed reasonable to collapse all multilib support
|
||||
# into one file, but it does leave us with having to perform this test.
|
||||
ml_toplevel_p=no
|
||||
if [ -z "${with_multisubdir}" ]; then
|
||||
if [ "${srcdir}" = "." ]; then
|
||||
# Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
|
||||
# ${with_target_subdir} = "." for native, otherwise target alias.
|
||||
if [ "${with_target_subdir}" = "." ]; then
|
||||
if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
|
||||
ml_toplevel_p=yes
|
||||
fi
|
||||
else
|
||||
if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
|
||||
ml_toplevel_p=yes
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
|
||||
if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
|
||||
ml_toplevel_p=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If this is the library's top level directory, set multidirs to the
|
||||
# multilib subdirs to support. This lives at the top because we need
|
||||
# `multidirs' set right away.
|
||||
|
||||
if [ "${ml_toplevel_p}" = yes ]; then
|
||||
|
||||
multidirs=
|
||||
for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
|
||||
dir=`echo $i | sed -e 's/;.*$//'`
|
||||
if [ "${dir}" = "." ]; then
|
||||
true
|
||||
else
|
||||
if [ -z "${multidirs}" ]; then
|
||||
multidirs="${dir}"
|
||||
else
|
||||
multidirs="${multidirs} ${dir}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Target libraries are configured for the host they run on, so we check
|
||||
# $host here, not $target.
|
||||
|
||||
case "${host}" in
|
||||
arm-*-*)
|
||||
if [ x"$enable_fpu" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*fpu*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_26bit" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*26bit*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_underscore" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*under*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_interwork" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*interwork*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_biendian = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*le* ) : ;;
|
||||
*be* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_nofmult" = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*nofmult* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
m68*-*-*)
|
||||
if [ x$enable_softfloat = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*soft-float* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_m68881 = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*m68881* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_m68000 = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*m68000* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_m68020 = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*m68020* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
mips*-*-*)
|
||||
if [ x$enable_single_float = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*single* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_biendian = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*el* ) : ;;
|
||||
*eb* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_softfloat = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*soft-float* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
powerpc*-*-* | rs6000*-*-*)
|
||||
if [ x$enable_aix64 = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*ppc64* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_pthread = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*pthread* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_softfloat = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*soft-float* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_powercpu = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
power | */power | */power/* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_powerpccpu = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*powerpc* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_powerpcos = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*mcall-linux* | *mcall-solaris* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_biendian = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*mlittle* | *mbig* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_sysv = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*mcall-sysv* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Remove extraneous blanks from multidirs.
|
||||
# Tests like `if [ -n "$multidirs" ]' require it.
|
||||
multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'`
|
||||
|
||||
# Add code to library's top level makefile to handle building the multilib
|
||||
# subdirs.
|
||||
|
||||
cat > Multi.tem <<\EOF
|
||||
|
||||
PWD_COMMAND=$${PWDCMD-pwd}
|
||||
|
||||
# FIXME: There should be an @-sign in front of the `if'.
|
||||
# Leave out until this is tested a bit more.
|
||||
multi-do:
|
||||
if [ -z "$(MULTIDIRS)" ]; then \
|
||||
true; \
|
||||
else \
|
||||
rootpre=`${PWD_COMMAND}`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
|
||||
lib=`echo "$${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
|
||||
compiler="$(CC)"; \
|
||||
for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
|
||||
dir=`echo $$i | sed -e 's/;.*$$//'`; \
|
||||
if [ "$${dir}" = "." ]; then \
|
||||
true; \
|
||||
else \
|
||||
if [ -d ../$${dir}/$${lib} ]; then \
|
||||
flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
|
||||
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
|
||||
CFLAGS="$(CFLAGS) $${flags}" \
|
||||
CCASFLAGS="$(CCASFLAGS) $${flags}" \
|
||||
FCFLAGS="$(FCFLAGS) $${flags}" \
|
||||
FFLAGS="$(FFLAGS) $${flags}" \
|
||||
ADAFLAGS="$(ADAFLAGS) $${flags}" \
|
||||
prefix="$(prefix)" \
|
||||
exec_prefix="$(exec_prefix)" \
|
||||
GCJFLAGS="$(GCJFLAGS) $${flags}" \
|
||||
GOCFLAGS="$(GOCFLAGS) $${flags}" \
|
||||
CXXFLAGS="$(CXXFLAGS) $${flags}" \
|
||||
LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
|
||||
LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
|
||||
LDFLAGS="$(LDFLAGS) $${flags}" \
|
||||
MULTIFLAGS="$${flags}" \
|
||||
DESTDIR="$(DESTDIR)" \
|
||||
INSTALL="$(INSTALL)" \
|
||||
INSTALL_DATA="$(INSTALL_DATA)" \
|
||||
INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
|
||||
INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \
|
||||
$(DO)); then \
|
||||
true; \
|
||||
else \
|
||||
exit 1; \
|
||||
fi; \
|
||||
else true; \
|
||||
fi; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
# FIXME: There should be an @-sign in front of the `if'.
|
||||
# Leave out until this is tested a bit more.
|
||||
multi-clean:
|
||||
if [ -z "$(MULTIDIRS)" ]; then \
|
||||
true; \
|
||||
else \
|
||||
lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
|
||||
for dir in : $(MULTIDIRS); do \
|
||||
test $$dir != : || continue; \
|
||||
EOF
|
||||
cat >>Multi.tem <<EOF
|
||||
if [ -f ../\$\${dir}/\$\${lib}/${Makefile} ]; then \\
|
||||
EOF
|
||||
cat >>Multi.tem <<\EOF
|
||||
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
|
||||
then true; \
|
||||
else exit 1; \
|
||||
fi; \
|
||||
else true; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
EOF
|
||||
|
||||
cat ${Makefile} Multi.tem > Makefile.tem
|
||||
rm -f ${Makefile} Multi.tem
|
||||
mv Makefile.tem ${Makefile}
|
||||
|
||||
fi # ${ml_toplevel_p} = yes
|
||||
|
||||
if [ "${ml_verbose}" = --verbose ]; then
|
||||
echo "Adding multilib support to ${Makefile} in ${ml_realsrcdir}"
|
||||
if [ "${ml_toplevel_p}" = yes ]; then
|
||||
echo "multidirs=${multidirs}"
|
||||
fi
|
||||
echo "with_multisubdir=${with_multisubdir}"
|
||||
fi
|
||||
|
||||
if [ "${srcdir}" = "." ]; then
|
||||
if [ "${with_target_subdir}" != "." ]; then
|
||||
ml_srcdotdot="../"
|
||||
else
|
||||
ml_srcdotdot=""
|
||||
fi
|
||||
else
|
||||
ml_srcdotdot=""
|
||||
fi
|
||||
|
||||
if [ -z "${with_multisubdir}" ]; then
|
||||
ml_subdir=
|
||||
ml_builddotdot=
|
||||
: # ml_srcdotdot= # already set
|
||||
else
|
||||
ml_subdir="/${with_multisubdir}"
|
||||
# The '[^/][^/]*' appears that way to work around a SunOS sed bug.
|
||||
ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/
|
||||
if [ "$srcdir" = "." ]; then
|
||||
ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot}
|
||||
else
|
||||
: # ml_srcdotdot= # already set
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${ml_toplevel_p}" = yes ]; then
|
||||
ml_do='$(MAKE)'
|
||||
ml_clean='$(MAKE)'
|
||||
else
|
||||
ml_do=true
|
||||
ml_clean=true
|
||||
fi
|
||||
|
||||
# TOP is used by newlib and should not be used elsewhere for this purpose.
|
||||
# MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty
|
||||
# when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s.
|
||||
# FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can
|
||||
# delete TOP. Newlib may wish to continue to use TOP for its own purposes
|
||||
# of course.
|
||||
# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
|
||||
# and lists the subdirectories to recurse into.
|
||||
# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
|
||||
# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
|
||||
# a leading '/'.
|
||||
# MULTIDO is used for targets like all, install, and check where
|
||||
# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
|
||||
# MULTICLEAN is used for the *clean targets.
|
||||
#
|
||||
# ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are
|
||||
# currently kept separate because we don't want the *clean targets to require
|
||||
# the existence of the compiler (which MULTIDO currently requires) and
|
||||
# therefore we'd have to record the directory options as well as names
|
||||
# (currently we just record the names and use --print-multi-lib to get the
|
||||
# options).
|
||||
|
||||
sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \
|
||||
-e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \
|
||||
-e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \
|
||||
-e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \
|
||||
-e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \
|
||||
-e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \
|
||||
-e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \
|
||||
${Makefile} > Makefile.tem
|
||||
rm -f ${Makefile}
|
||||
mv Makefile.tem ${Makefile}
|
||||
|
||||
# If this is the library's top level, configure each multilib subdir.
|
||||
# This is done at the end because this is the loop that runs configure
|
||||
# in each multilib subdir and it seemed reasonable to finish updating the
|
||||
# Makefile before going on to configure the subdirs.
|
||||
|
||||
if [ "${ml_toplevel_p}" = yes ]; then
|
||||
|
||||
# We must freshly configure each subdirectory. This bit of code is
|
||||
# actually partially stolen from the main configure script. FIXME.
|
||||
|
||||
if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
|
||||
|
||||
if [ "${ml_verbose}" = --verbose ]; then
|
||||
echo "Running configure in multilib subdirs ${multidirs}"
|
||||
echo "pwd: `${PWDCMD-pwd}`"
|
||||
fi
|
||||
|
||||
ml_origdir=`${PWDCMD-pwd}`
|
||||
ml_libdir=`echo "$ml_origdir" | sed -e 's,^.*/,,'`
|
||||
# cd to top-level-build-dir/${with_target_subdir}
|
||||
cd ..
|
||||
|
||||
for ml_dir in ${multidirs}; do
|
||||
|
||||
if [ "${ml_verbose}" = --verbose ]; then
|
||||
echo "Running configure in multilib subdir ${ml_dir}"
|
||||
echo "pwd: `${PWDCMD-pwd}`"
|
||||
fi
|
||||
|
||||
if [ -d ${ml_dir} ]; then true; else
|
||||
# ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
|
||||
pathcomp=""
|
||||
for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
|
||||
fi
|
||||
if test ! -d "$pathcomp"; then
|
||||
exit $lasterr
|
||||
fi
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
fi
|
||||
if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
|
||||
|
||||
# Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
|
||||
dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
|
||||
|
||||
case ${srcdir} in
|
||||
".")
|
||||
echo "Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}"
|
||||
if [ "${with_target_subdir}" != "." ]; then
|
||||
ml_unsubdir="../"
|
||||
else
|
||||
ml_unsubdir=""
|
||||
fi
|
||||
(cd ${ml_dir}/${ml_libdir};
|
||||
../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
|
||||
if [ -f ${ml_dir}/${ml_libdir}/${Makefile} ]; then
|
||||
if [ x"${MAKE}" = x ]; then
|
||||
(cd ${ml_dir}/${ml_libdir}; make distclean)
|
||||
else
|
||||
(cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
|
||||
fi
|
||||
fi
|
||||
ml_newsrcdir="."
|
||||
ml_srcdiroption=
|
||||
multisrctop=${dotdot}
|
||||
;;
|
||||
*)
|
||||
case "${srcdir}" in
|
||||
/* | [A-Za-z]:[\\/]* ) # absolute path
|
||||
ml_newsrcdir=${srcdir}
|
||||
;;
|
||||
*) # otherwise relative
|
||||
ml_newsrcdir=${dotdot}${srcdir}
|
||||
;;
|
||||
esac
|
||||
ml_srcdiroption="-srcdir=${ml_newsrcdir}"
|
||||
multisrctop=
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${progname}" in
|
||||
/* | [A-Za-z]:[\\/]* ) ml_recprog=${progname} ;;
|
||||
*) ml_recprog=${dotdot}${progname} ;;
|
||||
esac
|
||||
|
||||
# FIXME: POPDIR=${PWD=`pwd`} doesn't work here.
|
||||
ML_POPDIR=`${PWDCMD-pwd}`
|
||||
cd ${ml_dir}/${ml_libdir}
|
||||
|
||||
if [ -f ${ml_newsrcdir}/configure ]; then
|
||||
ml_recprog="${ml_newsrcdir}/configure"
|
||||
fi
|
||||
|
||||
# find compiler flag corresponding to ${ml_dir}
|
||||
for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
|
||||
dir=`echo $i | sed -e 's/;.*$//'`
|
||||
if [ "${dir}" = "${ml_dir}" ]; then
|
||||
flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
|
||||
break
|
||||
fi
|
||||
done
|
||||
ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags" GOC="${GOC_}$flags"'
|
||||
|
||||
if [ "${with_target_subdir}" = "." ]; then
|
||||
CC_=$CC' '
|
||||
CXX_=$CXX' '
|
||||
F77_=$F77' '
|
||||
GCJ_=$GCJ' '
|
||||
GFORTRAN_=$GFORTRAN' '
|
||||
GOC_=$GOC' '
|
||||
else
|
||||
# Create a regular expression that matches any string as long
|
||||
# as ML_POPDIR.
|
||||
popdir_rx=`echo "${ML_POPDIR}" | sed 's,.,.,g'`
|
||||
CC_=
|
||||
for arg in ${CC}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
CC_="${CC_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
CXX_=
|
||||
for arg in ${CXX}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
CXX_="${CXX_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
F77_=
|
||||
for arg in ${F77}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
F77_="${F77_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
GCJ_=
|
||||
for arg in ${GCJ}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
GCJ_="${GCJ_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
GFORTRAN_=
|
||||
for arg in ${GFORTRAN}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
GFORTRAN_="${GFORTRAN_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
GOC_=
|
||||
for arg in ${GOC}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
GOC_="${GOC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
GOC_="${GOC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
GOC_="${GOC_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "x${LD_LIBRARY_PATH+set}" = xset; then
|
||||
LD_LIBRARY_PATH_=
|
||||
for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
|
||||
case "$arg" in
|
||||
"${ML_POPDIR}"/*)
|
||||
arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
|
||||
;;
|
||||
esac
|
||||
if test "x$LD_LIBRARY_PATH_" != x; then
|
||||
LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
|
||||
else
|
||||
LD_LIBRARY_PATH_=$arg
|
||||
fi
|
||||
done
|
||||
ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
|
||||
fi
|
||||
|
||||
if test "x${SHLIB_PATH+set}" = xset; then
|
||||
SHLIB_PATH_=
|
||||
for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
|
||||
case "$arg" in
|
||||
"${ML_POPDIR}"/*)
|
||||
arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
|
||||
;;
|
||||
esac
|
||||
if test "x$SHLIB_PATH_" != x; then
|
||||
SHLIB_PATH_=$SHLIB_PATH_:$arg
|
||||
else
|
||||
SHLIB_PATH_=$arg
|
||||
fi
|
||||
done
|
||||
ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
|
||||
--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
|
||||
${ac_configure_args} ${ml_config_env} ${ml_srcdiroption} ; then
|
||||
true
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "${ML_POPDIR}"
|
||||
|
||||
done
|
||||
|
||||
cd "${ml_origdir}"
|
||||
fi
|
||||
|
||||
fi # ${ml_toplevel_p} = yes
|
||||
fi # ${enable_multilib} = yes
|
1517
newlib/src/config.guess
vendored
Executable file
1517
newlib/src/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
543
newlib/src/config.rpath
Executable file
543
newlib/src/config.rpath
Executable file
|
@ -0,0 +1,543 @@
|
|||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2003 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# Known limitations:
|
||||
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
||||
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
||||
# known workaround is to choose shorter directory names for the build
|
||||
# directory and/or the installation directory.
|
||||
|
||||
# All known linkers require a `.a' archive for static linking (except M$VC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shrext=.so
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
mingw* | pw32* | os2*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
newsos6)
|
||||
;;
|
||||
linux*)
|
||||
case $CC in
|
||||
icc|ecc)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
ccc)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sco3.2v5*)
|
||||
;;
|
||||
solaris*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
;;
|
||||
uts4*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
case "$host_os" in
|
||||
aix[3-9]*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we can use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
;;
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = yes; then
|
||||
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
||||
# option of GNU ld is called -rpath, not --rpath.
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix[4-9]*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
esac
|
||||
fi
|
||||
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
${CC} ${LDFLAGS} conftest.c -o conftest
|
||||
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
fi
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath="/usr/lib:/lib"
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
# End _LT_AC_SYS_LIBPATH_AIX.
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
bsdi4*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
|
||||
hardcode_direct=no
|
||||
fi
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
freebsd2.2*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
hpux10* | hpux11*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
case "$host_cpu" in
|
||||
hppa*64*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=no
|
||||
;;
|
||||
ia64*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=no
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
openbsd*)
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
sco3.2v5*)
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
case $host_vendor in
|
||||
sni)
|
||||
hardcode_direct=yes # is this really true???
|
||||
;;
|
||||
siemens)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
motorola)
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4.2uw2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=no
|
||||
;;
|
||||
sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
|
||||
;;
|
||||
sysv5*)
|
||||
hardcode_libdir_flag_spec=
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
|
||||
libname_spec='lib$name'
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
;;
|
||||
aix[4-9]*)
|
||||
;;
|
||||
amigaos*)
|
||||
;;
|
||||
beos*)
|
||||
;;
|
||||
bsdi4*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
shrext=.dll
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shrext=.dylib
|
||||
;;
|
||||
dgux*)
|
||||
;;
|
||||
freebsd*)
|
||||
;;
|
||||
gnu*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case "$host_cpu" in
|
||||
ia64*)
|
||||
shrext=.so
|
||||
;;
|
||||
hppa*64*)
|
||||
shrext=.sl
|
||||
;;
|
||||
*)
|
||||
shrext=.sl
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
case "$host_os" in
|
||||
irix5* | nonstopux*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
linux*oldld* | linux*aout* | linux*coff*)
|
||||
;;
|
||||
linux*)
|
||||
;;
|
||||
netbsd*)
|
||||
;;
|
||||
newsos6)
|
||||
;;
|
||||
nto-qnx)
|
||||
;;
|
||||
openbsd*)
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shrext=.dll
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
;;
|
||||
sco3.2v5*)
|
||||
;;
|
||||
solaris*)
|
||||
;;
|
||||
sunos4*)
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
;;
|
||||
sysv4*MP*)
|
||||
;;
|
||||
uts4*)
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
EOF
|
1767
newlib/src/config.sub
vendored
Executable file
1767
newlib/src/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
1656
newlib/src/config/ChangeLog
Normal file
1656
newlib/src/config/ChangeLog
Normal file
File diff suppressed because it is too large
Load diff
746
newlib/src/config/acinclude.m4
Executable file
746
newlib/src/config/acinclude.m4
Executable file
|
@ -0,0 +1,746 @@
|
|||
dnl This file is included into all any other acinclude file that needs
|
||||
dnl to use these macros.
|
||||
|
||||
dnl This is copied from autoconf 2.12, but does calls our own AC_PROG_CC_WORKS,
|
||||
dnl and doesn't call AC_PROG_CXX_GNU, cause we test for that in AC_PROG_CC_WORKS.
|
||||
dnl We are probably using a cross compiler, which will not be able to fully
|
||||
dnl link an executable. This should really be fixed in autoconf itself.
|
||||
dnl Find a working G++ cross compiler. This only works for the GNU C++ compiler.
|
||||
AC_DEFUN([CYG_AC_PROG_CXX_CROSS],
|
||||
[AC_BEFORE([$0], [AC_PROG_CXXCPP])
|
||||
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
|
||||
|
||||
CYG_AC_PROG_GXX_WORKS
|
||||
|
||||
if test $ac_cv_prog_gxx = yes; then
|
||||
GXX=yes
|
||||
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
|
||||
dnl plays around with CXXFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CXXFLAGS="${CXXFLAGS+set}"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS=
|
||||
AC_PROG_CXX_G
|
||||
if test "$ac_test_CXXFLAGS" = set; then
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
elif test $ac_cv_prog_cxx_g = yes; then
|
||||
CXXFLAGS="-g -O2"
|
||||
else
|
||||
CXXFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GXX=
|
||||
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
dnl See if the G++ compiler we found works.
|
||||
AC_DEFUN([CYG_AC_PROG_GXX_WORKS],
|
||||
[AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually works])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
dnl Try a test case. We only compile, because it's close to impossible
|
||||
dnl to get a correct fully linked executable with a cross compiler. For
|
||||
dnl most cross compilers, this test is bogus. For G++, we can use various
|
||||
dnl other compile line options to get a decent idea that the cross compiler
|
||||
dnl actually does work, even though we can't produce an executable without
|
||||
dnl more info about the target it's being compiled for. This only works
|
||||
dnl for the GNU C++ compiler.
|
||||
|
||||
dnl Transform the name of the compiler to it's cross variant, unless
|
||||
dnl CXX is set. This is also what CXX gets set to in the generated
|
||||
dnl Makefile.
|
||||
if test x"${CXX}" = xc++ ; then
|
||||
CXX=`echo gcc | sed -e "${program_transform_name}"`
|
||||
fi
|
||||
|
||||
dnl Get G++'s full path to libgcc.a
|
||||
libgccpath=`${CXX} --print-libgcc`
|
||||
|
||||
dnl If we don't have a path with libgcc.a on the end, this isn't G++.
|
||||
if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
|
||||
ac_cv_prog_gxx=yes
|
||||
else
|
||||
ac_cv_prog_gxx=no
|
||||
fi
|
||||
|
||||
dnl If we are using G++, look for the files that need to exist if this
|
||||
dnl compiler works.
|
||||
if test x"${ac_cv_prog_gxx}" = xyes ; then
|
||||
gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
|
||||
if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
|
||||
gccfiles=yes
|
||||
else
|
||||
gccfiles=no
|
||||
fi
|
||||
gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
|
||||
if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
|
||||
gcclibs=yes
|
||||
else
|
||||
gcclibs=no
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl If everything is OK, then we can safely assume the compiler works.
|
||||
if test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
|
||||
ac_cv_prog_cxx_works=no
|
||||
AC_MSG_ERROR(${CXX} is a non-working cross compiler)
|
||||
else
|
||||
ac_cv_prog_cxx_works=yes
|
||||
fi
|
||||
|
||||
AC_LANG_RESTORE
|
||||
AC_MSG_RESULT($ac_cv_prog_cxx_works)
|
||||
if test x"$ac_cv_prog_cxx_works" = xno; then
|
||||
AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
|
||||
fi
|
||||
AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
|
||||
AC_MSG_RESULT($ac_cv_prog_cxx_cross)
|
||||
cross_compiling=$ac_cv_prog_cxx_cross
|
||||
AC_SUBST(CXX)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Find a working GCC cross compiler. This only works for the GNU gcc compiler.
|
||||
dnl This is based on the macros above for G++.
|
||||
AC_DEFUN([CYG_AC_PROG_CC_CROSS],
|
||||
[AC_BEFORE([$0], [AC_PROG_CCPP])
|
||||
AC_CHECK_PROGS(CC, cc, gcc)
|
||||
|
||||
CYG_AC_PROG_GCC_WORKS
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GXX=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
dnl See if the GCC compiler we found works.
|
||||
AC_DEFUN([CYG_AC_PROG_GCC_WORKS],
|
||||
[AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) actually works])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
dnl Try a test case. We only compile, because it's close to impossible
|
||||
dnl to get a correct fully linked executable with a cross
|
||||
dnl compiler. For most cross compilers, this test is bogus. For G++,
|
||||
dnl we can use various other compile line options to get a decent idea
|
||||
dnl that the cross compiler actually does work, even though we can't
|
||||
dnl produce an executable without more info about the target it's
|
||||
dnl being compiled for. This only works for the GNU C++ compiler.
|
||||
|
||||
dnl Transform the name of the compiler to it's cross variant, unless
|
||||
dnl CXX is set. This is also what CC gets set to in the generated Makefile.
|
||||
if test x"${CC}" = xcc ; then
|
||||
CC=`echo gcc | sed -e "${program_transform_name}"`
|
||||
fi
|
||||
|
||||
dnl Get Gcc's full path to libgcc.a
|
||||
libgccpath=`${CC} --print-libgcc`
|
||||
|
||||
dnl If we don't have a path with libgcc.a on the end, this isn't G++.
|
||||
if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
|
||||
ac_cv_prog_gcc=yes
|
||||
else
|
||||
ac_cv_prog_gcc=no
|
||||
fi
|
||||
|
||||
dnl If we are using Gcc, look for the files that need to exist if this
|
||||
dnl compiler works.
|
||||
if test x"${ac_cv_prog_gcc}" = xyes ; then
|
||||
gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
|
||||
if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
|
||||
gccfiles=yes
|
||||
else
|
||||
gccfiles=no
|
||||
fi
|
||||
gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
|
||||
if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
|
||||
gcclibs=yes
|
||||
else
|
||||
gcclibs=no
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl If everything is OK, then we can safely assume the compiler works.
|
||||
if test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
|
||||
ac_cv_prog_cc_works=no
|
||||
AC_MSG_ERROR(${CC} is a non-working cross compiler)
|
||||
else
|
||||
ac_cv_prog_cc_works=yes
|
||||
fi
|
||||
|
||||
AC_LANG_RESTORE
|
||||
AC_MSG_RESULT($ac_cv_prog_cc_works)
|
||||
if test x"$ac_cv_prog_cc_works" = xno; then
|
||||
AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
|
||||
fi
|
||||
AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
|
||||
AC_MSG_RESULT($ac_cv_prog_cc_cross)
|
||||
cross_compiling=$ac_cv_prog_cc_cross
|
||||
AC_SUBST(CC)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Find the BFD library in the build tree. This is used to access and
|
||||
dnl manipulate object or executable files.
|
||||
AC_DEFUN([CYG_AC_PATH_BFD], [
|
||||
AC_MSG_CHECKING(for the bfd header in the build tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
dnl Look for the header file
|
||||
AC_CACHE_VAL(ac_cv_c_bfdh,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/bfd/bfd.h" ; then
|
||||
ac_cv_c_bfdh=`(cd $i/bfd; ${PWDCMD-pwd})`
|
||||
break
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_bfdh}" != x; then
|
||||
BFDHDIR="-I${ac_cv_c_bfdh}"
|
||||
AC_MSG_RESULT(${ac_cv_c_bfdh})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(BFDHDIR)
|
||||
|
||||
dnl Look for the library
|
||||
AC_MSG_CHECKING(for the bfd library in the build tree)
|
||||
AC_CACHE_VAL(ac_cv_c_bfdlib,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/bfd/Makefile" ; then
|
||||
ac_cv_c_bfdlib=`(cd $i/bfd; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
dnl We list two directories cause bfd now uses libtool
|
||||
if test x"${ac_cv_c_bfdlib}" != x; then
|
||||
BFDLIB="-L${ac_cv_c_bfdlib} -L${ac_cv_c_bfdlib}/.libs"
|
||||
AC_MSG_RESULT(${ac_cv_c_bfdlib})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(BFDLIB)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Find the libiberty library. This defines many commonly used C
|
||||
dnl functions that exists in various states based on the underlying OS.
|
||||
AC_DEFUN([CYG_AC_PATH_LIBERTY], [
|
||||
AC_MSG_CHECKING(for the liberty library in the build tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
AC_CACHE_VAL(ac_cv_c_liberty,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/libiberty/Makefile" ; then
|
||||
ac_cv_c_liberty=`(cd $i/libiberty; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_liberty}" != x; then
|
||||
LIBERTY="-L${ac_cv_c_liberty}"
|
||||
AC_MSG_RESULT(${ac_cv_c_liberty})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(LIBERTY)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Find the opcodes library. This is used to do dissasemblies.
|
||||
AC_DEFUN([CYG_AC_PATH_OPCODES], [
|
||||
AC_MSG_CHECKING(for the opcodes library in the build tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
AC_CACHE_VAL(ac_cv_c_opc,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/opcodes/Makefile" ; then
|
||||
ac_cv_c_opc=`(cd $i/opcodes; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_opc}" != x; then
|
||||
OPCODESLIB="-L${ac_cv_c_opc}"
|
||||
AC_MSG_RESULT(${ac_cv_c_opc})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(OPCODESLIB)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Look for the DejaGnu header file in the source tree. This file
|
||||
dnl defines the functions used to testing support.
|
||||
AC_DEFUN([CYG_AC_PATH_DEJAGNU], [
|
||||
AC_MSG_CHECKING(for the testing support files in the source tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
AC_CACHE_VAL(ac_cv_c_dejagnu,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$srcdir/$i/ecc/ecc/infra/testlib/current/include/dejagnu.h" ; then
|
||||
ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_dejagnu}" != x; then
|
||||
DEJAGNUHDIR="-I${ac_cv_c_dejagnu}"
|
||||
AC_MSG_RESULT(${ac_cv_c_dejagnu})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_c_dejagnulib,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$srcdir/$i/infra/testlib/current/lib/hostutil.exp" ; then
|
||||
ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_dejagnulib}" != x; then
|
||||
DEJAGNULIB="${ac_cv_c_dejagnulib}"
|
||||
else
|
||||
DEJAGNULIB=""
|
||||
fi
|
||||
AC_MSG_CHECKING(for runtest in the source tree)
|
||||
AC_CACHE_VAL(ac_cv_c_runtest,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$srcdir/$i/dejagnu/runtest" ; then
|
||||
ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_runtest}" != x; then
|
||||
RUNTESTDIR="${ac_cv_c_runtest}"
|
||||
AC_MSG_RESULT(${ac_cv_c_runtest})
|
||||
else
|
||||
RUNTESTDIR=""
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(RUNTESTDIR)
|
||||
AC_SUBST(DEJAGNULIB)
|
||||
AC_SUBST(DEJAGNUHDIR)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Find the libintl library in the build tree. This is for
|
||||
dnl internationalization support.
|
||||
AC_DEFUN([CYG_AC_PATH_INTL], [
|
||||
AC_MSG_CHECKING(for the intl header in the build tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
dnl Look for the header file
|
||||
AC_CACHE_VAL(ac_cv_c_intlh,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/intl/libintl.h" ; then
|
||||
ac_cv_c_intlh=`(cd $i/intl; ${PWDCMD-pwd})`
|
||||
break
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_intlh}" != x; then
|
||||
INTLHDIR="-I${ac_cv_c_intlh}"
|
||||
AC_MSG_RESULT(${ac_cv_c_intlh})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(INTLHDIR)
|
||||
|
||||
dnl Look for the library
|
||||
AC_MSG_CHECKING(for the libintl library in the build tree)
|
||||
AC_CACHE_VAL(ac_cv_c_intllib,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/intl/Makefile" ; then
|
||||
ac_cv_c_intllib=`(cd $i/intl; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_intllib}" != x; then
|
||||
INTLLIB="-L${ac_cv_c_intllib} -lintl"
|
||||
AC_MSG_RESULT(${ac_cv_c_intllib})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(INTLLIB)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Find the simulator library.
|
||||
AC_DEFUN([CYG_AC_PATH_SIM], [
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.."
|
||||
case "$target_cpu" in
|
||||
powerpc) target_dir=ppc ;;
|
||||
sparc*) target_dir=erc32 ;;
|
||||
mips*) target_dir=mips ;;
|
||||
*) target_dir=$target_cpu ;;
|
||||
esac
|
||||
dnl First look for the header file
|
||||
AC_MSG_CHECKING(for the simulator header file)
|
||||
AC_CACHE_VAL(ac_cv_c_simh,[
|
||||
for i in $dirlist; do
|
||||
if test -f "${srcdir}/$i/include/remote-sim.h" ; then
|
||||
ac_cv_c_simh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
|
||||
break
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_simh}" != x; then
|
||||
SIMHDIR="-I${ac_cv_c_simh}"
|
||||
AC_MSG_RESULT(${ac_cv_c_simh})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(SIMHDIR)
|
||||
|
||||
dnl See whether it's a devo or Foundry branch simulator
|
||||
AC_MSG_CHECKING(Whether this is a devo simulator )
|
||||
AC_CACHE_VAL(ac_cv_c_simdevo,[
|
||||
CPPFLAGS="$CPPFLAGS $SIMHDIR"
|
||||
AC_EGREP_HEADER([SIM_DESC sim_open.*struct _bfd], remote-sim.h,
|
||||
ac_cv_c_simdevo=yes,
|
||||
ac_cv_c_simdevo=no)
|
||||
])
|
||||
if test x"$ac_cv_c_simdevo" = x"yes" ; then
|
||||
AC_DEFINE(HAVE_DEVO_SIM)
|
||||
fi
|
||||
AC_MSG_RESULT(${ac_cv_c_simdevo})
|
||||
AC_SUBST(HAVE_DEVO_SIM)
|
||||
|
||||
dnl Next look for the library
|
||||
AC_MSG_CHECKING(for the simulator library)
|
||||
AC_CACHE_VAL(ac_cv_c_simlib,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/sim/$target_dir/Makefile" ; then
|
||||
ac_cv_c_simlib=`(cd $i/sim/$target_dir; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_simlib}" != x; then
|
||||
SIMLIB="-L${ac_cv_c_simlib}"
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
dnl FIXME: this is kinda bogus, cause umtimately the TM will build
|
||||
dnl all the libraries for several architectures. But for now, this
|
||||
dnl will work till then.
|
||||
dnl AC_MSG_CHECKING(for the simulator installed with the compiler libraries)
|
||||
dnl Transform the name of the compiler to it's cross variant, unless
|
||||
dnl CXX is set. This is also what CXX gets set to in the generated
|
||||
dnl Makefile.
|
||||
CROSS_GCC=`echo gcc | sed -e "s/^/$target/"`
|
||||
|
||||
dnl Get G++'s full path to libgcc.a
|
||||
changequote(,)
|
||||
gccpath=`${CROSS_GCC} --print-libgcc | sed -e 's:[a-z0-9A-Z\.\-]*/libgcc.a::' -e 's:lib/gcc-lib/::'`lib
|
||||
changequote([,])
|
||||
if test -f $gccpath/libsim.a -o -f $gccpath/libsim.so ; then
|
||||
ac_cv_c_simlib="$gccpath/"
|
||||
SIMLIB="-L${ac_cv_c_simlib}"
|
||||
AC_MSG_RESULT(${ac_cv_c_simlib})
|
||||
else
|
||||
AM_CONDITIONAL(PSIM, test x$psim = xno)
|
||||
SIMLIB=""
|
||||
AC_MSG_RESULT(none)
|
||||
dnl ac_cv_c_simlib=none
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(SIMLIB)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Find the libiberty library.
|
||||
AC_DEFUN([CYG_AC_PATH_LIBIBERTY], [
|
||||
AC_MSG_CHECKING(for the libiberty library in the build tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
AC_CACHE_VAL(ac_cv_c_libib,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/libiberty/Makefile" ; then
|
||||
ac_cv_c_libib=`(cd $i/libiberty/; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_libib}" != x; then
|
||||
LIBIBERTY="-L${ac_cv_c_libib}"
|
||||
AC_MSG_RESULT(${ac_cv_c_libib})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(LIBIBERTY)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
AC_DEFUN([CYG_AC_PATH_DEVO], [
|
||||
AC_MSG_CHECKING(for devo headers in the source tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
AC_CACHE_VAL(ac_cv_c_devoh,[
|
||||
for i in $dirlist; do
|
||||
if test -f "${srcdir}/$i/include/remote-sim.h" ; then
|
||||
ac_cv_c_devoh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_devoh}" != x; then
|
||||
DEVOHDIR="-I${ac_cv_c_devoh}"
|
||||
AC_MSG_RESULT(${ac_cv_c_devoh})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
AC_SUBST(DEVOHDIR)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Find all the ILU headers and libraries
|
||||
AC_DEFUN([CYG_AC_PATH_ILU], [
|
||||
AC_MSG_CHECKING(for ILU kernel headers in the source tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
AC_CACHE_VAL(ac_cv_c_iluh,[
|
||||
for i in $dirlist; do
|
||||
if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then
|
||||
ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_iluh}" != x; then
|
||||
ILUHDIR="-I${ac_cv_c_iluh}"
|
||||
AC_MSG_RESULT(${ac_cv_c_iluh})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for ILU kernel headers in the build tree)
|
||||
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
|
||||
AC_CACHE_VAL(ac_cv_c_iluh5,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then
|
||||
ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_iluh5}" != x; then
|
||||
ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh5}"
|
||||
AC_MSG_RESULT(${ac_cv_c_iluh5})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for ILU C++ headers in the source tree)
|
||||
AC_CACHE_VAL(ac_cv_c_iluh2,[
|
||||
for i in $dirlist; do
|
||||
if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then
|
||||
ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_iluh2}" != x; then
|
||||
ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh2}"
|
||||
AC_MSG_RESULT(${ac_cv_c_iluh2})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for ILU C headers)
|
||||
AC_CACHE_VAL(ac_cv_c_iluh3,[
|
||||
for i in $dirlist; do
|
||||
if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then
|
||||
ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c ; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_iluh3}" != x; then
|
||||
ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh3}"
|
||||
AC_MSG_RESULT(${ac_cv_c_iluh3})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for ILU C runtime headers)
|
||||
AC_CACHE_VAL(ac_cv_c_iluh4,[
|
||||
for i in $dirlist; do
|
||||
if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then
|
||||
ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c ; ${PWDCMD-pwd})`
|
||||
fi
|
||||
done
|
||||
])
|
||||
if test x"${ac_cv_c_iluh4}" != x; then
|
||||
ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh4}"
|
||||
AC_MSG_RESULT(${ac_cv_c_iluh4})
|
||||
else
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
|
||||
AC_CACHE_VAL(ac_cv_c_ilupath,[
|
||||
for i in $dirlist; do
|
||||
if test -f "$i/ilu/Makefile" ; then
|
||||
ac_cv_c_ilupath=`(cd $i/ilu; ${PWDCMD-pwd})`
|
||||
break
|
||||
fi
|
||||
done
|
||||
])
|
||||
ILUTOP=${ac_cv_c_ilupath}
|
||||
|
||||
AC_MSG_CHECKING(for the ILU library in the build tree)
|
||||
AC_CACHE_VAL(ac_cv_c_ilulib,[
|
||||
if test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then
|
||||
ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; ${PWDCMD-pwd})`
|
||||
AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
|
||||
AC_CACHE_VAL(ac_cv_c_ilulib2,[
|
||||
if test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then
|
||||
ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; ${PWDCMD-pwd})`
|
||||
AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING(for the ILU C bindings library in the build tree)
|
||||
AC_CACHE_VAL(ac_cv_c_ilulib3,[
|
||||
if test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then
|
||||
ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; ${PWDCMD-pwd})`
|
||||
AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
|
||||
AC_CACHE_VAL(ac_cv_c_ilulib4,[
|
||||
if test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then
|
||||
ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; ${PWDCMD-pwd})`
|
||||
AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi])
|
||||
|
||||
if test x"${ac_cv_c_ilulib}" = x -a x"${ac_cv_c_ilulib2}" = x; then
|
||||
ILUHDIR=""
|
||||
fi
|
||||
|
||||
if test x"${ac_cv_c_ilulib}" != x -a x"${ac_cv_c_ilulib2}" != x; then
|
||||
ILULIB="-L${ac_cv_c_ilulib} -L${ac_cv_c_ilulib2} -L${ac_cv_c_ilulib3} -L${ac_cv_c_ilulib4}"
|
||||
else
|
||||
ILULIB=""
|
||||
fi
|
||||
|
||||
if test x"${ILULIB}" = x; then
|
||||
AC_MSG_CHECKING(for ILU libraries installed with the compiler)
|
||||
AC_CACHE_VAL(ac_cv_c_ilulib5,[
|
||||
NATIVE_GCC=`echo gcc | sed -e "${program_transform_name}"`
|
||||
|
||||
dnl Get G++'s full path to it's libraries
|
||||
ac_cv_c_ilulib5=`${NATIVE_GCC} --print-libgcc | sed -e 's:lib/gcc-lib/.*::'`lib
|
||||
if test -f $ac_cv_c_ilulib5/libilu-c.a -o -f $ac_cv_c_ilulib5/libilu-c.so ; then
|
||||
if test x"${ILUHDIR}" = x; then
|
||||
ILUHDIR="-I${ac_cv_c_ilulib5}/../include"
|
||||
fi
|
||||
ILULIB="-L${ac_cv_c_ilulib5}"
|
||||
AC_MSG_RESULT(${ac_cv_c_ilulib5})
|
||||
else
|
||||
ac_cv_c_ilulib=none
|
||||
AC_MSG_RESULT(none)
|
||||
fi
|
||||
fi])
|
||||
AC_SUBST(ILUHDIR)
|
||||
AC_SUBST(ILULIB)
|
||||
AC_SUBST(ILUTOP)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl This defines the byte order for the host. We can't use
|
||||
dnl AC_C_BIGENDIAN, cause we want to create a config file and
|
||||
dnl substitue the real value, so the header files work right
|
||||
AC_DEFUN([CYG_AC_C_ENDIAN], [
|
||||
AC_MSG_CHECKING(to see if this is a little endian host)
|
||||
AC_CACHE_VAL(ac_cv_c_little_endian, [
|
||||
ac_cv_c_little_endian=unknown
|
||||
# See if sys/param.h defines the BYTE_ORDER macro.
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/param.h>], [
|
||||
#if !BYTE_ORDER || !_BIG_ENDIAN || !_LITTLE_ENDIAN
|
||||
bogus endian macros
|
||||
#endif], [# It does; now see whether it defined to _LITTLE_ENDIAN or not.
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/param.h>], [
|
||||
#if BYTE_ORDER != _LITTLE_ENDIAN
|
||||
not big endian
|
||||
#endif], ac_cv_c_little_endian=yes, ac_cv_c_little_endian=no)
|
||||
])
|
||||
if test ${ac_cv_c_little_endian} = unknown; then
|
||||
old_cflags=$CFLAGS
|
||||
CFLAGS=-g
|
||||
AC_TRY_RUN([
|
||||
main () {
|
||||
/* Are we little or big endian? From Harbison&Steele. */
|
||||
union
|
||||
{
|
||||
long l;
|
||||
char c[sizeof (long)];
|
||||
} u;
|
||||
u.l = 1;
|
||||
exit (u.c[0] == 1);
|
||||
}],
|
||||
ac_cv_c_little_endian=no,
|
||||
ac_cv_c_little_endian=yes,[
|
||||
dnl Yes, this is ugly, and only used for a canadian cross anyway. This
|
||||
dnl is just to keep configure from stopping here.
|
||||
case "${host}" in
|
||||
changequote(,)
|
||||
i[3456789]86-*-*) ac_cv_c_little_endian=yes ;;
|
||||
sparc*-*-*) ac_cv_c_little_endian=no ;;
|
||||
changequote([,])
|
||||
*) AC_MSG_WARN(Can't cross compile this test) ;;
|
||||
esac])
|
||||
CFLAGS=$old_cflags
|
||||
fi])
|
||||
|
||||
if test x"${ac_cv_c_little_endian}" = xyes; then
|
||||
AC_DEFINE(LITTLE_ENDIAN_HOST)
|
||||
ENDIAN="CYG_LSBFIRST";
|
||||
else
|
||||
ENDIAN="CYG_MSBFIRST";
|
||||
fi
|
||||
AC_MSG_RESULT(${ac_cv_c_little_endian})
|
||||
AC_SUBST(ENDIAN)
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Look for the path to libgcc, so we can use it to directly link
|
||||
dnl in libgcc.a with LD.
|
||||
AC_DEFUN([CYG_AC_PATH_LIBGCC],
|
||||
[AC_MSG_CHECKING([Looking for the path to libgcc.a])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
|
||||
dnl Get Gcc's full path to libgcc.a
|
||||
libgccpath=`${CC} --print-libgcc`
|
||||
|
||||
dnl If we don't have a path with libgcc.a on the end, this isn't G++.
|
||||
if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
|
||||
ac_cv_prog_gcc=yes
|
||||
else
|
||||
ac_cv_prog_gcc=no
|
||||
fi
|
||||
|
||||
dnl
|
||||
if test x"${ac_cv_prog_gcc}" = xyes ; then
|
||||
gccpath=`echo $libgccpath | sed -e 's:/libgcc.a::'`
|
||||
LIBGCC="-L${gccpath}"
|
||||
AC_MSG_RESULT(${gccpath})
|
||||
else
|
||||
LIBGCC=""
|
||||
AC_MSG_ERROR(Not using gcc)
|
||||
fi
|
||||
|
||||
AC_LANG_RESTORE
|
||||
AC_SUBST(LIBGCC)
|
||||
])
|
621
newlib/src/config/acx.m4
Normal file
621
newlib/src/config/acx.m4
Normal file
|
@ -0,0 +1,621 @@
|
|||
# Autoconf M4 include file defining utility macros for complex Canadian
|
||||
# cross builds.
|
||||
|
||||
dnl ####
|
||||
dnl # _GCC_TOPLEV_NONCANONICAL_BUILD
|
||||
dnl # $build_alias or canonical $build if blank.
|
||||
dnl # Used when we would use $build_alias, but empty is not OK.
|
||||
AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_BUILD],
|
||||
[AC_REQUIRE([AC_CANONICAL_BUILD]) []dnl
|
||||
case ${build_alias} in
|
||||
"") build_noncanonical=${build} ;;
|
||||
*) build_noncanonical=${build_alias} ;;
|
||||
esac
|
||||
]) []dnl # _GCC_TOPLEV_NONCANONICAL_BUILD
|
||||
|
||||
dnl ####
|
||||
dnl # _GCC_TOPLEV_NONCANONICAL_HOST
|
||||
dnl # $host_alias, or $build_noncanonical if blank.
|
||||
dnl # Used when we would use $host_alias, but empty is not OK.
|
||||
AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_HOST],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
|
||||
case ${host_alias} in
|
||||
"") host_noncanonical=${build_noncanonical} ;;
|
||||
*) host_noncanonical=${host_alias} ;;
|
||||
esac
|
||||
]) []dnl # _GCC_TOPLEV_NONCANONICAL_HOST
|
||||
|
||||
dnl ####
|
||||
dnl # _GCC_TOPLEV_NONCANONICAL_TARGET
|
||||
dnl # $target_alias or $host_noncanonical if blank.
|
||||
dnl # Used when we would use $target_alias, but empty is not OK.
|
||||
AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_TARGET],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl
|
||||
case ${target_alias} in
|
||||
"") target_noncanonical=${host_noncanonical} ;;
|
||||
*) target_noncanonical=${target_alias} ;;
|
||||
esac
|
||||
]) []dnl # _GCC_TOPLEV_NONCANONICAL_TARGET
|
||||
|
||||
dnl ####
|
||||
dnl # ACX_NONCANONICAL_BUILD
|
||||
dnl # Like underscored version, but AC_SUBST's.
|
||||
AC_DEFUN([ACX_NONCANONICAL_BUILD],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
|
||||
AC_SUBST(build_noncanonical)
|
||||
]) []dnl # ACX_NONCANONICAL_BUILD
|
||||
|
||||
dnl ####
|
||||
dnl # ACX_NONCANONICAL_HOST
|
||||
dnl # Like underscored version, but AC_SUBST's.
|
||||
AC_DEFUN([ACX_NONCANONICAL_HOST],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl
|
||||
AC_SUBST(host_noncanonical)
|
||||
]) []dnl # ACX_NONCANONICAL_HOST
|
||||
|
||||
dnl ####
|
||||
dnl # ACX_NONCANONICAL_TARGET
|
||||
dnl # Like underscored version, but AC_SUBST's.
|
||||
AC_DEFUN([ACX_NONCANONICAL_TARGET],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
|
||||
AC_SUBST(target_noncanonical)
|
||||
]) []dnl # ACX_NONCANONICAL_TARGET
|
||||
|
||||
dnl ####
|
||||
dnl # GCC_TOPLEV_SUBDIRS
|
||||
dnl # GCC & friends build 'build', 'host', and 'target' tools. These must
|
||||
dnl # be separated into three well-known subdirectories of the build directory:
|
||||
dnl # build_subdir, host_subdir, and target_subdir. The values are determined
|
||||
dnl # here so that they can (theoretically) be changed in the future. They
|
||||
dnl # were previously reproduced across many different files.
|
||||
dnl #
|
||||
dnl # This logic really amounts to very little with autoconf 2.13; it will
|
||||
dnl # amount to a lot more with autoconf 2.5x.
|
||||
AC_DEFUN([GCC_TOPLEV_SUBDIRS],
|
||||
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
|
||||
AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
|
||||
|
||||
# post-stage1 host modules use a different CC_FOR_BUILD so, in order to
|
||||
# have matching libraries, they should use host libraries: Makefile.tpl
|
||||
# arranges to pass --with-build-libsubdir=$(HOST_SUBDIR).
|
||||
# However, they still use the build modules, because the corresponding
|
||||
# host modules (e.g. bison) are only built for the host when bootstrap
|
||||
# finishes. So:
|
||||
# - build_subdir is where we find build modules, and never changes.
|
||||
# - build_libsubdir is where we find build libraries, and can be overridden.
|
||||
|
||||
# Prefix 'build-' so this never conflicts with target_subdir.
|
||||
build_subdir="build-${build_noncanonical}"
|
||||
AC_ARG_WITH(build-libsubdir,
|
||||
[ --with-build-libsubdir=[DIR] Directory where to find libraries for build system],
|
||||
build_libsubdir="$withval",
|
||||
build_libsubdir="$build_subdir")
|
||||
# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories
|
||||
if ( test $srcdir = . && test -d gcc ) \
|
||||
|| test -d $srcdir/../host-${host_noncanonical}; then
|
||||
host_subdir="host-${host_noncanonical}"
|
||||
else
|
||||
host_subdir=.
|
||||
fi
|
||||
# No prefix.
|
||||
target_subdir=${target_noncanonical}
|
||||
AC_SUBST([build_libsubdir]) []dnl
|
||||
AC_SUBST([build_subdir]) []dnl
|
||||
AC_SUBST([host_subdir]) []dnl
|
||||
AC_SUBST([target_subdir]) []dnl
|
||||
]) []dnl # GCC_TOPLEV_SUBDIRS
|
||||
|
||||
|
||||
####
|
||||
# _NCN_TOOL_PREFIXES: Some stuff that oughtta be done in AC_CANONICAL_SYSTEM
|
||||
# or AC_INIT.
|
||||
# These demand that AC_CANONICAL_SYSTEM be called beforehand.
|
||||
AC_DEFUN([_NCN_TOOL_PREFIXES],
|
||||
[ncn_tool_prefix=
|
||||
test -n "$host_alias" && ncn_tool_prefix=$host_alias-
|
||||
ncn_target_tool_prefix=
|
||||
test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
|
||||
]) []dnl # _NCN_TOOL_PREFIXES
|
||||
|
||||
####
|
||||
# NCN_STRICT_CHECK_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path])
|
||||
# Like plain AC_CHECK_TOOLS, but require prefix if build!=host.
|
||||
|
||||
AC_DEFUN([NCN_STRICT_CHECK_TOOLS],
|
||||
[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
|
||||
AC_ARG_VAR([$1], [$1 for the host])
|
||||
|
||||
if test -n "[$]$1"; then
|
||||
ac_cv_prog_$1=[$]$1
|
||||
elif test -n "$ac_cv_prog_$1"; then
|
||||
$1=$ac_cv_prog_$1
|
||||
fi
|
||||
|
||||
if test -n "$ac_cv_prog_$1"; then
|
||||
for ncn_progname in $2; do
|
||||
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
|
||||
done
|
||||
fi
|
||||
|
||||
for ncn_progname in $2; do
|
||||
if test -n "$ncn_tool_prefix"; then
|
||||
AC_CHECK_PROG([$1], [${ncn_tool_prefix}${ncn_progname}],
|
||||
[${ncn_tool_prefix}${ncn_progname}], , [$4])
|
||||
fi
|
||||
if test -z "$ac_cv_prog_$1" && test $build = $host ; then
|
||||
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
|
||||
fi
|
||||
test -n "$ac_cv_prog_$1" && break
|
||||
done
|
||||
|
||||
if test -z "$ac_cv_prog_$1" ; then
|
||||
ifelse([$3],[], [set dummy $2
|
||||
if test $build = $host ; then
|
||||
$1="[$]2"
|
||||
else
|
||||
$1="${ncn_tool_prefix}[$]2"
|
||||
fi], [$1="$3"])
|
||||
fi
|
||||
]) []dnl # NCN_STRICT_CHECK_TOOLS
|
||||
|
||||
####
|
||||
# NCN_STRICT_CHECK_TARGET_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path])
|
||||
# Like CVS Autoconf AC_CHECK_TARGET_TOOLS, but require prefix if build!=target.
|
||||
|
||||
AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOLS],
|
||||
[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
|
||||
AC_ARG_VAR([$1], patsubst([$1], [_FOR_TARGET$], [])[ for the target])
|
||||
|
||||
if test -n "[$]$1"; then
|
||||
ac_cv_prog_$1=[$]$1
|
||||
elif test -n "$ac_cv_prog_$1"; then
|
||||
$1=$ac_cv_prog_$1
|
||||
fi
|
||||
|
||||
if test -n "$ac_cv_prog_$1"; then
|
||||
for ncn_progname in $2; do
|
||||
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$ac_cv_prog_$1" && test -n "$with_build_time_tools"; then
|
||||
for ncn_progname in $2; do
|
||||
AC_MSG_CHECKING([for ${ncn_progname} in $with_build_time_tools])
|
||||
if test -x $with_build_time_tools/${ncn_progname}; then
|
||||
ac_cv_prog_$1=$with_build_time_tools/${ncn_progname}
|
||||
AC_MSG_RESULT(yes)
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$ac_cv_prog_$1"; then
|
||||
for ncn_progname in $2; do
|
||||
if test -n "$ncn_target_tool_prefix"; then
|
||||
AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}${ncn_progname}],
|
||||
[${ncn_target_tool_prefix}${ncn_progname}], , [$4])
|
||||
fi
|
||||
if test -z "$ac_cv_prog_$1" && test $build = $target ; then
|
||||
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
|
||||
fi
|
||||
test -n "$ac_cv_prog_$1" && break
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$ac_cv_prog_$1" ; then
|
||||
ifelse([$3],[], [set dummy $2
|
||||
if test $build = $target ; then
|
||||
$1="[$]2"
|
||||
else
|
||||
$1="${ncn_target_tool_prefix}[$]2"
|
||||
fi], [$1="$3"])
|
||||
else
|
||||
$1="$ac_cv_prog_$1"
|
||||
fi
|
||||
]) []dnl # NCN_STRICT_CHECK_TARGET_TOOLS
|
||||
|
||||
|
||||
# Backported from Autoconf 2.5x; can go away when and if
|
||||
# we switch. Put the OS path separator in $PATH_SEPARATOR.
|
||||
AC_DEFUN([ACX_PATH_SEP], [
|
||||
# The user is always right.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
echo "#! /bin/sh" >conf$$.sh
|
||||
echo "exit 0" >>conf$$.sh
|
||||
chmod +x conf$$.sh
|
||||
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
|
||||
PATH_SEPARATOR=';'
|
||||
else
|
||||
PATH_SEPARATOR=:
|
||||
fi
|
||||
rm -f conf$$.sh
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([ACX_TOOL_DIRS], [
|
||||
AC_REQUIRE([ACX_PATH_SEP])
|
||||
if test "x$exec_prefix" = xNONE; then
|
||||
if test "x$prefix" = xNONE; then
|
||||
gcc_cv_tool_prefix=$ac_default_prefix
|
||||
else
|
||||
gcc_cv_tool_prefix=$prefix
|
||||
fi
|
||||
else
|
||||
gcc_cv_tool_prefix=$exec_prefix
|
||||
fi
|
||||
|
||||
# If there is no compiler in the tree, use the PATH only. In any
|
||||
# case, if there is no compiler in the tree nobody should use
|
||||
# AS_FOR_TARGET and LD_FOR_TARGET.
|
||||
if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then
|
||||
gcc_version=`cat $srcdir/gcc/BASE-VER`
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin$PATH_SEPARATOR"
|
||||
else
|
||||
gcc_cv_tool_dirs=
|
||||
fi
|
||||
|
||||
if test x$build = x$target && test -n "$md_exec_prefix"; then
|
||||
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$md_exec_prefix$PATH_SEPARATOR"
|
||||
fi
|
||||
|
||||
]) []dnl # ACX_TOOL_DIRS
|
||||
|
||||
# ACX_HAVE_GCC_FOR_TARGET
|
||||
# Check if the variable GCC_FOR_TARGET really points to a GCC binary.
|
||||
AC_DEFUN([ACX_HAVE_GCC_FOR_TARGET], [
|
||||
cat > conftest.c << \EOF
|
||||
#ifdef __GNUC__
|
||||
gcc_yay;
|
||||
#endif
|
||||
EOF
|
||||
if ($GCC_FOR_TARGET -E conftest.c | grep gcc_yay) > /dev/null 2>&1; then
|
||||
have_gcc_for_target=yes
|
||||
else
|
||||
GCC_FOR_TARGET=${ncn_target_tool_prefix}gcc
|
||||
have_gcc_for_target=no
|
||||
fi
|
||||
rm conftest.c
|
||||
])
|
||||
|
||||
# ACX_CHECK_INSTALLED_TARGET_TOOL(VAR, PROG)
|
||||
# Searching for installed target binutils. We need to take extra care,
|
||||
# else we may find the wrong assembler, linker, etc., and lose.
|
||||
#
|
||||
# First try --with-build-time-tools, if specified.
|
||||
#
|
||||
# For build != host, we ask the installed GCC for the name of the tool it
|
||||
# uses, and accept it if it is an absolute path. This is because the
|
||||
# only good choice for a compiler is the same GCC version that is being
|
||||
# installed (or we couldn't make target libraries), and we assume that
|
||||
# on the host system we'll have not only the same GCC version, but also
|
||||
# the same binutils version.
|
||||
#
|
||||
# For build == host, search the same directories that the installed
|
||||
# compiler will search. We used to do this for the assembler, linker,
|
||||
# and nm only; for simplicity of configuration, however, we extend this
|
||||
# criterion to tools (such as ar and ranlib) that are never invoked by
|
||||
# the compiler, to avoid mismatches.
|
||||
#
|
||||
# Also note we have to check MD_EXEC_PREFIX before checking the user's path
|
||||
# if build == target. This makes the most sense only when bootstrapping,
|
||||
# but we also do so when build != host. In this case, we hope that the
|
||||
# build and host systems will have similar contents of MD_EXEC_PREFIX.
|
||||
#
|
||||
# If we do not find a suitable binary, then try the user's path.
|
||||
|
||||
AC_DEFUN([ACX_CHECK_INSTALLED_TARGET_TOOL], [
|
||||
AC_REQUIRE([ACX_TOOL_DIRS])
|
||||
AC_REQUIRE([ACX_HAVE_GCC_FOR_TARGET])
|
||||
if test -z "$ac_cv_path_$1" ; then
|
||||
if test -n "$with_build_time_tools"; then
|
||||
AC_MSG_CHECKING([for $2 in $with_build_time_tools])
|
||||
if test -x $with_build_time_tools/$2; then
|
||||
$1=`cd $with_build_time_tools && pwd`/$2
|
||||
ac_cv_path_$1=[$]$1
|
||||
AC_MSG_RESULT([$ac_cv_path_$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
elif test $build != $host && test $have_gcc_for_target = yes; then
|
||||
$1=`$GCC_FOR_TARGET --print-prog-name=$2`
|
||||
test [$]$1 = $2 && $1=
|
||||
test -n "[$]$1" && ac_cv_path_$1=[$]$1
|
||||
fi
|
||||
fi
|
||||
if test -z "$ac_cv_path_$1" && test -n "$gcc_cv_tool_dirs"; then
|
||||
AC_PATH_PROG([$1], [$2], [], [$gcc_cv_tool_dirs])
|
||||
fi
|
||||
if test -z "$ac_cv_path_$1" ; then
|
||||
NCN_STRICT_CHECK_TARGET_TOOLS([$1], [$2])
|
||||
else
|
||||
$1=$ac_cv_path_$1
|
||||
fi
|
||||
]) []dnl # ACX_CHECK_INSTALLED_TARGET_TOOL
|
||||
|
||||
###
|
||||
# AC_PROG_CPP_WERROR
|
||||
# Used for autoconf 2.5x to force AC_PREPROC_IFELSE to reject code which
|
||||
# triggers warnings from the preprocessor. Will be in autoconf 2.58.
|
||||
# For now, using this also overrides header checks to use only the
|
||||
# preprocessor (matches 2.13 behavior; matching 2.58's behavior is a
|
||||
# bit harder from here).
|
||||
# Eventually autoconf will default to checking headers with the compiler
|
||||
# instead, and we'll have to do this differently.
|
||||
|
||||
AC_DEFUN([AC_PROG_CPP_WERROR],
|
||||
[AC_REQUIRE([AC_PROG_CPP])dnl
|
||||
m4_define([AC_CHECK_HEADER],m4_defn([_AC_CHECK_HEADER_OLD]))
|
||||
ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
|
||||
|
||||
# Test for GNAT.
|
||||
# We require the gnatbind & gnatmake programs, as well as a compiler driver
|
||||
# that understands Ada. We use the user's CC setting, already found, and
|
||||
# possibly add $1 to the command-line parameters.
|
||||
#
|
||||
# Sets the shell variable have_gnat to yes or no as appropriate, and
|
||||
# substitutes GNATBIND and GNATMAKE.
|
||||
AC_DEFUN([ACX_PROG_GNAT],
|
||||
[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_CHECK_TOOL(GNATBIND, gnatbind, no)
|
||||
AC_CHECK_TOOL(GNATMAKE, gnatmake, no)
|
||||
AC_CACHE_CHECK([whether compiler driver understands Ada],
|
||||
acx_cv_cc_gcc_supports_ada,
|
||||
[cat >conftest.adb <<EOF
|
||||
procedure conftest is begin null; end conftest;
|
||||
EOF
|
||||
acx_cv_cc_gcc_supports_ada=no
|
||||
# There is a bug in old released versions of GCC which causes the
|
||||
# driver to exit successfully when the appropriate language module
|
||||
# has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
|
||||
# Therefore we must check for the error message as well as an
|
||||
# unsuccessful exit.
|
||||
# Other compilers, like HP Tru64 UNIX cc, exit successfully when
|
||||
# given a .adb file, but produce no object file. So we must check
|
||||
# if an object file was really produced to guard against this.
|
||||
errors=`(${CC} $1[]m4_ifval([$1], [ ])-c conftest.adb) 2>&1 || echo failure`
|
||||
if test x"$errors" = x && test -f conftest.$ac_objext; then
|
||||
acx_cv_cc_gcc_supports_ada=yes
|
||||
fi
|
||||
rm -f conftest.*])
|
||||
|
||||
if test "x$GNATBIND" != xno && test "x$GNATMAKE" != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then
|
||||
have_gnat=yes
|
||||
else
|
||||
have_gnat=no
|
||||
fi
|
||||
])
|
||||
|
||||
dnl 'make compare' can be significantly faster, if cmp itself can
|
||||
dnl skip bytes instead of using tail. The test being performed is
|
||||
dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
|
||||
dnl but we need to sink errors and handle broken shells. We also test
|
||||
dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
|
||||
dnl accepted by cmp on some systems.
|
||||
AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL],
|
||||
[AC_CACHE_CHECK([how to compare bootstrapped objects], gcc_cv_prog_cmp_skip,
|
||||
[ echo abfoo >t1
|
||||
echo cdfoo >t2
|
||||
gcc_cv_prog_cmp_skip='tail +16c $$f1 > tmp-foo1; tail +16c $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2'
|
||||
if cmp t1 t2 2 2 > /dev/null 2>&1; then
|
||||
if cmp t1 t2 1 1 > /dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16'
|
||||
fi
|
||||
fi
|
||||
if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
|
||||
if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2'
|
||||
fi
|
||||
fi
|
||||
rm t1 t2
|
||||
])
|
||||
do_compare="$gcc_cv_prog_cmp_skip"
|
||||
AC_SUBST(do_compare)
|
||||
])
|
||||
|
||||
dnl See whether we can include both string.h and strings.h.
|
||||
AC_DEFUN([ACX_HEADER_STRING],
|
||||
[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
|
||||
gcc_cv_header_string,
|
||||
[AC_TRY_COMPILE([#include <string.h>
|
||||
#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
|
||||
if test $gcc_cv_header_string = yes; then
|
||||
AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl See if stdbool.h properly defines bool and true/false.
|
||||
dnl Check whether _Bool is built-in.
|
||||
AC_DEFUN([ACX_HEADER_STDBOOL],
|
||||
[AC_CACHE_CHECK([for working stdbool.h],
|
||||
ac_cv_header_stdbool_h,
|
||||
[AC_TRY_COMPILE([#include <stdbool.h>],
|
||||
[bool foo = false;],
|
||||
ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
|
||||
if test $ac_cv_header_stdbool_h = yes; then
|
||||
AC_DEFINE(HAVE_STDBOOL_H, 1,
|
||||
[Define if you have a working <stdbool.h> header file.])
|
||||
fi
|
||||
AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
|
||||
[AC_TRY_COMPILE(,
|
||||
[_Bool foo;],
|
||||
gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
|
||||
])
|
||||
if test $gcc_cv_c__bool = yes; then
|
||||
AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl See if hard links work and if not, try to substitute $1 or simple copy.
|
||||
AC_DEFUN([ACX_PROG_LN],
|
||||
[AC_MSG_CHECKING(whether ln works)
|
||||
AC_CACHE_VAL(acx_cv_prog_LN,
|
||||
[rm -f conftestdata_t
|
||||
echo >conftestdata_f
|
||||
if ln conftestdata_f conftestdata_t 2>/dev/null
|
||||
then
|
||||
acx_cv_prog_LN=ln
|
||||
else
|
||||
acx_cv_prog_LN=no
|
||||
fi
|
||||
rm -f conftestdata_f conftestdata_t
|
||||
])dnl
|
||||
if test $acx_cv_prog_LN = no; then
|
||||
LN="ifelse([$1],,cp,[$1])"
|
||||
AC_MSG_RESULT([no, using $LN])
|
||||
else
|
||||
LN="$acx_cv_prog_LN"
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
AC_SUBST(LN)dnl
|
||||
])
|
||||
|
||||
dnl GCC_TARGET_TOOL(PROGRAM, TARGET-VAR, HOST-VAR, IN-TREE-TOOL, LANGUAGE)
|
||||
AC_DEFUN([GCC_TARGET_TOOL],
|
||||
[AC_MSG_CHECKING(where to find the target $1)
|
||||
if test "x${build}" != "x${host}" ; then
|
||||
if expr "x[$]$2" : "x/" > /dev/null; then
|
||||
# We already found the complete path
|
||||
ac_dir=`dirname [$]$2`
|
||||
AC_MSG_RESULT(pre-installed in $ac_dir)
|
||||
else
|
||||
# Canadian cross, just use what we found
|
||||
AC_MSG_RESULT(pre-installed)
|
||||
fi
|
||||
else
|
||||
ifelse([$4],,,
|
||||
[ok=yes
|
||||
case " ${configdirs} " in
|
||||
*" patsubst([$4], [/.*], []) "*) ;;
|
||||
*) ok=no ;;
|
||||
esac
|
||||
ifelse([$5],,,
|
||||
[case ,${enable_languages}, in
|
||||
*,$5,*) ;;
|
||||
*) ok=no ;;
|
||||
esac])
|
||||
if test $ok = yes; then
|
||||
# An in-tree tool is available and we can use it
|
||||
$2='$$r/$(HOST_SUBDIR)/$4'
|
||||
AC_MSG_RESULT(just compiled)
|
||||
el])if expr "x[$]$2" : "x/" > /dev/null; then
|
||||
# We already found the complete path
|
||||
ac_dir=`dirname [$]$2`
|
||||
AC_MSG_RESULT(pre-installed in $ac_dir)
|
||||
elif test "x$target" = "x$host"; then
|
||||
# We can use an host tool
|
||||
$2='$($3)'
|
||||
AC_MSG_RESULT(host tool)
|
||||
else
|
||||
# We need a cross tool
|
||||
AC_MSG_RESULT(pre-installed)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST($2)])
|
||||
|
||||
|
||||
dnl Locate a program and check that its version is acceptable.
|
||||
dnl ACX_PROG_CHECK_VER(var, name, version-switch,
|
||||
dnl version-extract-regexp, version-glob)
|
||||
AC_DEFUN([ACX_CHECK_PROG_VER],[
|
||||
AC_CHECK_PROG([$1], [$2], [$2])
|
||||
if test -n "[$]$1"; then
|
||||
# Found it, now check the version.
|
||||
AC_CACHE_CHECK([for modern $2],
|
||||
[gcc_cv_prog_$2_modern],
|
||||
[ac_prog_version=`eval [$]$1 $3 2>&1 |
|
||||
sed -n 's/^.*patsubst([[$4]],/,\/).*$/\1/p'`
|
||||
|
||||
[case $ac_prog_version in
|
||||
'') gcc_cv_prog_$2_modern=no;;
|
||||
$5) gcc_cv_prog_$2_modern=yes;;
|
||||
*) gcc_cv_prog_$2_modern=no;;
|
||||
esac]
|
||||
])
|
||||
else
|
||||
gcc_cv_prog_$2_modern=no
|
||||
fi
|
||||
if test $gcc_cv_prog_$2_modern = no; then
|
||||
$1="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing $2"
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Support the --with-pkgversion configure option.
|
||||
dnl ACX_PKGVERSION(default-pkgversion)
|
||||
AC_DEFUN([ACX_PKGVERSION],[
|
||||
AC_ARG_WITH(pkgversion,
|
||||
AS_HELP_STRING([--with-pkgversion=PKG],
|
||||
[Use PKG in the version string in place of "$1"]),
|
||||
[case "$withval" in
|
||||
yes) AC_MSG_ERROR([package version not specified]) ;;
|
||||
no) PKGVERSION= ;;
|
||||
*) PKGVERSION="($withval) " ;;
|
||||
esac],
|
||||
PKGVERSION="($1) "
|
||||
)
|
||||
AC_SUBST(PKGVERSION)
|
||||
])
|
||||
|
||||
dnl Support the --with-bugurl configure option.
|
||||
dnl ACX_BUGURL(default-bugurl)
|
||||
AC_DEFUN([ACX_BUGURL],[
|
||||
AC_ARG_WITH(bugurl,
|
||||
AS_HELP_STRING([--with-bugurl=URL],
|
||||
[Direct users to URL to report a bug]),
|
||||
[case "$withval" in
|
||||
yes) AC_MSG_ERROR([bug URL not specified]) ;;
|
||||
no) BUGURL=
|
||||
;;
|
||||
*) BUGURL="$withval"
|
||||
;;
|
||||
esac],
|
||||
BUGURL="$1"
|
||||
)
|
||||
case ${BUGURL} in
|
||||
"")
|
||||
REPORT_BUGS_TO=
|
||||
REPORT_BUGS_TEXI=
|
||||
;;
|
||||
*)
|
||||
REPORT_BUGS_TO="<$BUGURL>"
|
||||
REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`}
|
||||
;;
|
||||
esac;
|
||||
AC_SUBST(REPORT_BUGS_TO)
|
||||
AC_SUBST(REPORT_BUGS_TEXI)
|
||||
])
|
||||
|
||||
dnl ####
|
||||
dnl # ACX_CHECK_CYGWIN_CAT_WORKS
|
||||
dnl # On Cygwin hosts, check that the cat command ignores
|
||||
dnl # carriage returns as otherwise builds will not work.
|
||||
dnl # See binutils PR 4334 for more details.
|
||||
AC_DEFUN([ACX_CHECK_CYGWIN_CAT_WORKS],[
|
||||
AC_MSG_CHECKING([to see if cat works as expected])
|
||||
echo a >cygwin-cat-check
|
||||
if test `cat cygwin-cat-check` = a ; then
|
||||
rm cygwin-cat-check
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
rm cygwin-cat-check
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_ERROR([The cat command does not ignore carriage return characters.
|
||||
Please either mount the build directory in binary mode or run the following
|
||||
commands before running any configure script:
|
||||
set -o igncr
|
||||
export SHELLOPTS
|
||||
])
|
||||
fi
|
||||
])
|
1
newlib/src/config/bootstrap-O1.mk
Normal file
1
newlib/src/config/bootstrap-O1.mk
Normal file
|
@ -0,0 +1 @@
|
|||
BOOT_CFLAGS := -O1 $(filter-out -O%, $(BOOT_CFLAGS))
|
1
newlib/src/config/bootstrap-O3.mk
Normal file
1
newlib/src/config/bootstrap-O3.mk
Normal file
|
@ -0,0 +1 @@
|
|||
BOOT_CFLAGS := -O3 $(filter-out -O%, $(BOOT_CFLAGS))
|
8
newlib/src/config/bootstrap-debug-big.mk
Normal file
8
newlib/src/config/bootstrap-debug-big.mk
Normal file
|
@ -0,0 +1,8 @@
|
|||
# This BUILD_CONFIG option is a bit like bootstrap-debug-lean, but it
|
||||
# trades space for speed: instead of recompiling programs during
|
||||
# stage3, it generates dumps during stage2 and stage3, saving them all
|
||||
# until the final compare.
|
||||
|
||||
STAGE2_CFLAGS += -fdump-final-insns
|
||||
STAGE3_CFLAGS += -fdump-final-insns
|
||||
do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
|
16
newlib/src/config/bootstrap-debug-ckovw.mk
Normal file
16
newlib/src/config/bootstrap-debug-ckovw.mk
Normal file
|
@ -0,0 +1,16 @@
|
|||
# This BUILD_CONFIG option is to be used along with
|
||||
# bootstrap-debug-lean and bootstrap-debug-lib in a full bootstrap, to
|
||||
# check that all host and target files are built with -fcompare-debug.
|
||||
|
||||
# These arrange for a simple warning to be issued if -fcompare-debug
|
||||
# is not given.
|
||||
# BOOT_CFLAGS += -fcompare-debug="-w%n-fcompare-debug not overridden"
|
||||
# TFLAGS += -fcompare-debug="-w%n-fcompare-debug not overridden"
|
||||
|
||||
# GCC_COMPARE_DEBUG="-w%n-fcompare-debug not overridden";
|
||||
|
||||
FORCE_COMPARE_DEBUG = \
|
||||
GCC_COMPARE_DEBUG=$${GCC_COMPARE_DEBUG--fcompare-debug-not-overridden}; \
|
||||
export GCC_COMPARE_DEBUG;
|
||||
POSTSTAGE1_HOST_EXPORTS += $(FORCE_COMPARE_DEBUG)
|
||||
BASE_TARGET_EXPORTS += $(FORCE_COMPARE_DEBUG)
|
11
newlib/src/config/bootstrap-debug-lean.mk
Normal file
11
newlib/src/config/bootstrap-debug-lean.mk
Normal file
|
@ -0,0 +1,11 @@
|
|||
# This BUILD_CONFIG option is a bit like bootstrap-debug, but rather
|
||||
# than comparing stripped object files, it compares compiler internal
|
||||
# state during stage3. Both can be used simultaneously.
|
||||
|
||||
# This makes it slower than bootstrap-debug alone, for there's
|
||||
# additional dumping and recompilation during stage3.
|
||||
# bootstrap-debug-big can avoid the recompilation, if plenty of disk
|
||||
# space is available.
|
||||
|
||||
STAGE2_CFLAGS += -fcompare-debug=
|
||||
STAGE3_CFLAGS += -fcompare-debug
|
12
newlib/src/config/bootstrap-debug-lib.mk
Normal file
12
newlib/src/config/bootstrap-debug-lib.mk
Normal file
|
@ -0,0 +1,12 @@
|
|||
# This BUILD_CONFIG option tests that target libraries built during
|
||||
# stage3 would have generated the same executable code if they were
|
||||
# compiled with -g0.
|
||||
|
||||
# It uses -g0 rather than -gtoggle because -g is default on target
|
||||
# library builds, and toggling it where it's supposed to be disabled
|
||||
# breaks e.g. crtstuff on ppc.
|
||||
|
||||
STAGE1_TFLAGS += -g0 -fcompare-debug=
|
||||
STAGE2_TFLAGS += -fcompare-debug=
|
||||
STAGE3_TFLAGS += -fcompare-debug=-g0
|
||||
do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
|
12
newlib/src/config/bootstrap-debug.mk
Normal file
12
newlib/src/config/bootstrap-debug.mk
Normal file
|
@ -0,0 +1,12 @@
|
|||
# This BUILD_CONFIG option builds checks that toggling debug
|
||||
# information generation doesn't affect the generated object code.
|
||||
|
||||
# It is very lightweight: in addition to not performing any additional
|
||||
# compilation (unlike bootstrap-debug-lean), it actually speeds up
|
||||
# stage2, for no debug information is generated when compiling with
|
||||
# the unoptimized stage1.
|
||||
|
||||
# For more thorough testing, see bootstrap-debug-lean.mk
|
||||
|
||||
STAGE2_CFLAGS += -gtoggle
|
||||
do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
|
5
newlib/src/config/bootstrap-lto.mk
Normal file
5
newlib/src/config/bootstrap-lto.mk
Normal file
|
@ -0,0 +1,5 @@
|
|||
# This option enables LTO for stage2 and stage3.
|
||||
|
||||
STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1
|
||||
STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1
|
||||
STAGEprofile_CFLAGS += -fno-lto
|
2
newlib/src/config/bootstrap-time.mk
Normal file
2
newlib/src/config/bootstrap-time.mk
Normal file
|
@ -0,0 +1,2 @@
|
|||
BOOT_CFLAGS += -time=$(shell pwd)/time.log
|
||||
TFLAGS += -time=$(shell pwd)/time.log
|
288
newlib/src/config/cloog.m4
Normal file
288
newlib/src/config/cloog.m4
Normal file
|
@ -0,0 +1,288 @@
|
|||
# This file is part of GCC.
|
||||
#
|
||||
# GCC is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free
|
||||
# Software Foundation; either version 3, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# GCC is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Contributed by Andreas Simbuerger <simbuerg@fim.uni-passau.de>
|
||||
|
||||
# CLOOG_INIT_FLAGS ()
|
||||
# -------------------------
|
||||
# Provide configure switches for CLooG support.
|
||||
# Initialize clooglibs/clooginc according to the user input.
|
||||
AC_DEFUN([CLOOG_INIT_FLAGS],
|
||||
[
|
||||
AC_ARG_WITH(cloog,
|
||||
[AS_HELP_STRING(
|
||||
[--with-cloog=PATH],
|
||||
[Specify prefix directory for the installed CLooG-PPL package.
|
||||
Equivalent to --with-cloog-include=PATH/include
|
||||
plus --with-cloog-lib=PATH/lib])])
|
||||
AC_ARG_WITH([cloog-include],
|
||||
[AS_HELP_STRING(
|
||||
[--with-cloog-include=PATH],
|
||||
[Specify directory for installed CLooG include files])])
|
||||
AC_ARG_WITH([cloog-lib],
|
||||
[AS_HELP_STRING(
|
||||
[--with-cloog-lib=PATH],
|
||||
[Specify the directory for the installed CLooG library])])
|
||||
|
||||
AC_ARG_ENABLE(cloog-backend,
|
||||
[AS_HELP_STRING(
|
||||
[--enable-cloog-backend[[=BACKEND]]],
|
||||
[set the CLooG BACKEND used to either isl, ppl or ppl-legacy (default)])],
|
||||
[ if test "x${enableval}" = "xisl"; then
|
||||
cloog_backend=isl
|
||||
elif test "x${enableval}" = "xppl"; then
|
||||
cloog_backend=ppl
|
||||
else
|
||||
cloog_backend=ppl-legacy
|
||||
fi], cloog_backend=ppl-legacy)
|
||||
AC_ARG_ENABLE(cloog-version-check,
|
||||
[AS_HELP_STRING(
|
||||
[--disable-cloog-version-check],
|
||||
[disable check for CLooG version])],
|
||||
ENABLE_CLOOG_CHECK=$enableval,
|
||||
ENABLE_CLOOG_CHECK=yes)
|
||||
|
||||
# Initialize clooglibs and clooginc.
|
||||
case $with_cloog in
|
||||
no)
|
||||
clooglibs=
|
||||
clooginc=
|
||||
;;
|
||||
"" | yes)
|
||||
;;
|
||||
*)
|
||||
clooglibs="-L$with_cloog/lib"
|
||||
clooginc="-I$with_cloog/include"
|
||||
;;
|
||||
esac
|
||||
if test "x${with_cloog_include}" != x ; then
|
||||
clooginc="-I$with_cloog_include"
|
||||
fi
|
||||
if test "x${with_cloog_lib}" != x; then
|
||||
clooglibs="-L$with_cloog_lib"
|
||||
fi
|
||||
|
||||
dnl Flags needed for CLOOG
|
||||
AC_SUBST(clooglibs)
|
||||
AC_SUBST(clooginc)
|
||||
]
|
||||
)
|
||||
|
||||
# CLOOG_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
|
||||
# ----------------------------------------------------
|
||||
# Provide actions for failed CLooG detection.
|
||||
AC_DEFUN([CLOOG_REQUESTED],
|
||||
[
|
||||
AC_REQUIRE([CLOOG_INIT_FLAGS])
|
||||
|
||||
if test "x${with_cloog}" = xno; then
|
||||
$2
|
||||
elif test "x${with_cloog}" != x \
|
||||
|| test "x${with_cloog_include}" != x \
|
||||
|| test "x${with_cloog_lib}" != x ; then
|
||||
$1
|
||||
else
|
||||
$2
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
# _CLOOG_ORG_PROG_ISL ()
|
||||
# ------------------
|
||||
# Helper for detecting CLooG.org's ISL backend.
|
||||
m4_define([_CLOOG_ORG_PROG_ISL],[AC_LANG_PROGRAM(
|
||||
[#include "cloog/cloog.h" ],
|
||||
[cloog_version ()])])
|
||||
|
||||
# _CLOOG_ORG_PROG_PPL ()
|
||||
# ------------------
|
||||
# Helper for detecting CLooG.org's PPL backend.
|
||||
m4_define([_CLOOG_ORG_PROG_PPL],[AC_LANG_PROGRAM(
|
||||
[#include "cloog/cloog.h"
|
||||
#include "cloog/ppl/cloog.h"],
|
||||
[cloog_version ()])])
|
||||
|
||||
# _CLOOG_PPL_LEGACY_PROG ()
|
||||
# -------------------------
|
||||
# Helper for detecting CLooG-Legacy (CLooG-PPL).
|
||||
m4_define([_CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM(
|
||||
[#include "cloog/cloog.h"],
|
||||
[#ifndef CLOOG_PPL_BACKEND
|
||||
choke me
|
||||
#endif ])])
|
||||
|
||||
# CLOOG_FIND_FLAGS ()
|
||||
# ------------------
|
||||
# Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org.
|
||||
# Only look for the CLooG backend type specified in --enable-cloog-backend
|
||||
AC_DEFUN([CLOOG_FIND_FLAGS],
|
||||
[
|
||||
AC_REQUIRE([CLOOG_INIT_FLAGS])
|
||||
|
||||
_cloog_saved_CFLAGS=$CFLAGS
|
||||
_cloog_saved_CPPFLAGS=$CPPFLAGS
|
||||
_cloog_saved_LDFLAGS=$LDFLAGS
|
||||
_cloog_saved_LIBS=$LIBS
|
||||
|
||||
_cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
|
||||
|
||||
dnl clooglibs & clooginc may have been initialized by CLOOG_INIT_FLAGS.
|
||||
CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}"
|
||||
CPPFLAGS="${CPPFLAGS} ${_cloogorginc}"
|
||||
LDFLAGS="${LDFLAGS} ${clooglibs}"
|
||||
|
||||
case $cloog_backend in
|
||||
"ppl-legacy")
|
||||
CFLAGS="${CFLAGS} ${pplinc}"
|
||||
LDFLAGS="${LDFLAGS} ${ppllibs}"
|
||||
AC_CACHE_CHECK([for installed CLooG PPL Legacy], [gcc_cv_cloog_type],
|
||||
[LIBS="-lcloog ${_cloog_saved_LIBS}"
|
||||
AC_LINK_IFELSE([_CLOOG_PPL_LEGACY_PROG], [gcc_cv_cloog_type="PPL Legacy"],
|
||||
[gcc_cv_cloog_type=no])])
|
||||
;;
|
||||
"isl")
|
||||
AC_CACHE_CHECK([for installed CLooG ISL], [gcc_cv_cloog_type],
|
||||
[LIBS="-lcloog-isl ${_cloog_saved_LIBS}"
|
||||
AC_LINK_IFELSE([_CLOOG_ORG_PROG_ISL], [gcc_cv_cloog_type="ISL"],
|
||||
[gcc_cv_cloog_type=no])])
|
||||
;;
|
||||
"ppl")
|
||||
CFLAGS="${CFLAGS} ${pplinc}"
|
||||
LDFLAGS="${LDFLAGS} ${ppllibs}"
|
||||
AC_CACHE_CHECK([for installed CLooG PPL], [gcc_cv_cloog_type],
|
||||
[LIBS="-lcloog-ppl ${_cloog_saved_LIBS}"
|
||||
AC_LINK_IFELSE([_CLOOG_ORG_PROG_PPL], [gcc_cv_cloog_type="PPL"],
|
||||
[gcc_cv_cloog_type=no])])
|
||||
;;
|
||||
*)
|
||||
gcc_cv_cloog_type=""
|
||||
esac
|
||||
|
||||
case $gcc_cv_cloog_type in
|
||||
"PPL Legacy")
|
||||
clooginc="${clooginc}"
|
||||
clooglibs="${clooglibs} -lcloog"
|
||||
cloog_org=no
|
||||
;;
|
||||
"ISL")
|
||||
clooginc="${clooginc} ${_cloogorginc}"
|
||||
clooglibs="${clooglibs} -lcloog-isl -lisl"
|
||||
cloog_org=yes
|
||||
;;
|
||||
"PPL")
|
||||
clooginc="${clooginc} ${_cloogorginc}"
|
||||
clooglibs="${clooglibs} -lcloog-ppl"
|
||||
cloog_org=yes
|
||||
;;
|
||||
*)
|
||||
clooglibs=
|
||||
clooginc=
|
||||
cloog_org=
|
||||
;;
|
||||
esac
|
||||
|
||||
LIBS=$_cloog_saved_LIBS
|
||||
CFLAGS=$_cloog_saved_CFLAGS
|
||||
CPPFLAGS=$_cloog_saved_CPPFLAGS
|
||||
LDFLAGS=$_cloog_saved_LDFLAGS
|
||||
]
|
||||
)
|
||||
|
||||
# _CLOOG_CHECK_CT_PROG(MAJOR, MINOR, REVISION)
|
||||
# --------------------------------------------
|
||||
# Helper for verifying CLooG's compile time version.
|
||||
m4_define([_CLOOG_CHECK_CT_PROG],[AC_LANG_PROGRAM(
|
||||
[#include "cloog/cloog.h"],
|
||||
[#if CLOOG_VERSION_MAJOR != $1 \
|
||||
|| CLOOG_VERSION_MINOR != $2 \
|
||||
|| CLOOG_VERSION_REVISION < $3
|
||||
choke me
|
||||
#endif])])
|
||||
|
||||
# _CLOOG_CHECK_RT_PROG ()
|
||||
# -----------------------
|
||||
# Helper for verifying that CLooG's compile time version
|
||||
# matches the run time version.
|
||||
m4_define([_CLOOG_CHECK_RT_PROG],[AC_LANG_PROGRAM(
|
||||
[#include "cloog/cloog.h"],
|
||||
[if ((cloog_version_major () != CLOOG_VERSION_MAJOR)
|
||||
&& (cloog_version_minor () != CLOOG_VERSION_MINOR)
|
||||
&& (cloog_version_revision () != CLOOG_VERSION_REVISION))
|
||||
{
|
||||
return 1;
|
||||
}])])
|
||||
|
||||
# CLOOG_CHECK_VERSION CLOOG_CHECK_VERSION (MAJOR, MINOR, REVISION)
|
||||
# ----------------------------------------------------------------
|
||||
# Test the found CLooG to be exact of version MAJOR.MINOR and at least
|
||||
# REVISION.
|
||||
# If we're using the old CLooG-PPL (Legacy), the old version check will
|
||||
# be executed (Ignores the provided version information).
|
||||
AC_DEFUN([CLOOG_CHECK_VERSION],
|
||||
[
|
||||
AC_REQUIRE([CLOOG_FIND_FLAGS])
|
||||
|
||||
if test "${ENABLE_CLOOG_CHECK}" = yes ; then
|
||||
_cloog_saved_CFLAGS=$CFLAGS
|
||||
_cloog_saved_LDFLAGS=$LDFLAGS
|
||||
|
||||
CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}"
|
||||
LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}"
|
||||
|
||||
if test "${cloog_org}" = yes ; then
|
||||
AC_CACHE_CHECK([for version $1.$2.$3 of CLooG],
|
||||
[gcc_cv_cloog_ct_0_14_0],
|
||||
[AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)],
|
||||
[gcc_cv_cloog_ct_0_14_0=yes],
|
||||
[gcc_cv_cloog_ct_0_14_0=no])])
|
||||
elif test "${cloog_org}" = no ; then
|
||||
AC_CACHE_CHECK([for version 0.15.5 (or later revision) of CLooG],
|
||||
[gcc_cv_cloog_ct_0_15_5],
|
||||
[AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,5)],
|
||||
[AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,9)],
|
||||
[gcc_cv_cloog_ct_0_15_5=yes],
|
||||
[gcc_cv_cloog_ct_0_15_5="buggy but acceptable"])],
|
||||
[gcc_cv_cloog_ct_0_15_5=no])])
|
||||
fi
|
||||
|
||||
CFLAGS=$_cloog_saved_CFLAGS
|
||||
LDFLAGS=$_cloog_saved_LDFLAGS
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
# CLOOG_IF_FAILED (ACTION-IF-FAILED)
|
||||
# ----------------------------------
|
||||
# Executes ACTION-IF-FAILED, if GRAPHITE was requested and
|
||||
# the checks failed.
|
||||
AC_DEFUN([CLOOG_IF_FAILED],
|
||||
[
|
||||
CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no])
|
||||
|
||||
if test "${gcc_cv_cloog_ct_0_14_0}" = no \
|
||||
|| test "${gcc_cv_cloog_rt_0_14_0}" = no \
|
||||
|| test "${gcc_cv_cloog_ct_0_15_5}" = no; then
|
||||
clooglibs=
|
||||
clooginc=
|
||||
fi
|
||||
|
||||
if test "${graphite_requested}" = yes \
|
||||
&& test "x${clooglibs}" = x \
|
||||
&& test "x${clooginc}" = x ; then
|
||||
$1
|
||||
fi
|
||||
]
|
||||
)
|
23
newlib/src/config/codeset.m4
Normal file
23
newlib/src/config/codeset.m4
Normal file
|
@ -0,0 +1,23 @@
|
|||
# codeset.m4 serial AM1 (gettext-0.10.40)
|
||||
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
|
||||
dnl This file is free software, distributed under the terms of the GNU
|
||||
dnl General Public License. As a special exception to the GNU General
|
||||
dnl Public License, this file may be distributed as part of a program
|
||||
dnl that contains a configuration script generated by Autoconf, under
|
||||
dnl the same distribution terms as the rest of that program.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_LANGINFO_CODESET],
|
||||
[
|
||||
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
|
||||
[AC_TRY_LINK([#include <langinfo.h>],
|
||||
[char* cs = nl_langinfo(CODESET);],
|
||||
am_cv_langinfo_codeset=yes,
|
||||
am_cv_langinfo_codeset=no)
|
||||
])
|
||||
if test $am_cv_langinfo_codeset = yes; then
|
||||
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
|
||||
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
|
||||
fi
|
||||
])
|
137
newlib/src/config/depstand.m4
Normal file
137
newlib/src/config/depstand.m4
Normal file
|
@ -0,0 +1,137 @@
|
|||
## -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# Based on depend.m4 from automake 1.9, modified for standalone use in
|
||||
# an environment where GNU make is required.
|
||||
|
||||
# ZW_PROG_COMPILER_DEPENDENCIES
|
||||
# -----------------------------
|
||||
# Variant of _AM_DEPENDENCIES which just does the dependency probe and
|
||||
# sets fooDEPMODE accordingly. Cache-variable compatible with
|
||||
# original; not side-effect compatible. As the users of this macro
|
||||
# may require accurate dependencies for correct builds, it does *not*
|
||||
# honor --disable-dependency-checking, and failure to detect a usable
|
||||
# method is an error. depcomp is assumed to be located in
|
||||
# $ac_aux_dir.
|
||||
#
|
||||
# FIXME: Should use the Autoconf 2.5x language-selection mechanism.
|
||||
|
||||
AC_DEFUN([ZW_PROG_COMPILER_DEPENDENCIES],
|
||||
[ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
am_depcomp=$ac_aux_dir/depcomp
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
if test $depmode = none; then break; fi
|
||||
|
||||
_AS_ECHO([$as_me:$LINENO: trying $depmode], AS_MESSAGE_LOG_FD)
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "include sub/conftest.Po" > confmf
|
||||
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
depcmd="depmode=$depmode \
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c"
|
||||
echo "| $depcmd" | sed -e 's/ */ /g' >&AS_MESSAGE_LOG_FD
|
||||
if env $depcmd > conftest.err 2>&1 &&
|
||||
grep sub/conftst6.h sub/conftest.Po >>conftest.err 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po >>conftest.err 2>&1 &&
|
||||
${MAKE-make} -s -f confmf >>conftest.err 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
_AS_ECHO([$as_me:$LINENO: success], AS_MESSAGE_LOG_FD)
|
||||
break
|
||||
fi
|
||||
fi
|
||||
_AS_ECHO([$as_me:$LINENO: failure, diagnostics are:], AS_MESSAGE_LOG_FD)
|
||||
sed -e 's/^/| /' < conftest.err >&AS_MESSAGE_LOG_FD
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
if test x${am_cv_$1_dependencies_compiler_type-none} = xnone
|
||||
then AC_MSG_ERROR([no usable dependency style found])
|
||||
else AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
fi
|
||||
])
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
# ZW_CREATE_DEPDIR
|
||||
# ----------------
|
||||
# As AM_SET_DEPDIR, but also create the directory at config.status time.
|
||||
AC_DEFUN([ZW_CREATE_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_CONFIG_COMMANDS([depdir], [$SHELL $ac_aux_dir/mkinstalldirs $DEPDIR],
|
||||
[ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
|
||||
])
|
56
newlib/src/config/dfp.m4
Normal file
56
newlib/src/config/dfp.m4
Normal file
|
@ -0,0 +1,56 @@
|
|||
dnl @synopsis GCC_AC_ENABLE_DECIMAL_FLOAT([target triplet])
|
||||
dnl
|
||||
dnl Enable C extension for decimal float if target supports it.
|
||||
dnl
|
||||
dnl @author Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
|
||||
|
||||
AC_DEFUN([GCC_AC_ENABLE_DECIMAL_FLOAT],
|
||||
[
|
||||
AC_ARG_ENABLE(decimal-float,
|
||||
[ --enable-decimal-float={no,yes,bid,dpd}
|
||||
enable decimal float extension to C. Selecting 'bid'
|
||||
or 'dpd' choses which decimal floating point format
|
||||
to use],
|
||||
[
|
||||
case $enable_decimal_float in
|
||||
yes | no | bid | dpd) default_decimal_float=$enable_decimal_float ;;
|
||||
*) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float.
|
||||
Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;;
|
||||
esac
|
||||
],
|
||||
[
|
||||
case $1 in
|
||||
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
|
||||
i?86*-*-mingw* | x86_64*-*-mingw* | \
|
||||
i?86*-*-cygwin*)
|
||||
enable_decimal_float=yes
|
||||
;;
|
||||
*)
|
||||
AC_MSG_WARN([decimal float is not supported for this target, ignored])
|
||||
enable_decimal_float=no
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# x86's use BID format instead of DPD
|
||||
case x$enable_decimal_float in
|
||||
xyes)
|
||||
case $1 in
|
||||
i?86*-*-* | x86_64*-*-*)
|
||||
enable_decimal_float=bid
|
||||
;;
|
||||
*)
|
||||
enable_decimal_float=dpd
|
||||
;;
|
||||
esac
|
||||
default_decimal_float=$enable_decimal_float
|
||||
;;
|
||||
xno)
|
||||
# ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper
|
||||
# dependency on libdecnumber.
|
||||
default_decimal_float=dpd
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(enable_decimal_float)
|
||||
|
||||
])
|
27
newlib/src/config/elf.m4
Normal file
27
newlib/src/config/elf.m4
Normal file
|
@ -0,0 +1,27 @@
|
|||
dnl Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
||||
dnl This file is free software, distributed under the terms of the GNU
|
||||
dnl General Public License. As a special exception to the GNU General
|
||||
dnl Public License, this file may be distributed as part of a program
|
||||
dnl that contains a configuration script generated by Autoconf, under
|
||||
dnl the same distribution terms as the rest of that program.
|
||||
|
||||
dnl From Paolo Bonzini.
|
||||
|
||||
dnl usage: ACX_ELF_TARGET_IFELSE([if-elf], [if-not-elf])
|
||||
AC_DEFUN([ACX_ELF_TARGET_IFELSE], [
|
||||
AC_REQUIRE([AC_CANONICAL_TARGET])
|
||||
|
||||
target_elf=no
|
||||
case $target in
|
||||
*-darwin* | *-aix* | *-cygwin* | *-mingw* | *-aout* | *-*coff* | \
|
||||
*-msdosdjgpp* | *-vms* | *-wince* | *-*-pe* | \
|
||||
alpha*-dec-osf* | *-interix* | hppa[[12]]*-*-hpux*)
|
||||
target_elf=no
|
||||
;;
|
||||
*)
|
||||
target_elf=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
AS_IF([test $target_elf = yes], [$1], [$2])
|
||||
])
|
38
newlib/src/config/enable.m4
Normal file
38
newlib/src/config/enable.m4
Normal file
|
@ -0,0 +1,38 @@
|
|||
dnl ----------------------------------------------------------------------
|
||||
dnl This whole bit snagged from libstdc++-v3.
|
||||
|
||||
dnl
|
||||
dnl GCC_ENABLE
|
||||
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
|
||||
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
|
||||
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
|
||||
dnl
|
||||
dnl See docs/html/17_intro/configury.html#enable for documentation.
|
||||
dnl
|
||||
AC_DEFUN([GCC_ENABLE],[dnl
|
||||
m4_define([_g_switch],[--enable-$1])dnl
|
||||
m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
|
||||
AC_ARG_ENABLE($1,_g_help,
|
||||
m4_bmatch([$5],
|
||||
[^permit ],
|
||||
[[
|
||||
case "$enableval" in
|
||||
m4_bpatsubst([$5],[permit ])) ;;
|
||||
*) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
|
||||
dnl Idea for future: generate a URL pointing to
|
||||
dnl "onlinedocs/configopts.html#whatever"
|
||||
esac
|
||||
]],
|
||||
[^$],
|
||||
[[
|
||||
case "$enableval" in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
|
||||
esac
|
||||
]],
|
||||
[[$5]]),
|
||||
[enable_]m4_bpatsubst([$1],-,_)[=][$2])
|
||||
m4_undefine([_g_switch])dnl
|
||||
m4_undefine([_g_help])dnl
|
||||
])
|
||||
|
79
newlib/src/config/extensions.m4
Normal file
79
newlib/src/config/extensions.m4
Normal file
|
@ -0,0 +1,79 @@
|
|||
# serial 6 -*- Autoconf -*-
|
||||
# Enable extensions on systems that normally disable them.
|
||||
|
||||
# Copyright (C) 2003, 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
|
||||
# Autoconf. Perhaps we can remove this once we can assume Autoconf
|
||||
# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
|
||||
# enough in this area it's likely we'll need to redefine
|
||||
# AC_USE_SYSTEM_EXTENSIONS for quite some time.
|
||||
|
||||
m4_version_prereq([2.62],, [
|
||||
|
||||
# AC_USE_SYSTEM_EXTENSIONS
|
||||
# ------------------------
|
||||
# Enable extensions on systems that normally disable them,
|
||||
# typically due to standards-conformance issues.
|
||||
# Remember that #undef in AH_VERBATIM gets replaced with #define by
|
||||
# AC_DEFINE. The goal here is to define all known feature-enabling
|
||||
# macros, then, if reports of conflicts are made, disable macros that
|
||||
# cause problems on some platforms (such as __EXTENSIONS__).
|
||||
AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
|
||||
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
|
||||
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
|
||||
|
||||
AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
|
||||
if test "$MINIX" = yes; then
|
||||
AC_DEFINE([_POSIX_SOURCE], [1],
|
||||
[Define to 1 if you need to in order for `stat' and other
|
||||
things to work.])
|
||||
AC_DEFINE([_POSIX_1_SOURCE], [2],
|
||||
[Define to 2 if the system does not provide POSIX.1 features
|
||||
except with this defined.])
|
||||
AC_DEFINE([_MINIX], [1],
|
||||
[Define to 1 if on MINIX.])
|
||||
fi
|
||||
|
||||
AH_VERBATIM([__EXTENSIONS__],
|
||||
[/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
])
|
||||
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
|
||||
[ac_cv_safe_to_define___extensions__],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
# define __EXTENSIONS__ 1
|
||||
AC_INCLUDES_DEFAULT])],
|
||||
[ac_cv_safe_to_define___extensions__=yes],
|
||||
[ac_cv_safe_to_define___extensions__=no])])
|
||||
test $ac_cv_safe_to_define___extensions__ = yes &&
|
||||
AC_DEFINE([__EXTENSIONS__])
|
||||
AC_DEFINE([_ALL_SOURCE])
|
||||
AC_DEFINE([_GNU_SOURCE])
|
||||
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
|
||||
AC_DEFINE([_TANDEM_SOURCE])
|
||||
])# AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
])
|
64
newlib/src/config/futex.m4
Normal file
64
newlib/src/config/futex.m4
Normal file
|
@ -0,0 +1,64 @@
|
|||
dnl ----------------------------------------------------------------------
|
||||
dnl This whole bit snagged from libgomp.
|
||||
|
||||
dnl
|
||||
dnl GCC_LINUX_FUTEX
|
||||
dnl (SHELL-CODE_HANDLER)
|
||||
dnl
|
||||
AC_DEFUN([GCC_LINUX_FUTEX],[dnl
|
||||
GCC_ENABLE(linux-futex,default, ,[use the Linux futex system call],
|
||||
permit yes|no|default)
|
||||
case "$target" in
|
||||
*-linux*)
|
||||
case "$enable_linux_futex" in
|
||||
default)
|
||||
# If headers don't have gettid/futex syscalls definition, then
|
||||
# default to no, otherwise there will be compile time failures.
|
||||
# Otherwise, default to yes. If we don't detect we are
|
||||
# compiled/linked against NPTL and not cross-compiling, check
|
||||
# if programs are run by default against NPTL and if not, issue
|
||||
# a warning.
|
||||
enable_linux_futex=no
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <sys/syscall.h>
|
||||
int lk;],
|
||||
[syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],
|
||||
[save_LIBS="$LIBS"
|
||||
LIBS="-lpthread $LIBS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
pthread_t th; void *status;],
|
||||
[pthread_tryjoin_np (th, &status);])],[enable_linux_futex=yes],
|
||||
[if test x$cross_compiling = xno; then
|
||||
if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null \
|
||||
| LC_ALL=C grep -i NPTL > /dev/null 2>/dev/null; then :; else
|
||||
AC_MSG_WARN([The kernel might not support futex or gettid syscalls.
|
||||
If so, please configure with --disable-linux-futex])
|
||||
fi
|
||||
fi
|
||||
enable_linux_futex=yes])
|
||||
LIBS="$save_LIBS"])
|
||||
;;
|
||||
yes)
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <sys/syscall.h>
|
||||
int lk;],
|
||||
[syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],[],
|
||||
[AC_MSG_ERROR([SYS_gettid and SYS_futex required for --enable-linux-futex])])
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
enable_linux_futex=no
|
||||
;;
|
||||
esac
|
||||
if test x$enable_linux_futex = xyes; then
|
||||
$1
|
||||
fi
|
||||
])
|
26
newlib/src/config/gc++filt.m4
Normal file
26
newlib/src/config/gc++filt.m4
Normal file
|
@ -0,0 +1,26 @@
|
|||
# gc++filt.m4 serial 1 -*- Autoconf -*-
|
||||
# Find an instance of GNU c++filt on PATH.
|
||||
|
||||
dnl Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
dnl This file is free software, distributed under the terms of the GNU
|
||||
dnl General Public License. As a special exception to the GNU General
|
||||
dnl Public License, this file may be distributed as part of a program
|
||||
dnl that contains a configuration script generated by Autoconf, under
|
||||
dnl the same distribution terms as the rest of that program.
|
||||
|
||||
dnl From Rainer Orth.
|
||||
|
||||
# GCC_PROG_GNU_CXXFILT
|
||||
# --------------------
|
||||
# Check for GNU c++filt.
|
||||
# FIXME: Maybe need TARGET variant, though c++filt should be target
|
||||
# independent.
|
||||
AC_DEFUN([GCC_PROG_GNU_CXXFILT],
|
||||
[AC_ARG_VAR([CXXFILT], [Location of GNU c++filt. Defaults to the first
|
||||
GNU version of `c++filt', `gc++filt' on PATH.])
|
||||
AC_CACHE_CHECK([for GNU c++filt], [ac_cv_path_CXXFILT],
|
||||
[AC_PATH_PROGS_FEATURE_CHECK([CXXFILT], [c++filt gc++filt],
|
||||
[_AC_PATH_PROG_FLAVOR_GNU([$ac_path_CXXFILT],
|
||||
[ac_cv_path_CXXFILT=$ac_path_CXXFILT && ac_path_CXXFILT_found=:])])])
|
||||
CXXFILT=$ac_cv_path_CXXFILT
|
||||
])
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue