text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<TITLE>Lua 5.2 Reference Manual - contents</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1">

Lua 5.2 Reference Manual

The reference manual is the official definition of the Lua language.
For a complete introduction to Lua programming, see the book
Programming in Lua.

start
·
contents
·
index

Copyright © 2011–2013 Lua.org, PUC-Rio.
Freely available under the terms of the
Lua license.

Contents

1 – Introduction

2 – Basic Concepts

2.1 – Values and Types

2.2 – Environments and the Global Environment

2.3 – Error Handling

2.4 – Metatables and Metamethods

2.5 – Garbage Collection

2.5.1 – Garbage-Collection Metamethods

2.5.2 – Weak Tables

2.6 – Coroutines

3 – The Language

3.1 – Lexical Conventions

3.2 – Variables

3.3 – Statements

3.3.1 – Blocks

3.3.2 – Chunks

3.3.3 – Assignment

3.3.4 – Control Structures

3.3.5 – For Statement

3.3.6 – Function Calls as Statements

3.3.7 – Local Declarations

3.4 – Expressions

3.4.1 – Arithmetic Operators

3.4.2 – Coercion

3.4.3 – Relational Operators

3.4.4 – Logical Operators

3.4.5 – Concatenation

3.4.6 – The Length Operator

3.4.7 – Precedence

3.4.8 – Table Constructors

3.4.9 – Function Calls

3.4.10 – Function Definitions

3.5 – Visibility Rules

4 – The Application Program Interface

4.1 – The Stack

4.2 – Stack Size

4.3 – Valid and Acceptable Indices

4.4 – C Closures

4.5 – Registry

4.6 – Error Handling in C

4.7 – Handling Yields in C

4.8 – Functions and Types

4.9 – The Debug Interface

5 – The Auxiliary Library

5.1 – Functions and Types

6 – Standard Libraries

6.1 – Basic Functions

6.2 – Coroutine Manipulation

6.3 – Modules

6.4 – String Manipulation

6.4.1 – Patterns

6.5 – Table Manipulation

6.6 – Mathematical Functions

6.7 – Bitwise Operations

6.8 – Input and Output Facilities

6.9 – Operating System Facilities

6.10 – The Debug Library

7 – Lua Standalone

8 – Incompatibilities with the Previous Version

8.1 – Changes in the Language

8.2 – Changes in the Libraries

8.3 – Changes in the API

9 – The Complete Syntax of Lua

Index

Lua functions

_G

_VERSION

assert

collectgarbage

dofile

error

getmetatable

ipairs

load

loadfile

next

pairs

pcall

print

rawequal

rawget

rawlen

rawset

require

select

setmetatable

tonumber

tostring

type

xpcall

bit32.arshift

bit32.band

bit32.bnot

bit32.bor

bit32.btest

bit32.bxor

bit32.extract

bit32.lrotate

bit32.lshift

bit32.replace

bit32.rrotate

bit32.rshift

coroutine.create

coroutine.resume

coroutine.running

coroutine.status

coroutine.wrap

coroutine.yield

debug.debug

debug.getuservalue

debug.gethook

debug.getinfo

debug.getlocal

debug.getmetatable

debug.getregistry

debug.getupvalue

debug.setuservalue

debug.sethook

debug.setlocal

debug.setmetatable

debug.setupvalue

debug.traceback

debug.upvalueid

debug.upvaluejoin

file:close

file:flush

file:lines

file:read

file:seek

file:setvbuf

file:write

io.close

io.flush

io.input

io.lines

io.open

io.output

io.popen

io.read

io.stderr

io.stdin

io.stdout

io.tmpfile

io.type

io.write

math.abs

math.acos

math.asin

math.atan

math.atan2

math.ceil

math.cos

math.cosh

math.deg

math.exp

math.floor

math.fmod

math.frexp

math.huge

math.ldexp

math.log

math.max

math.min

math.modf

math.pi

math.pow

math.rad

math.random

math.randomseed

math.sin

math.sinh

math.sqrt

math.tan

math.tanh

os.clock

os.date

os.difftime

os.execute

os.exit

os.getenv

os.remove

os.rename

os.setlocale

os.time

os.tmpname

package.config

package.cpath

package.loaded

package.loadlib

package.path

package.preload

package.searchers

package.searchpath

string.byte

string.char

string.dump

string.find

string.format

string.gmatch

string.gsub

string.len

string.lower

string.match

string.rep

string.reverse

string.sub

string.upper

table.concat

table.insert

table.pack

table.remove

table.sort

table.unpack

C API

lua_Alloc

lua_CFunction

lua_Debug

lua_Hook

lua_Integer

lua_Number

lua_Reader

lua_State

lua_Unsigned

lua_Writer

lua_absindex

lua_arith

lua_atpanic

lua_call

lua_callk

lua_checkstack

lua_close

lua_compare

lua_concat

lua_copy

lua_createtable

lua_dump

lua_error

lua_gc

lua_getallocf

lua_getctx

lua_getfield

lua_getglobal

lua_gethook

lua_gethookcount

lua_gethookmask

lua_getinfo

lua_getlocal

lua_getmetatable

lua_getstack

lua_gettable

lua_gettop

lua_getupvalue

lua_getuservalue

lua_insert

lua_isboolean

lua_iscfunction

lua_isfunction

lua_islightuserdata

lua_isnil

lua_isnone

lua_isnoneornil

lua_isnumber

lua_isstring

lua_istable

lua_isthread

lua_isuserdata

lua_len

lua_load

lua_newstate

lua_newtable

lua_newthread

lua_newuserdata

lua_next

lua_pcall

lua_pcallk

lua_pop

lua_pushboolean

lua_pushcclosure

lua_pushcfunction

lua_pushfstring

lua_pushglobaltable

lua_pushinteger

lua_pushlightuserdata

lua_pushliteral

lua_pushlstring

lua_pushnil

lua_pushnumber

lua_pushstring

lua_pushthread

lua_pushunsigned

lua_pushvalue

lua_pushvfstring

lua_rawequal

lua_rawget

lua_rawgeti

lua_rawgetp

lua_rawlen

lua_rawset

lua_rawseti

lua_rawsetp

lua_register

lua_remove

lua_replace

lua_resume

lua_setallocf

lua_setfield

lua_setglobal

lua_sethook

lua_setlocal

lua_setmetatable

lua_settable

lua_settop

lua_setupvalue

lua_setuservalue

lua_status

lua_toboolean

lua_tocfunction

lua_tointeger

lua_tointegerx

lua_tolstring

lua_tonumber

lua_tonumberx

lua_topointer

lua_tostring

lua_tothread

lua_tounsigned

lua_tounsignedx

lua_touserdata

lua_type

lua_typename

lua_upvalueid

lua_upvalueindex

lua_upvaluejoin

lua_version

lua_xmove

lua_yield

lua_yieldk

auxiliary library

luaL_Buffer

luaL_Reg

luaL_addchar

luaL_addlstring

luaL_addsize

luaL_addstring

luaL_addvalue

luaL_argcheck

luaL_argerror

luaL_buffinit

luaL_buffinitsize

luaL_callmeta

luaL_checkany

luaL_checkint

luaL_checkinteger

luaL_checklong

luaL_checklstring

luaL_checknumber

luaL_checkoption

luaL_checkstack

luaL_checkstring

luaL_checktype

luaL_checkudata

luaL_checkunsigned

luaL_checkversion

luaL_dofile

luaL_dostring

luaL_error

luaL_execresult

luaL_fileresult

luaL_getmetafield

luaL_getmetatable

luaL_getsubtable

luaL_gsub

luaL_len

luaL_loadbuffer

luaL_loadbufferx

luaL_loadfile

luaL_loadfilex

luaL_loadstring

luaL_newlib

luaL_newlibtable

luaL_newmetatable

luaL_newstate

luaL_openlibs

luaL_optint

luaL_optinteger

luaL_optlong

luaL_optlstring

luaL_optnumber

luaL_optstring

luaL_optunsigned

luaL_prepbuffer

luaL_prepbuffsize

luaL_pushresult

luaL_pushresultsize

luaL_ref

luaL_requiref

luaL_setfuncs

luaL_setmetatable

luaL_testudata

luaL_tolstring

luaL_traceback

luaL_typename

luaL_unref

luaL_where

Last update:
Tue Mar 12 11:22:18 BRT 2013

repo_language: C

mime_type: text/x-c


text:
.\" $Id: luac.man,v 1.29 2011/11/16 13:53:40 lhf Exp $
.TH LUAC 1 "$Date: 2011/11/16 13:53:40 $"
.SH NAME
luac \- Lua compiler
.SH SYNOPSIS
.B luac
[
.I options
] [
.I filenames
]
.SH DESCRIPTION
.B luac
is the Lua compiler.
It translates programs written in the Lua programming language
into binary files containing precompiled chunks
that can be later loaded and executed.
.LP
The main advantages of precompiling chunks are:
faster loading,
protecting source code from accidental user changes,
and
off-line syntax checking.
Precompiling does not imply faster execution
because in Lua chunks are always compiled into bytecodes before being executed.
.B luac
simply allows those bytecodes to be saved in a file for later execution.
Precompiled chunks are not necessarily smaller than the corresponding source.
The main goal in precompiling is faster loading.
.LP
In the command line,
you can mix
text files containing Lua source and
binary files containing precompiled chunks.
.B luac
produces a single output file containing the combined bytecodes
for all files given.
Executing the combined file is equivalent to executing the given files.
By default,
the output file is named
.BR luac.out ,
but you can change this with the
.B \-o
option.
.LP
Precompiled chunks are
.I not
portable across different architectures.
Moreover,
the internal format of precompiled chunks
is likely to change when a new version of Lua is released.
Make sure you save the source files of all Lua programs that you precompile.
.LP
.SH OPTIONS
.TP
.B \-l
produce a listing of the compiled bytecode for Lua's virtual machine.
Listing bytecodes is useful to learn about Lua's virtual machine.
If no files are given, then
.B luac
loads
.B luac.out
and lists its contents.
Use
.B \-l \-l
for a full listing.
.TP
.BI \-o " file"
output to
.IR file ,
instead of the default
.BR luac.out .
(You can use
.B "'\-'"
for standard output,
but not on platforms that open standard output in text mode.)
The output file may be one of the given files because
all files are loaded before the output file is written.
Be careful not to overwrite precious files.
.TP
.B \-p
load files but do not generate any output file.
Used mainly for syntax checking and for testing precompiled chunks:
corrupted files will probably generate errors when loaded.
If no files are given, then
.B luac
loads
.B luac.out
and tests its contents.
No messages are displayed if the file loads without errors.
.TP
.B \-s
strip debug information before writing the output file.
This saves some space in very large chunks,
but if errors occur when running a stripped chunk,
then the error messages may not contain the full information they usually do.
In particular,
line numbers and names of local variables are lost.
.TP
.B \-v
show version information.
.TP
.B \-\-
stop handling options.
.TP
.B \-
stop handling options and process standard input.
.SH "SEE ALSO"
.BR lua (1)
.br
The documentation at lua.org.
.SH DIAGNOSTICS
Error messages should be self explanatory.
.SH AUTHORS
R. Ierusalimschy,
L. H. de Figueiredo,
W. Celes
.\" EOF


text:
html {
	background-color: #F8F8F8 ;
}

body {
	border: solid #a0a0a0 1px ;
	border-radius: 20px ;
	padding: 26px ;
	margin: 16px ;
	color: #000000 ;
	background-color: #FFFFFF ;
	font-family: Helvetica, Arial, sans-serif ;
	text-align: justify ;
}

h1, h2, h3, h4 {
	font-family: Verdana, Geneva, sans-serif ;
	font-weight: normal ;
	font-style: normal ;
}

h2 {
	padding-top: 0.4em ;
	padding-bottom: 0.4em ;
	padding-left: 0.8em ;
	padding-right: 0.8em ;
	background-color: #D0D0FF ;
	border-radius: 8px ;
	border: solid #a0a0a0 1px ;
}

h3 {
	padding-left: 0.5em ;
	border-left: solid #D0D0FF 1em ;
}

table h3 {
	padding-left: 0px ;
	border-left: none ;
}

a:link {
	color: #000080 ;
	background-color: inherit ;
	text-decoration: none ;
}

a:visited {
	background-color: inherit ;
	text-decoration: none ;
}

a:link:hover, a:visited:hover {
	color: #000080 ;
	background-color: #D0D0FF ;
}

a:link:active, a:visited:active {
	color: #FF0000 ;
}

hr {
	border: 0 ;
	height: 1px ;
	color: #a0a0a0 ;
	background-color: #a0a0a0 ;
	display: none ;
}

table hr {
	display: block ;
}

:target {
	background-color: #F8F8F8 ;
	padding: 8px ;
	border: solid #a0a0a0 2px ;
	border-radius: 8px ;
}

.footer {
	color: gray ;
	font-size: x-small ;
}

input[type=text] {
	border: solid #a0a0a0 2px ;
	border-radius: 2em ;
	-moz-border-radius: 2em ;
	background-image: url('images/search.png') ;
	background-repeat: no-repeat;
	background-position: 4px center ;
	padding-left: 20px ;
	height: 2em ;
}


text:
.\" $Id: lua.man,v 1.13 2011/11/16 17:16:53 lhf Exp $
.TH LUA 1 "$Date: 2011/11/16 17:16:53 $"
.SH NAME
lua \- Lua interpreter
.SH SYNOPSIS
.B lua
[
.I options
]
[
.I script
[
.I args
]
]
.SH DESCRIPTION
.B lua
is the standalone Lua interpreter.
It loads and executes Lua programs,
either in textual source form or
in precompiled binary form.
(Precompiled binaries are output by
.BR luac ,
the Lua compiler.)
.B lua
can be used as a batch interpreter and also interactively.
.LP
The given
.I options
are handled in order and then
the Lua program in file
.I script
is loaded and executed.
The given
.I args
are available to
.I script
as strings in a global table named
.BR arg .
If no options or arguments are given,
then
.B "\-v \-i"
is assumed when the standard input is a terminal;
otherwise,
.B "\-"
is assumed.
.LP
In interactive mode,
.B lua
prompts the user,
reads lines from the standard input,
and executes them as they are read.
If a line does not contain a complete statement,
then a secondary prompt is displayed and
lines are read until a complete statement is formed or
a syntax error is found.
If a line starts with
.BR '=' ,
then
.B lua
evaluates and displays
the values of the expressions in the remainder of the line.
.LP
At the very start,
before even handling the command line,
.B lua
checks the contents of the environment variables
.B LUA_INIT_5_2
or
.BR LUA_INIT ,
in that order.
If the contents is of the form
.RI '@ filename ',
then
.I filename
is executed.
Otherwise, the string is assumed to be a Lua statement and is executed.
.SH OPTIONS
.TP
.BI \-e " stat"
execute statement
.IR stat .
.TP
.B \-i
enter interactive mode after executing
.IR script .
.TP
.BI \-l " name"
execute the equivalent of
.IB name =require(' name ')
before executing
.IR script .
.TP
.B \-v
show version information.
.TP
.B \-E
ignore environment variables.
.TP
.B \-\-
stop handling options.
.TP
.B \-
stop handling options and execute the standard input as a file.
.SH "SEE ALSO"
.BR luac (1)
.br
The documentation at lua.org,
especially section 7 of the reference manual.
.SH DIAGNOSTICS
Error messages should be self explanatory.
.SH AUTHORS
R. Ierusalimschy,
L. H. de Figueiredo,
W. Celes
.\" EOF


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<TITLE>Lua 5.2 readme</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1">

Welcome to Lua 5.2

about
·
installation
·
changes
·
license
·
reference manual

About Lua

Lua is a powerful, fast, lightweight, embeddable scripting language
developed by a
team
at
PUC-Rio,
the Pontifical Catholic University of Rio de Janeiro in Brazil.
Lua is
free software
used in many products and projects around the world.

Lua's
official web site
provides complete information
about Lua,
including
an
executive summary
and
updated
documentation,
especially the
reference manual,
which may differ slightly from the
local copy
distributed in this package.

Installing Lua

Lua is distributed in
source
form.
You need to build it before using it.
Building Lua should be straightforward
because
Lua is implemented in pure ANSI C and compiles unmodified in all known
platforms that have an ANSI C compiler.
Lua also compiles unmodified as C++.
The instructions given below for building Lua are for Unix-like platforms.
See also
instructions for other systems
and
customization options.

If you don't have the time or the inclination to compile Lua yourself,
get a binary from
LuaBinaries.
Try also
Lua for Windows,
an easy-to-use distribution of Lua that includes many useful libraries.

Building Lua

In most Unix-like platforms, simply do "make" with a suitable target.
Here are the details.

Open a terminal window and move to
the top-level directory, which is named <TT>lua-5.2.3</TT>.
The Makefile there controls both the build process and the installation process.

  Do "make" and see if your platform is listed.
  The platforms currently supported are:

   aix ansi bsd freebsd generic linux macosx mingw posix solaris

  If your platform is listed, just do "make xxx", where xxx
  is your platform name.

  If your platform is not listed, try the closest one or posix, generic,
  ansi, in this order.

The compilation takes only a few moments
and produces three files in the <TT>src</TT> directory:
lua (the interpreter),
luac (the compiler),
and liblua.a (the library).

  To check that Lua has been built correctly, do "make test"
  after building Lua. This will run the interpreter and print its version string.

If you're running Linux and get compilation errors,
make sure you have installed the <TT>readline</TT> development package.
If you get link errors after that,
then try "make linux MYLIBS=-ltermcap".

Installing Lua

  Once you have built Lua, you may want to install it in an official
  place in your system. In this case, do "make install". The official
  place and the way to install files are defined in the Makefile. You'll
  probably need the right permissions to install files.

  To build and install Lua in one step, do "make xxx install",
  where xxx is your platform name.

  To install Lua locally, do "make local".
  This will create a directory <TT>install</TT> with subdirectories
  <TT>bin</TT>, <TT>include</TT>, <TT>lib</TT>, <TT>man</TT>,
  and install Lua as listed below.

  To install Lua locally, but in some other directory, do
  "make install INSTALL_TOP=xxx", where xxx is your chosen directory.

    bin:

    lua luac

    include:

    lua.h luaconf.h lualib.h lauxlib.h lua.hpp

    lib:

    liblua.a

    man/man1:

    lua.1 luac.1

  These are the only directories you need for development.
  If you only want to run Lua programs,
  you only need the files in bin and man.
  The files in include and lib are needed for
  embedding Lua in C or C++ programs.

Customization

  Three kinds of things can be customized by editing a file:

 Where and how to install Lua — edit <TT>Makefile</TT>.

 How to build Lua — edit <TT>src/Makefile</TT>.

 Lua features — edit <TT>src/luaconf.h</TT>.

  You don't actually need to edit the Makefiles because you may set the
  relevant variables in the command line when invoking make.
  Nevertheless, it's probably best to edit and save the Makefiles to
  record the changes you need.

  On the other hand, if you need to customize some Lua features, you'll need
  to edit <TT>src/luaconf.h</TT> before building and installing Lua.
  The edited file will be the one installed, and
  it will be used by any Lua clients that you build, to ensure consistency.
  Further customization is available to experts by editing the Lua sources.

  We strongly recommend that you enable dynamic loading in <TT>src/luaconf.h</TT>.
  This is done automatically for all platforms listed above that have
  this feature and also for Windows.

Building Lua on other systems

  If you're not using the usual Unix tools, then the instructions for
  building Lua depend on the compiler you use. You'll need to create
  projects (or whatever your compiler uses) for building the library,
  the interpreter, and the compiler, as follows:

library:

lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c
lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c
ltm.c lundump.c lvm.c lzio.c
lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c
lmathlib.c loslib.c lstrlib.c ltablib.c loadlib.c linit.c

interpreter:

  library, lua.c

compiler:

  library, luac.c

  To use Lua as a library in your own programs you'll need to know how to
  create and use libraries with your compiler. Moreover, to dynamically load
  C libraries for Lua you'll need to know how to create dynamic libraries
  and you'll need to make sure that the Lua API functions are accessible to
  those dynamic libraries — but don't link the Lua library
  into each dynamic library. For Unix, we recommend that the Lua library
  be linked statically into the host program and its symbols exported for
  dynamic linking; <TT>src/Makefile</TT> does this for the Lua interpreter.
  For Windows, we recommend that the Lua library be a DLL.

  As mentioned above, you may edit <TT>src/luaconf.h</TT> to customize
  some features before building Lua.

Changes since Lua 5.1

Here are the main changes introduced in Lua 5.2.
The
reference manual
lists the
incompatibilities that had to be introduced.

Main changes

 yieldable pcall and metamethods

 new lexical scheme for globals

 ephemeron tables

 new library for bitwise operations

 light C functions

 emergency garbage collector

 goto statement

 finalizers for tables

Here are the other changes introduced in Lua 5.2:

Language

 no more fenv for threads or functions

 tables honor the __len metamethod

 hex and \z escapes in strings

 support for hexadecimal floats

 order metamethods work for different types

 no more verification of opcode consistency

 hook event "tail return" replaced by "tail call"

 empty statement

 break statement may appear in the middle of a block

Libraries

 arguments for function called through xpcall

 optional 'mode' argument to load and loadfile (to control binary x text)

 optional 'env' argument to load and loadfile (environment for loaded chunk)

 loadlib may load libraries with global names (RTLD_GLOBAL)

 new function package.searchpath

 modules receive their paths when loaded

 optional base in math.log

 optional separator in string.rep

 file:write returns file

 closing a pipe returns exit status

 os.exit may close state

 new metamethods __pairs and __ipairs

 new option 'isrunning' for collectgarbage and lua_gc

 frontier patterns

 \0 in patterns

 new option *L for io.read

 options for io.lines

 debug.getlocal can access function varargs

C API

 main thread predefined in the registry

 new functions
lua_absindex,
lua_arith,
lua_compare,
lua_copy,
lua_len,
lua_rawgetp,
lua_rawsetp,
lua_upvalueid,
lua_upvaluejoin,
lua_version.

 new functions
luaL_checkversion,
luaL_setmetatable,
luaL_testudata,
luaL_tolstring.

 lua_pushstring and pushlstring return string

 nparams and isvararg available in debug API

 new lua_Unsigned

Implementation

 max constants per function raised to 226

 generational mode for garbage collection (experimental)

 NaN trick (experimental)

 internal (immutable) version of ctypes

 simpler implementation for string buffers

 parser uses much less C-stack space (no more auto arrays)

Lua standalone interpreter

 new -E option to avoid environment variables

 handling of non-string error messages

License

Lua is free software distributed under the terms of the
MIT license
reproduced below;
it may be used for any purpose, including commercial purposes,
at absolutely no cost without having to ask us.

The only requirement is that if you do use Lua,
then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.

For details, see
this.

Copyright © 1994–2013 Lua.org, PUC-Rio.

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
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Last update:
Sat Nov  9 22:39:16 BRST 2013


text:
#!/bin/sh

usage () {
cat <<EOF
Usage: $0 [OPTION]... [VAR=VALUE]... [TARGET]

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Installation directories:
  --prefix=PREFIX         main installation prefix [/usr/local/musl]
  --exec-prefix=EPREFIX   installation prefix for executable files [PREFIX]

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --libdir=DIR            library files for the linker [PREFIX/lib]
  --includedir=DIR        include files for the C compiler [PREFIX/include]
  --syslibdir=DIR         location for the dynamic linker [/lib]

System types:
  --target=TARGET         configure to run on target TARGET [detected]
  --host=HOST             same as --target

Optional features:
  --enable-optimize=...   optimize listed components for speed over size [auto]
  --enable-debug          build with debugging information [disabled]
  --enable-warnings       build with recommended warnings flags [disabled]
  --enable-gcc-wrapper    build musl-gcc toolchain wrapper [auto]
  --disable-shared        inhibit building shared library [enabled]
  --disable-static        inhibit building static library [enabled]

Some influential environment variables:
  CC                      C compiler command [detected]
  CFLAGS                  C compiler flags [-Os -pipe ...]
  CROSS_COMPILE           prefix for cross compiler and tools [none]
  LIBCC                   compiler runtime library [detected]

Use these variables to override the choices made by configure.

EOF
exit 0
}

# Helper functions

quote () {
tr '\n' ' ' <<EOF | grep '^[-[:alnum:]_=,./:]* $' >/dev/null 2>&1 && { echo "$1" ; return 0 ; }
$1
EOF
printf %s\\n "$1" | sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/" -e "s#^'\([-[:alnum:]_,./:]*\)=\(.*\)\$#\1='\2#"
}
echo () { printf "%s\n" "$*" ; }
fail () { echo "$*" ; exit 1 ; }
fnmatch () { eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac" ; }
cmdexists () { type "$1" >/dev/null 2>&1 ; }
trycc () { test -z "$CC" && cmdexists "$1" && CC=$1 ; }

stripdir () {
while eval "fnmatch '*/' \"\${$1}\"" ; do eval "$1=\${$1%/}" ; done
}

trycppif () {
printf "checking preprocessor condition %s... " "$1"
echo "typedef int x;" > "$tmpc"
echo "#if $1" >> "$tmpc"
echo "#error yes" >> "$tmpc"
echo "#endif" >> "$tmpc"
if $CC $2 -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
printf "false\n"
return 1
else
printf "true\n"
return 0
fi
}

tryflag () {
printf "checking whether compiler accepts %s... " "$2"
echo "typedef int x;" > "$tmpc"
if $CC "$2" -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
printf "yes\n"
eval "$1=\"\${$1} \$2\""
eval "$1=\${$1# }"
return 0
else
printf "no\n"
return 1
fi
}

tryldflag () {
printf "checking whether linker accepts %s... " "$2"
echo "typedef int x;" > "$tmpc"
if $CC -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
printf "yes\n"
eval "$1=\"\${$1} \$2\""
eval "$1=\${$1# }"
return 0
else
printf "no\n"
return 1
fi
}

# Beginning of actual script

CFLAGS_C99FSE=
CFLAGS_AUTO=
CFLAGS_MEMOPS=
LDFLAGS_AUTO=
OPTIMIZE_GLOBS=
prefix=/usr/local/musl
exec_prefix='$(prefix)'
bindir='$(exec_prefix)/bin'
libdir='$(prefix)/lib'
includedir='$(prefix)/include'
syslibdir='/lib'
target=
optimize=auto
debug=no
warnings=no
shared=auto
static=yes
wrapper=auto

for arg ; do
case "$arg" in
--help) usage ;;
--prefix=*) prefix=${arg#*=} ;;
--exec-prefix=*) exec_prefix=${arg#*=} ;;
--bindir=*) bindir=${arg#*=} ;;
--libdir=*) libdir=${arg#*=} ;;
--includedir=*) includedir=${arg#*=} ;;
--syslibdir=*) syslibdir=${arg#*=} ;;
--enable-shared|--enable-shared=yes) shared=yes ;;
--disable-shared|--enable-shared=no) shared=no ;;
--enable-static|--enable-static=yes) static=yes ;;
--disable-static|--enable-static=no) static=no ;;
--enable-optimize) optimize=yes ;;
--enable-optimize=*) optimize=${arg#*=} ;;
--disable-optimize) optimize=no ;;
--enable-debug|--enable-debug=yes) debug=yes ;;
--disable-debug|--enable-debug=no) debug=no ;;
--enable-warnings|--enable-warnings=yes) warnings=yes ;;
--disable-warnings|--enable-warnings=no) warnings=no ;;
--enable-gcc-wrapper|--enable-gcc-wrapper=yes) wrapper=yes ;;
--disable-gcc-wrapper|--enable-gcc-wrapper=no) wrapper=no ;;
--enable-*|--disable-*|--with-*|--without-*|--*dir=*|--build=*) ;;
--host=*|--target=*) target=${arg#*=} ;;
-* ) echo "$0: unknown option $arg" ;;
CC=*) CC=${arg#*=} ;;
CFLAGS=*) CFLAGS=${arg#*=} ;;
CPPFLAGS=*) CPPFLAGS=${arg#*=} ;;
LDFLAGS=*) LDFLAGS=${arg#*=} ;;
CROSS_COMPILE=*) CROSS_COMPILE=${arg#*=} ;;
LIBCC=*) LIBCC=${arg#*=} ;;
*=*) ;;
*) target=$arg ;;
esac
done

for i in prefix exec_prefix bindir libdir includedir syslibdir ; do
stripdir $i
done

#
# Get a temp filename we can use
#
i=0
set -C
while : ; do i=$(($i+1))
tmpc="./conf$$-$PPID-$i.c"
2>|/dev/null > "$tmpc" && break
test "$i" -gt 50 && fail "$0: cannot create temporary file $tmpc"
done
set +C
trap 'rm "$tmpc"' EXIT INT QUIT TERM HUP

#
# Find a C compiler to use
#
printf "checking for C compiler... "
trycc ${CROSS_COMPILE}gcc
trycc ${CROSS_COMPILE}c99
trycc ${CROSS_COMPILE}cc
printf "%s\n" "$CC"
test -n "$CC" || { echo "$0: cannot find a C compiler" ; exit 1 ; }

printf "checking whether C compiler works... "
echo "typedef int x;" > "$tmpc"
if output=$($CC $CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" 2>&1) ; then
printf "yes\n"
else
printf "no; compiler output follows:\n%s\n" "$output"
exit 1
fi

#
# Need to know if the compiler is gcc to decide whether to build the
# musl-gcc wrapper, and for critical bug detection in some gcc versions.
#
printf "checking whether compiler is gcc... "
if fnmatch '*gcc\ version*' "$($CC -v 2>&1)" ; then
cc_is_gcc=yes
else
cc_is_gcc=no
fi
echo "$cc_is_gcc"

#
# Only build musl-gcc wrapper if toolchain does not already target musl
#
if test "$wrapper" = auto ; then
printf "checking whether to build musl-gcc wrapper... "
if test "$cc_is_gcc" = yes ; then
wrapper=yes
while read line ; do
case "$line" in */ld-musl-*) wrapper=no ;; esac
done <<EOF
$($CC -dumpspecs)
EOF
else
wrapper=no
fi
echo "$wrapper"
fi

#
# Find the target architecture
#
printf "checking target system type... "
test -n "$target" || target=$($CC -dumpmachine 2>/dev/null) || target=unknown
printf "%s\n" "$target"

#
# Convert to just ARCH
#
case "$target" in
# Catch these early to simplify matching for 32-bit archs
mips64*|powerpc64*) fail "$0: unsupported target \"$target\"" ;;
arm*) ARCH=arm ;;
i?86*) ARCH=i386 ;;
x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
x86_64*) ARCH=x86_64 ;;
mips*) ARCH=mips ;;
microblaze*) ARCH=microblaze ;;
or1k*) ARCH=or1k ;;
powerpc*) ARCH=powerpc ;;
sh[1-9bel-]*|sh|superh*) ARCH=sh ;;
unknown) fail "$0: unable to detect target arch; try $0 --target=..." ;;
*) fail "$0: unknown or unsupported target \"$target\"" ;;
esac

#
# Try to get a conforming C99 freestanding environment
#
tryflag CFLAGS_C99FSE -std=c99
tryflag CFLAGS_C99FSE -nostdinc
tryflag CFLAGS_C99FSE -ffreestanding \
|| tryflag CFLAGS_C99FSE -fno-builtin
tryflag CFLAGS_C99FSE -fexcess-precision=standard \
|| { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; }
tryflag CFLAGS_C99FSE -frounding-math

#
# We may use the may_alias attribute if __GNUC__ is defined, so
# if the compiler defines __GNUC__ but does not provide it,
# it must be defined away as part of the CFLAGS.
#
printf "checking whether compiler needs attribute((may_alias)) suppression... "
cat > "$tmpc" <<EOF
typedef int
#ifdef __GNUC__
__attribute__((__may_alias__))
#endif
x;
EOF
if $CC $CFLAGS_C99FSE -I./arch/$ARCH -I./include $CPPFLAGS $CFLAGS \
  -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
printf "no\n"
else
printf "yes\n"
CFLAGS_C99FSE="$CFLAGS_C99FSE -D__may_alias__="
fi

#
# Check for options that may be needed to prevent the compiler from
# generating self-referential versions of memcpy,, memmove, memcmp,
# and memset. Really, we should add a check to determine if this
# option is sufficient, and if not, add a macro to cripple these
# functions with volatile...
#
tryflag CFLAGS_MEMOPS -fno-tree-loop-distribute-patterns

#
# Enable debugging if requessted.
#
test "$debug" = yes && CFLAGS_AUTO=-g

#
# Possibly add a -O option to CFLAGS and select modules to optimize with
# -O3 based on the status of --enable-optimize and provided CFLAGS.
#
printf "checking for optimization settings... "
case "x$optimize" in
xauto)
if fnmatch '-O*|*\ -O*' "$CFLAGS_AUTO $CFLAGS" ; then
printf "using provided CFLAGS\n" ;optimize=no
else
printf "using defaults\n" ; optimize=yes
fi
;;
xsize|xnone) printf "minimize size\n" ; optimize=size ;;
xno|x) printf "disabled\n" ; optimize=no ;;
*) printf "custom\n" ;;
esac

test "$optimize" = no || tryflag CFLAGS_AUTO -Os || tryflag CFLAGS_AUTO -O2
test "$optimize" = yes && optimize="internal,malloc,string"

if fnmatch 'no|size' "$optimize" ; then :
else
printf "components to be optimized for speed:"
while test "$optimize" ; do
case "$optimize" in
*,*) this=${optimize%%,*} optimize=${optimize#*,} ;;
*) this=$optimize optimize=
esac
printf " $this"
case "$this" in
*/*.c) ;;
*/*) this=$this*.c ;;
*) this=$this/*.c ;;
esac
OPTIMIZE_GLOBS="$OPTIMIZE_GLOBS $this"
done
OPTIMIZE_GLOBS=${OPTIMIZE_GLOBS# }
printf "\n"
fi

# Always try -pipe
tryflag CFLAGS_AUTO -pipe

#
# If debugging is disabled, omit frame pointer. Modern GCC does this
# anyway on most archs even when debugging is enabled since the frame
# pointer is no longer needed for debugging.
#
if fnmatch '-g*|*\ -g*' "$CFLAGS_AUTO $CFLAGS" ; then :
else
tryflag CFLAGS_AUTO -fomit-frame-pointer
fi

#
# Modern GCC wants to put DWARF tables (used for debugging and
# unwinding) in the loaded part of the program where they are
# unstrippable. These options force them back to debug sections (and
# cause them not to get generated at all if debugging is off).
#
tryflag CFLAGS_AUTO -fno-unwind-tables
tryflag CFLAGS_AUTO -fno-asynchronous-unwind-tables

#
# The GNU toolchain defaults to assuming unmarked files need an
# executable stack, potentially exposing vulnerabilities in programs
# linked with such object files. Fix this.
#
tryflag CFLAGS_AUTO -Wa,--noexecstack

#
# On x86, make sure we don't have incompatible instruction set
# extensions enabled by default. This is bad for making static binaries.
# We cheat and use i486 rather than i386 because i386 really does not
# work anyway (issues with atomic ops).
#
if test "$ARCH" = "i386" ; then
fnmatch '-march=*|*\ -march=*' "$CFLAGS" || tryldflag CFLAGS_AUTO -march=i486
fnmatch '-mtune=*|*\ -mtune=*' "$CFLAGS" || tryldflag CFLAGS_AUTO -mtune=generic
fi

#
# Even with -std=c99, gcc accepts some constructs which are constraint
# violations. We want to treat these as errors regardless of whether
# other purely stylistic warnings are enabled -- especially implicit
# function declarations, which are a dangerous programming error.
#
tryflag CFLAGS_AUTO -Werror=implicit-function-declaration
tryflag CFLAGS_AUTO -Werror=implicit-int
tryflag CFLAGS_AUTO -Werror=pointer-sign
tryflag CFLAGS_AUTO -Werror=pointer-arith

if test "x$warnings" = xyes ; then
tryflag CFLAGS_AUTO -Wall
tryflag CFLAGS_AUTO -Wno-parentheses
tryflag CFLAGS_AUTO -Wno-uninitialized
tryflag CFLAGS_AUTO -Wno-missing-braces
tryflag CFLAGS_AUTO -Wno-unused-value
tryflag CFLAGS_AUTO -Wno-unused-but-set-variable
tryflag CFLAGS_AUTO -Wno-unknown-pragmas
tryflag CFLAGS_AUTO -Wno-pointer-to-int-cast
fi

# Some patched GCC builds have these defaults messed up...
tryflag CFLAGS_AUTO -fno-stack-protector
tryldflag LDFLAGS_AUTO -Wl,--hash-style=both

test "$shared" = "no" || {
# Disable dynamic linking if ld is broken and can't do -Bsymbolic-functions
LDFLAGS_DUMMY=
tryldflag LDFLAGS_DUMMY -Wl,-Bsymbolic-functions || {
test "$shared" = "yes" && fail "$0: error: linker cannot build shared library"
printf "warning: disabling dynamic linking support\n"
shared=no
}
}

# Find compiler runtime library
test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh
test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt
test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \
                 && tryldflag LIBCC "$try_libcc"
printf "using compiler runtime libraries: %s\n" "$LIBCC"

# Figure out arch variants for archs with variants
SUBARCH=
t="$CFLAGS_C99FSE $CPPFLAGS $CFLAGS_AUTO $CFLAGS"

if test "$ARCH" = "x86_64" ; then
trycppif __ILP32__ "$t" && ARCH=x32
fi

if test "$ARCH" = "arm" ; then
trycppif __ARMEB__ "$t" && SUBARCH=${SUBARCH}eb
trycppif __ARM_PCS_VFP "$t" && SUBARCH=${SUBARCH}hf
fi

if test "$ARCH" = "mips" ; then
trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" && SUBARCH=${SUBARCH}el
trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
fi

test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \
&& SUBARCH=${SUBARCH}el

if test "$ARCH" = "sh" ; then
trycppif __BIG_ENDIAN__ "$t" && SUBARCH=${SUBARCH}eb
if trycppif "__SH_FPU_ANY__ || __SH4__" "$t" ; then
# Some sh configurations are broken and replace double with float
# rather than using softfloat when the fpu is present but only
# supports single precision. Reject them.
printf "checking whether compiler's double type is IEEE double... "
echo 'typedef char dblcheck[(int)sizeof(double)-5];' > "$tmpc"
if $CC $CFLAGS_C99FSE $CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
printf "yes\n"
else
printf "no\n"
fail "$0: error: compiler's floating point configuration is unsupported"
fi
else
SUBARCH=${SUBARCH}-nofpu
fi
fi

test "$SUBARCH" \
&& printf "configured for %s variant: %s\n" "$ARCH" "$ARCH$SUBARCH"

case "$ARCH$SUBARCH" in
arm) ASMSUBARCH=el ;;
*) ASMSUBARCH=$SUBARCH ;;
esac

#
# Some archs (powerpc) have different possible long double formats
# that the compiler can be configured for. The logic for whether this
# is supported is in bits/float.h; in general, it is not. We need to
# check for mismatches here or code in printf, strotd, and scanf will
# be dangerously incorrect because it depends on (1) the macros being
# correct, and (2) IEEE semantics.
#
printf "checking whether compiler's long double definition matches float.h... "
echo '#include <float.h>' > "$tmpc"
echo '#if LDBL_MANT_DIG == 53' >> "$tmpc"
echo 'typedef char ldcheck[9-(int)sizeof(long double)];' >> "$tmpc"
echo '#endif' >> "$tmpc"
if $CC $CFLAGS_C99FSE -I./arch/$ARCH -I./include $CPPFLAGS $CFLAGS \
  -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
printf "yes\n"
else
printf "no\n"
fail "$0: error: unsupported long double type"
fi

printf "creating config.mak... "

cmdline=$(quote "$0")
for i ; do cmdline="$cmdline $(quote "$i")" ; done

exec 3>&1 1>config.mak

cat << EOF
# This version of config.mak was generated by:
# $cmdline
# Any changes made here will be lost if configure is re-run
ARCH = $ARCH
SUBARCH = $SUBARCH
ASMSUBARCH = $ASMSUBARCH
prefix = $prefix
exec_prefix = $exec_prefix
bindir = $bindir
libdir = $libdir
includedir = $includedir
syslibdir = $syslibdir
CC = $CC
CFLAGS = $CFLAGS_AUTO $CFLAGS
CFLAGS_C99FSE = $CFLAGS_C99FSE
CFLAGS_MEMOPS = $CFLAGS_MEMOPS
CPPFLAGS = $CPPFLAGS
LDFLAGS = $LDFLAGS_AUTO $LDFLAGS
CROSS_COMPILE = $CROSS_COMPILE
LIBCC = $LIBCC
OPTIMIZE_GLOBS = $OPTIMIZE_GLOBS
EOF
test "x$static" = xno && echo "STATIC_LIBS ="
test "x$shared" = xno && echo "SHARED_LIBS ="
test "x$wrapper" = xno && echo "ALL_TOOLS ="
test "x$wrapper" = xno && echo "TOOL_LIBS ="
exec 1>&3 3>&-

printf "done\n"


text:
Quick Installation Guide for musl libc
======================================

There are many different ways to install musl depending on your usage
case. This document covers only the build and installation of musl by
itself, which is useful for upgrading an existing musl-based system or
compiler toolchain, or for using the provided musl-gcc wrapper with an
existing non-musl-based compiler.

Building complete native or cross-compiler toolchains is outside the
scope of this INSTALL file. More information can be found on the musl
website and community wiki.

Build Prerequisites
-------------------

The only build-time prerequisites for musl are GNU Make and a
freestanding C99 compiler toolchain targeting the desired instruction
set architecture and ABI, with support for gcc-style inline assembly,
weak aliases, and stand-alone assembly source files.

The system used to build musl does not need to be Linux-based, nor do
the Linux kernel headers need to be available.

If support for dynamic linking is desired, some further requirements
are placed on the compiler and linker. In particular, the linker must
support the -Bsymbolic-functions option.

At present, GCC 4.6 or later is the recommended compiler for building
musl. Any earlier version of GCC with full C99 support should also
work, but may be subject to minor floating point conformance issues on
i386 targets. Sufficiently recent versions of PCC and LLVM/clang are
also believed to work, but have not been tested as heavily; prior to
Fall 2012, both had known bugs that affected musl. Firm/cparser is
also believed to work but lacks support for producing shared
libraries. GCC 4.9.0 and 4.9.1 are known to have a serious bug
(#61144) which affects musl. Beginning with version 1.1.4 musl
attempts to work around the bug, but these compiler versions are still
considered unstable and unsupported.

Supported Targets
-----------------

musl can be built for the following CPU instruction set architecture
and ABI combinations:

* i386
    * Minimum CPU model is actually 80486 unless kernel emulation of
      the `cmpxchg` instruction is added

* x86_64

* ARM
    * EABI, standard or hard-float VFP variant
    * Little-endian default; big-endian variants also supported
    * Compiler toolchains only support armv4t and later

* MIPS
    * ABI is o32
    * Big-endian default; little-endian variants also supported
    * Default ABI variant uses FPU registers; alternate soft-float ABI
      that does not use FPU registers or instructions is available
    * MIPS2 or later, or kernel emulation of ll/sc (standard in Linux)
      is required

* PowerPC
    * Only 32-bit is supported
    * Compiler toolchain must provide 64-bit long double, not IBM
      double-double or IEEE quad
    * For dynamic linking, compiler toolchain must be configured for
      "secure PLT" variant

* Microblaze
    * Big-endian default; little-endian variants also supported
    * Soft-float
    * Requires support for lwx/swx instructions

The following additional targets are available for build, but may not
work correctly and may not yet have ABI stability:

* SuperH (SH)
    * Little-endian by default; big-engian variant also supported
    * Full FPU ABI or soft-float ABI is supported, but the
      single-precision-only FPU ABI is not supported (musl always
      requires IEEE single and double to be supported)

* x32 (x86_64 ILP32 ABI)

Build and Installation Procedure
--------------------------------

To build and install musl:

1. Run the provided configure script from the top-level source
   directory, passing on its command line any desired options.

2. Run "make" to compile.

3. Run "make install" with appropriate privileges to write to the
   target locations.

The configure script attempts to determine automatically the correct
target architecture based on the compiler being used. For some
compilers, this may not be possible. If detection fails or selects the
wrong architecture, you can provide an explicit selection on the
configure command line.

By default, configure installs to a prefix of "/usr/local/musl". This
differs from the behavior of most configure scripts, and is chosen
specifically to avoid clashing with libraries already present on the
system. DO NOT set the prefix to "/usr", "/usr/local", or "/" unless
you're upgrading libc on an existing musl-based system. Doing so will
break your existing system when you run "make install" and it may be
difficult to recover.

Notes on Dynamic Linking
------------------------

If dynamic linking is enabled, one file needs to be installed outside
of the installation prefix: /lib/ld-musl-$ARCH.so.1. This is the
dynamic linker. Its pathname is hard-coded into all dynamic-linked
programs, so for the sake of being able to share binaries between
systems, a consistent location should be used everywhere. Note that
the same applies to glibc and its dynamic linker, which is named
/lib/ld-linux.so.2 on i386 systems.

If for some reason it is impossible to install the dynamic linker in
its standard location (for example, if you are installing without root
privileges), the --syslibdir option to configure can be used to
provide a different location

At runtime, the dynamic linker needs to know the paths to search for
shared libraries. You should create a text file named
/etc/ld-musl-$ARCH.path (where $ARCH matches the architecture name
used in the dynamic linker) containing a list of directories where you
want the dynamic linker to search for shared libraries, separated by
colons or newlines. If the dynamic linker has been installed in a
non-default location, the path file also needs to reside at that
location (../etc relative to the chosen syslibdir).

If you do not intend to use dynamic linking, you may disable it by
passing --disable-shared to configure; this also cuts the build time
in half.

Checking for Successful Installation
------------------------------------

After installing, you should be able to use musl via the musl-gcc
wrapper. For example:

cat > hello.c <<EOF
#include <stdio.h>
int main()
{
	printf("hello, world!\n");
	return 0;
}
EOF
/usr/local/musl/bin/musl-gcc hello.c
./a.out

To configure autoconf-based program to compile and link against musl,
set the CC variable to musl-gcc when running configure, as in:

CC=musl-gcc ./configure ...

You will probably also want to use --prefix when building libraries to
ensure that they are installed under the musl prefix and not in the
main host system library directories.


text:
0.5.0 - initial release

0.5.9 - signal ABI bugfix, various cleanup and fixes:

sigset_t was wrongly defined as 1024 bytes instead of 1024 bits,
breaking the intended ABI compatibility with the LSB/glibc sigaction
structure. users should upgrade immediately and rebuild any libraries
or object files that might be using the incorrect definitions.

improved security against DoS with tcb shadow passwords by checking
that the file opened was really an ordinary file.

fixed a bug in the implementation of atomic ops that could have
allowed the compiler to incorrectly reorder them (in practice, gcc
with the default settings on i386 was not reordering them).

greatly improved conformance to the C and POSIX standards regarding
what the standard header files make visible. _POSIX_C_SOURCE is now
needed to get POSIX functions in standard C headers, and _XOPEN_SOURCE
or _GNU_SOURCE are required to get XSI interfaces or GNU extensions,
respectively.

many internal improvements have been made to the syscall-related code
in preparation for porting to x86_64 and other archs.

0.6.0 - x86_64 port, various important bugs fixed

new x86_64 (amd64) architecture port, contributed by Nicholas J. Kain,
along with PORTING guide. source tree layout and build system have
been improved to accommodate further ports.

various bugs that were introduced while making the headers respect C
and POSIX namespace standards have been fixed. conformance to the
standards has been improved.

fixed an inefficiency in qsort that triggered a bug (occasionaly
internal compiler error) in some versions of gcc.

fixed a major bug in the printf %n specifier that prevented it from
working and caused memory corruption.

0.7.0 - major improvements to posix conformance and completeness

implemented posix shared memory and semaphore interfaces.

implemented all remaining required pthread and clock interfaces.

major fixes to signal semantics.

greatly improved temporary file name generation for safety against
denial of service due to intentional name collisions.

added syscall wrappers for the linux inotify interface.

malloc(0) now returns a non-null pointer.

fixed printf %n specifier (again), pthread_once (it was always
hanging), and non-default-type mutex behavior.

added ucontext/sigcontext support in headers to facilitate building
libgcc with dwarf2 unwind support, and possibly other low-level tools.

improved musl-gcc compiler wrapper.

implemented many small missing functions here and there, minor header
fixes, etc.

0.7.1 - improvements to completeness, bug fixes

implemented flockfile, wprintf, and robust mutex functions.

fixed stack corruption bug in times(), minor header bugs, and some
error return value bugs in thread interfaces.

0.7.5 - new features, major optimization, and robustness

implemented POSIX timers.

optimized and simplified many thread-related functions.

eliminated resource leak races in thread cancellation. (almost all
existing implementations, including glibc, have these leaks.)

overhauled stdio implementation to take advantage of readv/writev for
reduced syscall load, and improved stdio's handling of error status.

added syscall header and interface for applications to use and
greatly simplified internal system for making syscalls.

strangthened tmpnam/tempnam/tmpfile filename generation and made the
straight C functions not depend on POSIX symbols.

fixed pthread cancellation ABI on i386 to match the LSB/glibc ABI

better double-free handling in malloc

various minor bug fixes

0.7.6 - major bug fixes

fixed rare but serious under-allocation bug in malloc.

fixed signedness bug in strchr that prevented finding high bytes.

fixed serious parsing bugs in strtold.

fixed statvfs syscall (it was always failing with EINVAL).

fixed race condition in set*id() functions with threads (possible
deadlock). further audit still needed though.

fseek no longer sets the stream error flag on failed seeks (this was
wrong and broke some programs, notably GNU m4).

nl_langinfo is no longer a dummy function. (the functionality was
previously implemented but accidentally left unused).

various small fixes have been made to the implementations and
prototypes for nonstandard and obsolete functions

0.7.7 - more bug fixes and program-compatibility improvements

fixed floating point formatting and rounding bugs in printf.

fixed broken %N$ positional argument specifiers in printf.

fixed misaligned read/overread bug in strchr which could lead to
crashes scanning tiny strings at the end of a page when the next page
is not readable, or on archs (not yet supported) that forbid
misaligned reads.

fixed breakage of statvfs on x86_64

fixed crash in getmntent_r

fixed bug in POSIX timers created with NULL sigevent argument

improved semaphore performance, and sem_wait is now interruptable by
signals, as required by POSIX.

added many compatibility and system-level interfaces, increasing the
proportion of busybox that works with musl.

0.7.8 - more bug fixes and compatibility improvements

fixed problems with ipv6 dns and address printing code that made ipv6
support practically unusable, and some other getaddrinfo bugs.

fixed broken sendmsg/recvmsg functions on x86_64 (caused by incorrect
msghdr structure).

fixed broken sigsetjmp asm on x86_64.

worked around a problem with input buffering on terminals reblocking
after getting a blank line, due to a bug in the linux readv syscall.

various improvements to the "rsyscall" system used to implement
threaded setuid, setgid, etc.

exiting/cancelling the a timer handler thread no longer kills the
timer.

fixed incorrect trailing zeros on some %g conversions in printf.

fixed buggy byte-swapping functions and moved them to inlines in
byteswap.h.

many small improvements to header/application compatibility, support
for nonstandard macros, etc.

0.7.9 release notes

new pthread cancellation implementation:
- safe against resource-leak/side-effect-leak race conditions
- safe against interruption by signal handlers
- reduced bloat in all cancellable functions
- reduced bloat for blocking cancellation

new interfaces implemented:
- realpath (limited functionality)
- wordexp (limited functionality)
- flock (nonstandard)
- forkpty (nonstandard)
- posix_fadvise
- posix_fallocate

general bug fixes:
- syslog function failure to communicate with syslogd
- bug in siginfo_t definition if wait.h was included before signal.h
- incorrect struct definitions for most of sysv ipc
- pthread_exit/cancel on timer handler wrongly destroying the timer
- linux dup2 ebusy workaround
- obscure issues in non-threaded programs using some pthread functions
- getopt_long allowed mismatch in last char of option name
- incorrect parsing of obscure ip address forms
- initgroups not working reliably (uninitialized var)
- shadow pass treating empty expiry field as pass-expired-in-1970
- bogus longjmp if pthread_exit was called from cancellation handlers

x86_64-specific bug fixes:
- fcntl file locking
- thread stack alignment
- broken select timeouts due to incorrect timeval definition

0.7.10 release notes

new features:
- ipv6 numeric string parsing
- eventfd syscall wrappers

optimizations:
- new qsort implementation using the smoothsort algorithm
- much smaller/faster sigset_t handling functions
- lowered spin count before futex wait in synchronization functions

general bug fixes:
- incorrect floating point round-to-even behavior in printf
- major bugs in pthread barrier implementation
- off-by-one error in scanf %n results
- scanf failure to report EOF when scanning for literal text
- minor missing/incorrect prototype issues
- dependency on undefined call order in fclose

compiler issue workarounds:
- incorrect inlining of variadic functions on recent gcc versions
- pcc preprocessor bug with recursive macro expansion

0.7.11 release notes

new features:
- integrated dynamic linker
- dynamic loading (dlopen/dlsym) (for dynamic-linked programs only)
- XSI search.h API
- POSIX message queues
- POSIX spawn interfaces
- BSD pseudo-random number generator API (random/srandom/initstate/etc.)
- floating point environment (limited usefulness due to gcc bugs)

general bug fixes:
- possible crashes with wordexp due to uninitialized variable
- race condition in pthread_kill (also present and unfixed in glibc/nptl)
- pthread exit destructors called too late
- dangerous unbounded vla in glob
- brk/sbrk legacy functions mismatching legacy semantics
- wcsncpy dest buffer overflow
- strncat and wcsncat possible overflows due to double-termination

0.7.12 release notes

new features:
- support for textrels in shared objects
- rpath support in dynamic linker
- stdio_ext.h functions (for better gnu software compatibility)

bug fixes:
- some compilers miscompiling dlopen due to misuse of longjmp
- safe handling of invalid long-double bit patterns (affects printf)
- workaround for bugs in linux mprotect syscall
- thread-safety for random() functions
- various minor issues

0.8.0 release notes

new features:
- chinese and japanese legacy charset support in iconv
- zero-syscall clock_gettime support (dynamic-linked x86_64 only)
- futex-based locking for stdio (previously used spinlocks)
- LD_PRELOAD and RTLD_NEXT support in dynamic linker
- strptime (mostly working but incomplete)
- posix aio (mostly working but not entirely conformant)
- memory streams (fmemopen, open_memstream, ...)
- stub/dummy implementations for various useless legacy functions
- if_nameindex

security hardening:
- setuid, etc. should not longer be able to "partially fail" with threads
- ensure suid programs start with fd 0,1,2 open
- improved openpty/forkpty failure checks

threads/synchronization bug fixes:
- dangerous spurious wakeup in pthread_join lead to early return
- race condition enabling async cancellation (delayed/lost cancellation)
- destruction/unmapping race conditions in semaphores, mutexes, rwlocks
- recursive rwlock_rdlock deadlock when a writer is waiting
- race condition in sigqueue with fork
- timer expiration thread exit wasn't running dtors
- timer threads weren't blocking signals
- close was wrongly cancellable after succeeding on some devices
- robust mutex list was not reset on fork

general bug fixes:
- incorrect logic in fread (spurious blocking; crash on write-only files)
- many corner cases and overflow cases for strtol-family functions
- various printf integer formatting issues with flags/width/precision
- incorrect iconv return value on failure
- broken FD_* macros on 64-bit targets
- clock function returning wrong value (real time not cpu time)
- siglongjmp signal mask clobbering (off-by-one pointer error)
- dynamic linker weak symbol resolution issues
- fdopendir failure to set errno
- various minor header fixes

0.8.1 release notes

bug fixes:
- mismatching prototypes caused build failure on 64-bit
- other minor prototype errors in the headers have been fixed
- various other small omissions fixed

0.8.2 release notes

new features:
- ptrace syscall support

bug fixes:
- const error (only a warning with many compilers) in lio_listio
- minor portability fixes aimed at supporting new arch targets

0.8.3 release notes

new features:
- arm port (experimental)
- better musl-gcc wrapper script for building against musl
- added clone system call

bug fixes:
- numerous header file typos, copy/paste errors, omissions
- statfs and statvfs ABI are now LSB-conformant (and actually work)

0.8.4 release notes

new features:
- arm dynamic linker support
- process-shared pthread barriers now work
- efficient futex-requeue-based cond var broadcast
- more optional cancellation points are now cancellable
- printf accepts null pointers with %s, prints as "(null)"
- recursive mutexes are now fully reentrant
- __cxa_atexit support
- real vfork
- dynamic linker now gold-compatible
- prlimit syscall
- support for large limits with setrlimit/getrlimit (even on 32-bit)
- glob now supports GLOB_PERIOD option (GNU extension)

bug fixes:
- many serious issues in condition variables
- rwlock failure-to-wake deadlock issues
- various small header files bugs/omissions
- wrong failure return for pthread_create
- path handling issues on execvp
- lock count corruption with robust recursive mutexes on owner death
- integer overflows in atoi, etc. reading most-negative value
- spurious mremaps on every realloc of large memory chunks
- pthread cancellation failure in single-threaded programs

security:
- avoid fd_set overflow in dns lookups

0.8.5 release notes

new features:
- stdio operations are now cancellable (only when low-level io happens)
- global ctor/dtor support in main program start code and shared libs
- dynamic linker support for PIE executables (but missing startup code)
- vfork support on x86_64
- complete set of locale_t functions (all ignore the locale argument)
- provide define float_t and double_t in math.h
- lighter/faster cancellation cleanup handler register/unregister

bug fixes:
- gcc wrapper now supports -shared, -nostdlib, -nostartfiles
- removed one wrongly-classified character from iswspace set (zwsp)
- fixed crashes in dns lookup on some errors, e.g. resolv.conf missing
- "make install" no longer tries to build shared libc if disabled
- ptrace argument handling bugs fixed
- work around visibility-hidden bugs in gcc 3.x
- fix thread-pointer-loss issue when it's initialized in signal handlers
- various minor typo/misc fixes in headers

compatibility:
- glob behaves more like traditional implementations w.r.t. GLOB_MARK
- added legacy futimes, lutimes functions
- more compatibility macros in sys/param.h (nonstandard header)
- setfs[ug]id syscall wrappers (linux specific)
- fgetpwent function (nonstandard)
- utmp.h matches traditional version more closely
- caddr_t now matches glibc type (void * instead of long)
- dummy (always-fail) dlopen and dlsym functions for static linked programs
- [efg]cvt functions (previously posix, removed from standard)
- get_current_dir_name function (nonstandard)

0.8.6 release notes

bug fixes:
- fix crash in dns lookups for all static-linked, non-threaded programs

0.8.7 release notes

new features:
- c++ support with g++'s libstdc++
- c99 math library (float, long double, complex, etc.)
- numerous wchar_t functions
- a64l, l64a functions
- getdate function

compatibility:
- c89 compatibility in math.h
- syscall.h alias for sys/syscall.h
- memory.h alias for string.h
- getcwd supports null buffer argument (auto-allocation)

bug fixes:
- major fenv (floating point environment) fixes and optimizations
- strptime mishandling of day/month names
- strtoull wrongly rejecting the highest 16 possible values as overflow
- math.h constant expression fixes for INFINITY/NAN/etc.
- scanf mishandling of "0" with "%x"

0.8.8 release notes

new feature:
- major math correctness and performance improvements
- many math functions implemented in asm for i386
- some math functions (mostly long double) in asm for x86_64
- new floating point parser/converter with correct rounding
- implement wcstod, wcstof, and wcstold
- new scanf implementation - cleaner, faster, more correct
- minimal/incomplete strfmon implementation

compatibility:
- header fixes for c++
- regex code resync with TRE; support common regex extensions
- support for compiling apps with gcc's -funsigned-char
- sysconf now returns dynamic limits for open files, processes
- give dlerror proper error status stickiness
- make alloca work even with -fno-builtin

critical security fixes:
- stack-based buffer overflow in fprintf on unbuffered files

other bug fixes:
- rare gcc register allocation (miscompilation) bug in syscall wrappers
- printf was rejecting the valid (but redundant) %lf format specifier
- fixed big data bloat (missing const) in math functions
- many math fixes related to floating point exceptions and rounding
- corrected DECIMAL_DIG definitions
- tgammal was wrongly setting global signgam
- crash in wordfree with uninitialized we_offs
- fix wordexp not null-initializing the we_offs initial slots

0.8.9 release notes

bug fixes:
- major breakage in strtol and family: failure to accept leading spaces
- incorrect name for MATH_ERREXCEPT in math.h

compatibility:
- prototypes for a few additional nonstandard functions

0.8.10 release notes

new features:
- correct over/underflow detection (ERANGE setting) for strtod
- new musl-gcc wrapper, specfile based, faster and more robust
- meaningful return strings for dlerror
- new iswalpha, iswpunct, and wcwidth; sync'd to Unicode 6.1
- towupper/towlower sync'd with Unicode 6.1
- new futex-based libc-internal locks instead of spinlocks
- experimental stack protector support (minimal; no random canary)
- experimental gdb shared library tracking support

compatibility:
- getusershell family functions
- getresuid and getresgid syscall wrappers
- byte swapping macros in endian.h
- getdtablesize was wrongly declared in unistd.h for _XOPEN_SOURCE

bug fixes:
- iconv_open wrongly rejecting most dest charsets (broken in 0.8.0)
- sysconf failure when correct value is -1 (broken in 0.8.8)
- scanf and strtod family functions overreading past NAN (4 bytes vs 3)
- scanf and strtod wrongly treating "0.00000000001", etc. as 0
- many bugs in towupper/towlower (never seriously tested before)
- int8_t definition was wrong when gcc -funsigned-char was used

0.9.0 release notes

license change: MIT

new features:
- configure script, improved build system
- full stack protector support
- PIE support on x86 and x86_64
- new O(1) space, O(nm) time implementation of fnmatch
- improved support for sse2 floating point mode on x86

compatibility:
- added linux unshare syscall
- exp10/pow10 function
- sqrtl support on arm (previously missing)
- removed minimal linux/*.h headers that could conflict with real ones
- support for _LARGEFILE64_SOURCE (mapped to standard fcns with #define)
- better c89 compatibility in headers
- stub versions of sched_* functions (previously missing)
- pthread stacks no longer executable (compat with hardened kernels)
- new ar.h and lastlog.h (legacy junk)
- various other header improvements

optimization:
- additional x86_64 math asm
- better formula for acos use in i386 asm

bug fixes:
- large (up to a few %) errors in strtod for certain values due to bug
- mbsnrtowcs and wcsnrtombs were completely broken (bad exit logic)
- wide printf %.0s could fail due to uninitialized variable
- missing dlerror strings for dlsym in some cases

0.9.1 release notes

new features:
- dynamic linker can be used as a program to explicitly load/run executables
- ldd command, usable by making a symlink to the dynamic linker named ldd

bug fixes:
- major bugs in POSIX BRE parsing inherited from TRE regex code
- character matching bug in regex on ARM: WCHAR_MAX was assumed to be signed
- various obscure fixes related to signals and pthread cancellation
- remquot subnormal remainder bug
- buggy macros in (nonstandard) sys/param.h
- major bug in pthread barriers on x86_64 (out of bounds write)
- utimes (legacy) function was making wrong syscall (utime instead of utimes)
- avoid using "old" syscalls that don't exist on arm eabi linux
- broken strrchr(str, 0)
- broken mbsinit(0)
- broken wcsncmp
- syntax error in nextafter macro in tgmath.h
- missing support for -pie in musl-gcc wrapper
- abort could wrongly fail to terminate the program in some cases

compatibility:
- increase default thread stack size to 80k
- support _BSD_SOURCE feature test macro
- support _LARGEFILE64_SOURCE feature test macro (merely exposes alt names)
- lots of legacy-compatibility improvements in headers
- various minor GNU extension functions
- sysconf reporting number of available CPUs/cores
- various LSB/glibc ABI interfaces aimed at compatibility with some binaries
- use fistpll asm mnemonic instead of fistpq for compat with clang

0.9.2 release notes

bug fixes:
- pointer overflow in printf (crash on 32bit userspace, 64bit kernel)
- printf %ls over-read bug
- strtod failure to read -0x as negative zero
- flush stdio after dtors, not before
- wrong file position for buffered input streams on exit
- popen was broken when stdin/out were already closed
- broken wcwidth tables (missing many characters)
- fwrite: wrong return value of partial/failed write
- broken utf-16 conversions
- bad buffer length check in getlogin_r
- bad perror("") behavior; did not match perror(0)
- broken sysinfo syscall/structure
- stdint.h const macro signedness bugs
- broken include guards in some headers
- bogus localeconv values
- cancellation-safety for popen and pclose
- fma corner cases wrong on i386
- fcntl F_GETOWN errno missing on failure.
- char signedness bug in dynamic linker broke dlopen on arm
- mprotect failure in dynamic linker caused crash instead of error

build system:
- configure check to work around hacked-up gcc versions
- test for old binutils that can't support musl dynamic linker

compatibility:
- make _GNU_SOURCE imply _LARGEFILE64_SOURCE
- syscall wrapper for lots of nonstandard and/or legacy linux syscalls
- versionsort stub
- timegm function (inverse of gmtime)
- various minor header tweaks
- make __freading/__fwriting semantics match traditional ones
- added gnulib-compatibility stdio interfaces
- added pthread_attr_setstack interface
- make strerror_r return partial string when buffer is too small
- duplocale should accept LC_GLOBAL_LOCALE
- align ptsname_r to upcoming posix requirements
- support invalid ld80 bit patterns as extra nans.

0.9.3 release notes

new features:
- mips (32-bit, o32 abi) port, currently static-linked only
- newly overhauled crypt implementation
- improved library pathname info for debugger from the dynamic linker
- getaddrinfo (and getservbyname) now support /etc/services lookups
- pipe2 syscall wrapper
- splice and vmsplice syscall wrappers
- syscall wrappers for extended attribute interfaces
- ioperm/iopl syscall wrappers on archs that support these operations

bug fixes:
- dlsym RTLD_NEXT library search order was wrong
- multiple dlopen pathname and library name handling errors
- potential race condition in detached thread exit
- broken internal-lock-handling code not updated for futex-based __lock
- sem_trywait spurious EAGAIN errors arising from CAS failures
- workaround kernel bug in cmsghdr size_t vs socklen_t issue (64-bit)
- getservby* crash on null protocol argument
- logic error skipping failed interfaces in if_nameindex
- various minor header/declaration related issues

arm-specific bug fixes:
- broken crti/crtn startup code when gcc crtbegin/end files are linked
- sigsetjmp tail call optimization failure broke the function
- incorrect little-endian assumptions in atomic.h functions
- use of blx instruction in asm (not supported on pre-v5 arm)

build system:
- only use expensive -ffloat-store cflag on archs/compilers that need it
- make musl-gcc wrapper support -lgcc (mainly for self-hosting)

0.9.4 release notes

new features:
- blowfish crypt
- dynamic linking on mips
- arm hard float support
- BSD fgetln function in stdio
- minor header improvements for compatibility
- support for CROSS_COMPILE variable to configure
- legacy significand function
- better support for SUSv3-targeted programs

performance:
- assembly (string ops based) memcpy for i386 and x86_64
- reduce printf overhead

bug fixes:
- failure of strtod, etc. to process extremely long strings correctly
- read overrun in wcsstr for short needles
- various major mips issues that prevented most software from working
- erroneous floating point exception behavior in i386/x86_64 exp asm
- crashes on null arguments to legacy err.h functions
- various header file/type issues
- extremely rare/obscure race condition with robust mutexes
- crypt now never returns null (most programs don't check, then crash)
- missing xattr remove functions

0.9.5 release notes

compatibility and headers:
- POSIX+XSI+BSD features enabled by default with no macros defined
- most programs can now be built without adding -D_GNU_SOURCE
- added C99 restrict keyword where required in all prototypes
- greater C89 compatibility
- cleaner, more-compatible public syscall.h
- many other header fixes
- support for compiling musl with clang/llvm

new features:
- sha 256/512 password hash functions in crypt
- GNU hash support in dynamic linker
- partial C11 coverage
- dladdr function added
- dynamic linker reports all errors instead of exiting on first error
- syscall wrappers added for most remaining linux syscalls
- provide POSIX O_SEARCH open mode using linux O_PATH

bug fixes:
- most atexit functions were being skipped when exiting
- some BSD functions were not being exposed under _BSD_SOURCE
- issues loading ssp-protected DSO into non-ssp program with dlopen

debloating:
- eliminate .eh_frame (10-15% loaded size bloat)
- optimal inline syscall asm for ARM and MIPS
- no longer force -O3 for shared libs

0.9.6 release notes

bug fixes:
- serious breakage in definition of O_ACCMODE mask (missing a bit)

new features:
- O_EXEC open mode
- md5 crypt hash function

0.9.7 release notes

new features:
- thread-local storage (__thread/_Thread_local)
- microblaze port
- getopt option parsing reset support
- vsyscall (sysenter, etc.) support on i386 (faster syscalls)
- memmem function (GNU extension)
- mips fenv support
- accept "nan(n-char-sequence)" in strtod/scanf family functions
- configure now supports compiling with pcc

quality and correctness improvements:
- close-on-exec flag for all library-internal file descriptors
- cancellation-safety and corner-case overhaul in shm_open/sem_open
- close EINTR vs EINPROGRESS issue
- mark binaries as not requiring executable stack
- better gdb compatibility in dynamic linker
- support recursive dlopen (dlopen called from constructors)
- posix_spawn/system/popen no longer momentarily double commit charge
- all stdio functions wait for locks

bug fixes:
- broken sysvipc *ctl functions on 64-bit archs
- broken shmdt on some archs
- getaddrinfo failure with port "0"
- dirname handling of trailing slash
- vfork race in posix_spawn

0.9.8 release notes

new features:
- powerpc port
- dl_iterate_phdr interface
- added mips-specific syscalls
- thread priority scheduling
- C11 CMPLX macro in complex.h
- x86 port io functions in sys/io.h

compatibility:
- improved headers for trace/debugging/machine-access
- stub functions for unsupported thread-related functionality

bug fixes:
- numerous math bugs (mostly exception flags and excess-precision issues)
- register clobber error in i386 vsyscall asm (did not affect most callers)
- various incorrect definitions in mips headers
- broken dlsym asm on mips
- empty prefix handling in configure script (--prefix="")
- ldso search path logic issues
- lock handling for stdio memory streams at exit time
- invalid SO_REUSEPORT definition in socket.h (not supported by Linux)
- broken redirection attempt to /dev/null in configure script

0.9.9 release notes

new features:
- tgamma implementation (no longer lgamma wrapper with low precision)
- various gnu extensions: sigandset, sigorset, etc.
- futimesat function (obsolete)
- various linux syscalls: arch_prctl, personality, etc.

optimizations:
- hyperbolic, inverse hyperbolic, and inverse trig, bessel functions
- is* comparison macros in math.h now expand inline properly

library bugs fixed:
- calling getenv from shared library ctors was broken
- invalid read in mmap-serviced aligned_alloc/memalign (possible crash)
- wrong errno result in fallback path of pipe2
- various math functions raising spurious exceptions
- mmap errno value on invalid offsets
- backwards alignment logic in strlcpy
- integer overflows in bessel functions
- large (up to 60ulp) error in erfcf
- dlsym/dlclose crashing on invalid library handles
- failure to handle arch variations for cloexec/nonblock flags
- lio_listio wrong return value for LIO_WAIT mode
- dladdr failure to resolve PLT addresses
- time_t/struct tm conversion off-by-one-day in december
- malloc corruption on nonstandard kernels with non-page-aligned brk

arch-specific bugs fixed:
- arm ctors/dtors were not working with recent gcc versions
- arm and mips setjmp/longjmp wrongly saved/restored fenv state
- loss of precision in i386/x86_64 expl

header bugs fixed:
- incorrect PRI/SCN macros in inttypes.h for some types
- arm sys/user.h regressions
- failure of offsetof() to be an integer constant expression
- tgmath return value type problems

header compatibility improvements:
- _GNU_SOURCE now enables everything; _ALL_SOURCE also works
- scsi/scsi.h and scsi/sg.h are now provided
- additional MAP_* flags for mmap
- additional F_* commands and flags for fcntl
- additional socket option, IPPROTO_* values, and multicase macros
- thread-related waitpid flags
- EHWPOISON added to errno.h
- additional macros for mount, swap, and reboot operations
- expose additional link.h structures
- always ensure sizeof(NULL)==sizeof(void *), even in c++
- additional flags for poll, epoll, inotify, timerfd, timex, dlfcn
- register names in signal.h/ucontext.h for x86
- ipc.h ipc_perm nonstandard struct field name compatibility improve

0.9.10 release notes

new features:
- getifaddrs
- pthread_getattr_np (widely used by garbage collectors)
- mkostemps, mkostemp, mkstemps functions (mkostemp is future-POSIX)
- strcasestr and strverscmp (previously stubs)

improvements:
- major performance improvements in mbtowc
- avoid filling caller-provided thread stacks with large TLS
- debloat unnecessary static buffers
- robust posix_spawn based on CLONE_VM instead of vfork
- new system() and popen() based on posix_spawn
- better strerror strings
- further emulation of atomic close-on-exec/nonblock options for old kernels
- provide macro constants for new-ish kernel features

compatibility:
- several nonstandard but widely-available pwd/grp/shadow functions
- program_invocation_[short_]name
- re-added useconds_t type used by some programs
- some legacy arpa headers
- dn_skipname function (legacy resolver API)
- additional ABI aliases for supporting glibc-linked libraries/binaries

general bugs fixed:
- stale locks and bogus munmap call when pthread_create fails
- uninitialized argument to munmap when dynlink load_library fails
- incorrect error returns in gethostby*_r
- memory leak in gethostbyname family
- blank ai_canonname in getaddrinfo for non-CNAME records
- undefined HZ macro in scsi/sg.h
- wrong return value for wmemmove on forward-copy
- namespace conformance in strings.h
- various utmp.h bugs
- unnecessary DT_SONAME in libc.so caused problems on some systems
- multiple bugs in syslog, some possibly dangerous
- non-functional setpriority function
- slight mishandling of 0xf5 byte in UTF-8 decoder
- misaligned memory accesses in mbsrtowcs

arch-specific bugs fixed:
- crash in shared library loading on arm
- missing __aeabi_atexit needed by arm eabi
- wrong float_t definition on x86_64
- various low-impact type size/alignment mismatches in some headers
- epoll struct alignment wrong on non-x86[_64] archs
- broken pipe2 fallback code on mips with old kernels

0.9.11 release notes

new features:
- %m allocation modifier for scanf
- week number and ISO week-based-year functionality in strftime
- per-process and per-thread cputime clocks
- ethernet address conversion interfaces
- legacy classful ipv4 network address interfaces
- minimal dlinfo function (nonstandard)

other improvements:
- dynamic linker path file can now use newlines to separate paths
- math optimizations for archs with extended precision (i386)
- musl-gcc wrapper now exposes gcc's intrinsic headers
- quality of rand and rand_r pseudo-random sequences
- support for large device minor numbers (greater than 8 bits)
- various header conformance and compatibility fixes

directly user-visible bugs fixed:
- scanf losing characters on unbuffered streams and fmemopen streams
- failure of mbsrtowcs to record stop position when dest is full
- failure of iconv to convert to legacy codepages
- non-working pthread_[sg]etschedparam functions (wrong syscall arguments)

other potentially-serious bugs fixed:
- resource leaks in sem_open
- various bugs in thread exit synchronization
- invalid access in aio notification after aiocb free/reuse
- synchronization in dynamic linker when new thread dlopens during ctors
- lack of error handling for failure to read dynamic linker path file
- creation by mmap or shmget of objects larger than PTRDIFF_MAX

minor conformance bugs fixed:
- overflow handling for the clock function
- workaround for incorrect exceptions in fma due to compiler bugs
- workaround wrong kernel type for sem_nsems field in struct semid_ds

arch-specific bugs fixed:
- x86_64 sigsetjmp clobbered the signal mask rather than saving it
- misaligned stack when calling ctors/dtors (crashing on x86_64)

0.9.12 release notes

new features:
- zoneinfo time zone support
- PIE support on all supported archs
- named sub-archs for endian and float ABI variants
- improved support for non-root installs of the dynamic linker
- ability to selectively build only performance-critical modules with -O3
- simple buffer overflow detection in free/realloc
- inet_ntop now presents v4-mapped addresses in ::ffff:a.b.c.d form
- ldd now reports libc and the dynamic linker in its output

compatibility:
- support for new init/fini array (needed for ctors/dtors on newer gcc)
- C++ ABI fully matches glibc/LSB, at least on x86
- many added ABI compatibility symbols for using glibc-linked libs
- support for STB_GNU_UNIQUE symbol bindings (found in some C++ libs)
- macros/types for new Linux kernel features in headers

bugs fixed:
- crashes in scanf on literal mismatches (regression from adding %m)
- dl_iterate_phdr was passing invalid phdr pointers to its callback
- getaddrinfo with null host and AF_UNSPEC was failing to report IPv6
- integer overflows in date/time conversion code
- misinterpretation of pre-1930s dates as post-2038 on 32-bit archs
- make install failed to install bits headers if make was not run first
- shm_open was wrongly cancellable
- low- or no-impact heap corruption in memalign
- explicitly running the dynamic linker on PIE programs did not work
- missing macros and sysconf for some supported POSIX option groups
- missing close-on-exec flags for several internal fd uses

arch-specific bugs:
- wrong SIG_ATOMIC_MIN/MAX macros on x86_64
- erfcl was missing on archs where long double is same as double
- broken dynamic-model TLS in static-linked arm/mips/powerpc programs

0.9.13 release notes

new features:
- iconv support for EUC-KR and Big5 (including HKSCS) encodings
- field widths (POSIX 2008 feature) in strftime
- recursive rpath and $ORIGIN support in dynamic linker
- cpu affinity interfaces
- support for armhf (hardfloat) floating point environment (fenv)
- support for SSE fenv on i386 (for apps using -mfpmath=sse -msse2)
- strftime %s format (seconds since the epoch, future POSIX requirement)
- configure script now saves its command line as a comment in config.mak
- legacy functions valloc and euidaccess

performance:
- optimized asm memcpy for arm
- optimized asm memset for i386 and x86_64
- optimized C versions of memcpy and memset for all archs
- eliminated major spurious syscalls from posix_spawn
- some math asm for armhf (hardfloat)

workarounds for:
- qemu-user's rt_sigaction syscall does not allow old to alias new
- qemu-user's madvise always succeeds (broke pthread_getattr_np)
- passing PT_INTERP to dlopen attempted to double-load libc
- gcc 4.8.x generating self-referential (infinite recursion) memcpy/memset
- linux's lack of support for fchdir, fchmod, fchown, fstat on O_PATH fds

bugs fixed:
- failure to honor flags for fchmodat and faccessat (linux syscall api flaws)
- SIGEV_THREAD timer id corruption and race condition issues
- timer thread TLS incorrectly keeping values from previous expiry run
- ecvt/fcvt decimal position off-by-one
- in symbol-versioned libs, symbol resolved to oldest instead of newest
- posix_spawn not correctly reporting errno from exec failure
- "make install" was not atomic (overwrote files rather than replacing)
- integer overflows in strftime
- unset/empty TZ variable was mishandled
- strftime could crash if the struct tm did not have valid tm_zone field
- failure of fenv functions to handle invalid arguments (required by ISO C)
- failure of some math functions (C and i386 asm) to raise underflow flag
- broken dn_expand function (previously not used internally)
- race conditions with signals during fork
- incorrect access check in mktemp (obsolete function)
- unnecessary arbitrary limits on size of program headers in dynamic loader
- text formatting bugs in output of err.h functions

arch-specific bugs:
- fesetenv(FE_DFL_ENV) crashed on i386
- breakage of arm crt code when libc is compiled as thumb
- arm/armhf (hardfloat) misidentified by configure
- ambiguity of wait (exit status) macros on mips with signal number 127
- wrong value of _NSIG and SIGRTMAX on mips

0.9.14 release notes

bugs fixed:
- failure to properly install dynamic linker with DESTDIR set (symlink wrong)
- rare deadlock in libc-internal locking routines
- dynamic linker used fallback paths wrongly on (possibly transient) errors
- popen broken when stdin or stdout was already closed in parent
- deadlock/memory-corruption in multithreaded set*id and setrlimit functions
- realpath failed when file was not readable
- readpath mistakenly had cancellation points in it
- crashes in scanf with invalid %m conversion specifiers
- misclassificiation of some invalid ld80 float representation in fpclassify
- various overflow and underflow flag issues in math functions
- domain handling errors for acoshf and acoshl
- wrong values for some sysconf properties
- lack of proper memory barriers on arm

mips-specific bugs:
- broken sysv ipc structures
- multiple stack-related bugs in clone, leading to crashes in parent or child
- overflow writing sigset_t in multithreaded set*id and setrlimit functions

other improvements:
- size and performance improvements to various math functions
- wait.h as a compatibility alias for sys/wait.h
- various header improvements
- support for runtime-variable page size on archs that need it (mainly mips)

0.9.15 release notes

new features:
- support for mixing IPv4 and v6 nameserver addresses in resolv.conf
- RFC 3678 multicast structures/macros in netinet/in.h
- putspent and fgetspent functions (shadow password API)
- timef function (obsolete, removed in POSIX 2008)
- fanotify syscalls (Linux-specific feature)
- semtimedop syscall (Linux-specific sysvipc extension)
- quotactl syscall and header (filesystem quotas support)
- drem and finite functions (obsolete BSD functions)
- getloadavg function (non-standard)
- herror function (non-standard and obsolete)
- libc.so now stores and prints its version information
- expose constants for new Linux features including O_TMPFILE
- implement FNM_LEADING_DIR option to fnmatch (GNU extension)
- posix_close function (accepted for inclusion in next POSIX issue)

bugs fixed:
- buffer overflow in mbsrtowcs
- clobbering of gr_name in getgrnam_r and getgrgid_r
- execle ignoring the environment argument
- setenv crash on malloc failure
- out-of-bounds access in fnmatch with FNM_PATHNAME and certain patterns
- failure of malloc to set errno when failing to extend heap
- incorrect errno value from getcwd with zero size
- spurious failure in faccessat with AT_EACCESS flag with suid/sgid programs
- several fd leaks due to missing close-on-exec flag
- misspellings/typos in macro names in several headers
- incorrect failure return value in inet_pton
- various numeric ip address parsing and validation fixes
- namespace conformance issues in several headers
- minor header issues
- zombie processes left by faccessat with AT_EACCESS
- timezone file parser failing/crashing on 64-bit archs
- hang in localtime with near-overflowing time_t values on 64-bit archs
- timezone path search was only trying first path
- incorrect handling of excessive-length TZ environment strings
- timezone file loading was wrongly enforcing O_NOFOLLOW/rejecting symlinks
- iswspace was wrongly returning true for the null character
- various bugs in wordexp
- putgrent could write corrupt lines after write failures
- dn_expand misinterpreted in-packet offsets greater than 255
- spurious strftime/wcsftime failure on len+1==bufsize case
- incorrect underflow flag in fma corner cases
- log*(0) wrongly returned +inf in downward-rounding mode
- failure of fchmod, fstat, fchdir, and fchown to produce EBADF

arch-specific bugs fixed:
- i386: failure of fesetround to set sse rounding mode
- i386: floating point limit constants misinterpreted due to excess precision
- powerpc: broken thread pointer access when compiled with clang
- microblaze: dynamic linker entry point code possibly clobbering argv

strict conformance issues:
- NULL definition re-aligned with POSIX (requires (void *) cast)
- alignment of math.h is* comparison functions with C11 annex F requirements

1.0.0 release notes

new features:
- support for mips softfloat ABI variant
- legacy setkey and encrypt API for DES
- support for BSD version of struct tcphdr in addition to GNU version
- added ipv6 and icmpv6 protocol lookups to getprotoent-family functions

new experimental ports:
- sh (SuperH)
- x32 (ILP32 ABI for x86_64)

compatibility:
- improved c89 compiler support in math.h
- eliminate some compiler warnings in public headers
- added some missing things for LFS64 APIs
- added fallback emulation of accept4 for older kernels

bugs fixed:
- buffer overflow in printf when printing smallest denormal exactly
- rounding errors in printf in some just-over-halfway cases
- posix_spawn did not accept null pid pointer (crashed)
- ftello gave incorrect result for unflushed append-mode streams
- mishandling of n=0 case in wcsxfrm (wild buffer overrun)
- possible system breakage during libc upgrade due to install.sh bugs
- nftw FTW_MOUNT flag prevented walking any directories at all
- ptsname/ptsname_r returned negated error codes
- getprotoent function returned junk after listing valid protocols
- wrong error code from readdir when the directory has been deleted
- various prototype/argument-type fixes, mostly to legacy functions
- various header namespace violations

arch-specific bugs fixed:
- fesetenv(FE_DFL_ENV) was broken on i386 and x86_64
- strerror(EDQUOT) did not work on mips
- recvmsg/sendmsg were broken on powerpc
- sysv ipc was broken on powerpc and mips
- statfs/statvfs were broken on mips
- sigaltstack was broken on mips

1.1.0 release notes

new features:
- relro memory protection in dynamic linker
- malloc can now extend heap with mmap if brk fails
- vdso clock_gettime/gettimeofday/time acceleration on x86_64
- thread/library-safe versions of search.h functions (nonstandard)
- getauxval function (nonstandard)
- sysconf extensions to query physical memory size

bugs fixed:
- floating point printf output corruption from carry into uninitialized slot
- possible runaway carry overflow in printf floating point
- printf %g failure to strip trailing zeros in some cases
- search past end of haystack in memmem
- off-by-one error in confstr return value
- crashes in some near-empty static programs that use stack protector
- deadlock race in pthread_once
- non-working clock_gettime fallback for old kernels

arch-specific bugs fixed:
- crash from missing syscall asm register clobbers on real microblaze kernel
- crash in all nontrivial dynamic linker use on microblaze
- incorrect rlimit constants on mips
- broken, possibly dangerous, use of getrlimit syscall on x32 in sysconf

1.1.1 release notes

new features:
- new options --preload and --library-path to dynamic linker
- public execvpe function (nonstandard extension)
- iconv support for cp437 and cp850

bugs fixed:
- false negatives with some periodic needles in strstr, wcsstr, and memmem
- crash on invalid zoneinfo files
- incorrect zero-padding of some outputs for strftime %s specifier
- misreporting of errors in configure script when $CC does not work at all
- treating not-yet-implemented strptime specifiers as errors

compatibility:
- configure now detects serious constant-folding bug in gcc 4.9.0
- removed __yield symbol (unused) that clashed with some compilers
- improvements to sysconf's handling of unsupported/invalid arguments

arch-specific bugs fixed:
- misdetection of superh ABI variant by configure on gcc 3.x
- missing SO_RCVBUFFORCE and SO_SNDBUFFORCE in mips socket.h
- build regression on armv6 and later with -mthumb

1.1.2 release notes

new features:
- multi-protocol matches (tcp and udp) in getaddrinfo
- support for AI_V4MAPPED and AI_ALL flags to getaddrinfo
- reverse name lookups from /etc/hosts
- reverse service lookups from /etc/services
- support for service aliases in /etc/services
- ipsec and tunneling protocols to getprotoent-family functions
- res_send, res_mkquery, res_querydomain, and dn_comp functions
- ipv6 scope id handling for link-local scope addresses
- previously-unimplemented %C and %y in strptime now work
- vdso clock_gettime acceleration on i386 (new kernel feature)
- better O_CLOEXEC/SOCK_CLOEXEC fallbacks for old kernels

bugs fixed:
- buffer overflow in dns response parsing (CVE-2014-3484)
- possible infinite loop in dns response parsing
- sendfile off_t 32/64-bit size mismatch
- incorrect end pointer in some cases when wcsrtombs stops early
- incorrect if_nametoindex return value when interface does not exist
- dummy "ent" function aliases that possibly shadowed real ones
- tmpfile fd leak on memory exhaustion
- getaddrinfo returning EAI_NONAME for some transient failures

arch-specific bugs fixed:
- broken kernel side RLIM_INFINITY on mips
- incorrect syscall argument 6/7 types for pselect on x32

1.1.3 release notes

new features:
- address sorting in getaddrinfo, etc. modeled on rfc 3484/6724
- default timezone taken from /etc/localtime when $TZ is unset
- getopt double-colon extension for optional arguments
- support for TLSDESC-based (gnu2) TLS dialect on i386 and x86_64
- sendmmsg/recvmmsg (linux-specific)
- fmtmsg (last mandatory XSI function that was missing)

compatibility:
- treat dns rcode=2 as temporary failure, not negative result
- working thread-pointer for pre-2.6 kernels on i386
- further ABI-compat symbols: __xmknod[at], __sysv_signal

bugs fixed:
- memmem false positives/false negatives/crashes from invalid logic
- gethostby*_r not setting result pointer to null on failure
- aliasing violations in syscall.h SYSLOG_NAMES feature
- fanotify_mark syscall arguments wrong

arch-specific bugs fixed:
- various subtle relocation bugs in powerpc and sh dynamic linker

1.1.4 release notes

new features:
- experimental locale support for LC_MESSAGES and LC_TIME
- non-stub gettext family functions for message translation
- or1k (OpenRISC 1000) port
- syslog options LOG_CONS and LOG_PERROR
- issetugid function (from OpenBSD)
- improved if_nameindex and getifaddrs functions

compatibility:
- work around bug #61144 in gcc 4.9.0 and 4.9.1
- support getauxval(AT_SECURE) even on kernels without AT_SECURE

bugs fixed:
- empty dynamic linker error messages (regression in 1.1.3)
- if_nameindex omitted unconfigured and ipv6-only interfaces
- incorrect return value for fwide function
- failure of wide printf/scanf functions to set wide orientation
- multiple issues in legacy function getpass
- dynamic linker did not accept colon as a separator for LD_PRELOAD
- errno clobber in syslog caused wrong output for %m specifier
- crash in regexec for nonzero nmatch argument with REG_NOSUB
- minor bugs in rarely-used nl_langinfo item lookups

arch-specific bugs fixed:
- broken relocations in mips dynamic linker (regression in 1.1.3)
- register state corruption in setjmp asm for microblaze
- broken struct stat st_ino field on microblaze
- broken struct stat st_dev field on big endian mips
- broken asm register constraints in atomics on powerpc
- missing barriers in atomics on mips, powerpc, microblaze, and sh


text:
    musl libc

musl, pronounced like the word "mussel", is an MIT-licensed
implementation of the standard C library targetting the Linux syscall
API, suitable for use in a wide range of deployment environments. musl
offers efficient static and dynamic linking support, lightweight code
and low runtime overhead, strong fail-safe guarantees under correct
usage, and correctness in the sense of standards conformance and
safety. musl is built on the principle that these goals are best
achieved through simple code that is easy to understand and maintain.

The 1.1 release series for musl features coverage for all interfaces
defined in ISO C99 and POSIX 2008 base, along with a number of
non-standardized interfaces for compatibility with Linux, BSD, and
glibc functionality.

For basic installation instructions, see the included INSTALL file.
Information on full musl-targeted compiler toolchains, system
bootstrapping, and Linux distributions built on musl can be found on
the project website:

    http://www.musl-libc.org/


text:
musl as a whole is licensed under the following standard MIT license:

----------------------------------------------------------------------
Copyright © 2005-2014 Rich Felker, et al.

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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------

Authors/contributors include:

Anthony G. Basile
Arvid Picciani
Bobby Bingham
Boris Brezillon
Brent Cook
Chris Spiegel
Clément Vasseur
Emil Renner Berthing
Hiltjo Posthuma
Isaac Dunham
Jens Gustedt
Jeremy Huntwork
John Spencer
Justin Cormack
Luca Barbato
Luka Perkov
M Farkas-Dyck (Strake)
Michael Forney
Nicholas J. Kain
orc
Pascal Cuoq
Pierre Carrier
Rich Felker
Richard Pennington
sin
Solar Designer
Stefan Kristiansson
Szabolcs Nagy
Timo Teräs
Valentin Ochs
William Haddon

Portions of this software are derived from third-party works licensed
under terms compatible with the above MIT license:

The TRE regular expression implementation (src/regex/reg* and
src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
under a 2-clause BSD license (license text in the source files). The
included version has been heavily modified by Rich Felker in 2012, in
the interests of size, simplicity, and namespace cleanliness.

Much of the math library code (src/math/* and src/complex/*) is
Copyright © 1993,2004 Sun Microsystems or
Copyright © 2003-2011 David Schultz or
Copyright © 2003-2009 Steven G. Kargl or
Copyright © 2003-2009 Bruce D. Evans or
Copyright © 2008 Stephen L. Moshier
and labelled as such in comments in the individual source files. All
have been licensed under extremely permissive terms.

The ARM memcpy code (src/string/armel/memcpy.s) is Copyright © 2008
The Android Open Source Project and is licensed under a two-clause BSD
license. It was taken from Bionic libc, used on Android.

The implementation of DES for crypt (src/misc/crypt_des.c) is
Copyright © 1994 David Burren. It is licensed under a BSD license.

The implementation of blowfish crypt (src/misc/crypt_blowfish.c) was
originally written by Solar Designer and placed into the public
domain. The code also comes with a fallback permissive license for use
in jurisdictions that may not recognize the public domain.

The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
Valentin Ochs and is licensed under an MIT-style license.

The BSD PRNG implementation (src/prng/random.c) and XSI search API
(src/search/*.c) functions are Copyright © 2011 Szabolcs Nagy and
licensed under following terms: "Permission to use, copy, modify,
and/or distribute this code for any purpose with or without fee is
hereby granted. There is no warranty."

The x86_64 port was written by Nicholas J. Kain. Several files (crt)
were released into the public domain; others are licensed under the
standard MIT license terms at the top of this file. See individual
files for their copyright status.

The mips and microblaze ports were originally written by Richard
Pennington for use in the ellcc project. The original code was adapted
by Rich Felker for build system and code conventions during upstream
integration. It is licensed under the standard MIT terms.

The powerpc port was also originally written by Richard Pennington,
and later supplemented and integrated by John Spencer. It is licensed
under the standard MIT terms.

All other files which have no copyright comments are original works
produced specifically for use as part of this library, written either
by Rich Felker, the main author of the library, or by one or more
contibutors listed above. Details on authorship of individual files
can be found in the git version control history of the project. The
omission of copyright and license comments in each file is in the
interest of source tree size.

All public header files (include/* and arch/*/bits/*) should be
treated as Public Domain as they intentionally contain no content
which can be covered by copyright. Some source modules may fall in
this category as well. If you believe that a file is so trivial that
it should be in the Public Domain, please contact the authors and
request an explicit statement releasing it from copyright.

The following files are trivial, believed not to be copyrightable in
the first place, and hereby explicitly released to the Public Domain:

All public headers: include/*, arch/*/bits/*
Startup files: crt/*