Add the full crosstool-NG sources to the new repository of its own.

You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
This commit is contained in:
Yann E. MORIN" 2007-02-24 11:00:05 +00:00
parent 2609573aed
commit 1906cf93f8
690 changed files with 244441 additions and 0 deletions

67
.cdtproject Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse-cdt version="2.0"?>
<cdtproject id="org.eclipse.cdt.make.core.make">
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<data>
<item id="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</item>
<item id="org.eclipse.cdt.core.pathentry">
<pathentry kind="src" path=""/>
<pathentry kind="out" path=""/>
<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>
</item>
<item id="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="Build toolchain" path="" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
</target>
</buildTargets>
</item>
</data>
</cdtproject>

34
.project Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>crosstool-ng</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.cdt.make.core.makeBuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.cdt.make.core.ScannerConfigBuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.make.core.makeNature</nature>
<nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,3 @@
#Sat Feb 17 16:17:18 CET 2007
eclipse.preferences.version=1
indexerId=org.eclipse.cdt.core.fastIndexer

21
COPYING Normal file
View File

@ -0,0 +1,21 @@
Unless otherwise stated in individaul files, this work is licensed to you under
the following terms.
- Files in docs/ are available under the Creative Commons Attribution, Share
Alike (by-sa), v2.5, to be found there:
licenses/by-sa/deed.en (human-readable summary)
licenses/by-sa/legalcode (legal code, the full license)
- Files found in patches/uClibc/*/ are available under the GNU Lesser General
Public License (LGPL), v2.1, to be found here:
licenses/lgpl.txt
- Files found in patches/glibc/*/ are available under the GNU Lesser General
Public License (LGPL), v2.1, to be found there:
licenses/lgpl.txt
- Other files not covered by the above licenses, and not covered by an
individual license specified in the file itself, or an accompanying file,
are available under the GNU General Public License (GPL), v2, to be found
here:
licenses/gpl.txt

9
CREDITS Normal file
View File

@ -0,0 +1,9 @@
I would like to thank these fine people for making crosstool-NG possible:
Dan KEGEL, the original author of crosstool: http://www.kegel.com/
Dan was very helpfull and willing to help when I build my first toolchains.
I owe him one. Thank you Dan!
Some crosstool-NG scripts have code snippets coming almost as-is from the
original work by Dan.
More to come as they help.

1
LICENSES Symbolic link
View File

@ -0,0 +1 @@
COPYING

46
Makefile Normal file
View File

@ -0,0 +1,46 @@
# Makefile for crosstool-NG.
# Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
# The project version
export PROJECTVERSION=0.0.1
# This should eventually be computed if compiling out-of-tree is implemented
export CT_TOP_DIR=$(shell pwd)
.PHONY: all
all: build
HOST_CC = gcc -funsigned-char
help::
@echo 'Available make targets (*: default target):'
@echo
include $(CT_TOP_DIR)/kconfig/Makefile
#include $(CT_TOP_DIR)/samples/Makefile
help::
@echo 'Build targets:'
@echo '* build - Build the toolchain'
@echo ' clean - Remove generated files'
@echo ' distclean - Remove generated files and configuration'
include $(CT_TOP_DIR)/tools/Makefile
.config: config/*.in
@make menuconfig
@# Because exiting menuconfig without saving is not an error to menuconfig
@test -f .config
# Actual build
build: .config
@$(CT_TOP_DIR)/scripts/crosstool.sh
.PHONY: clean
clean::
@rm -f .crosstool.config
.PHONY: distclean
distclean:: clean
@rm -f .config* ..config.tmp

9
README Normal file
View File

@ -0,0 +1,9 @@
This is the README for crosstool-NG
To get you started, hust enter:
make help
You can find a (terse and WIP) documentation in docs/.
You can also point your browser to
http://ymorin.is-a-geek.org/dokuwiki/doku.php?id=projects:crosstool

133
config/binutils.in Normal file
View File

@ -0,0 +1,133 @@
# binutils options
menu "binutils"
config BINUTILS_VERSION
string
choice
bool
prompt "binutils version"
config BINUTILS_V_2_11_2
bool
prompt "2.11.2"
config BINUTILS_V_2_13_90
bool
prompt "2.13.90"
config BINUTILS_V_2_14
bool
prompt "2.14"
config BINUTILS_V_2_14_90
bool
prompt "2.14.90"
config BINUTILS_V_2_14_92
bool
prompt "2.14.92"
config BINUTILS_V_2_15
bool
prompt "2.15"
config BINUTILS_V_2_15_90
bool
prompt "2.15.90"
config BINUTILS_V_2_15_91
bool
prompt "2.15.91"
config BINUTILS_V_2_16
bool
prompt "2.16"
config BINUTILS_V_2_16_1
bool
prompt "2.16.1"
config BINUTILS_V_2_17
bool
prompt "2.17"
config BINUTILS_V_2_17_50_0_1
bool
prompt "2.17.50.0.1"
config BINUTILS_V_2_17_50_0_2
bool
prompt "2.17.50.0.2"
config BINUTILS_V_2_17_50_0_3
bool
prompt "2.17.50.0.3"
config BINUTILS_V_2_17_50_0_4
bool
prompt "2.17.50.0.4"
config BINUTILS_V_2_17_50_0_5
bool
prompt "2.17.50.0.5"
config BINUTILS_V_2_17_50_0_6
bool
prompt "2.17.50.0.6"
config BINUTILS_V_2_17_50_0_7
bool
prompt "2.17.50.0.7"
config BINUTILS_V_2_17_50_0_8
bool
prompt "2.17.50.0.8"
config BINUTILS_V_2_17_50_0_9
bool
prompt "2.17.50.0.9"
config BINUTILS_V_2_17_50_0_10
bool
prompt "2.17.50.0.10"
# CT_INSERT_VERSION_ABOVE
# Don't remove qbove line!
endchoice
config BINUTILS_VERSION
string
default "2.11.2" if BINUTILS_V_2_11_2
default "2.13.90" if BINUTILS_V_2_13_90
default "2.14" if BINUTILS_V_2_14
default "2.14.90" if BINUTILS_V_2_14_90
default "2.14.92" if BINUTILS_V_2_14_92
default "2.15" if BINUTILS_V_2_15
default "2.15.90" if BINUTILS_V_2_15_90
default "2.15.91" if BINUTILS_V_2_15_91
default "2.16" if BINUTILS_V_2_16
default "2.16.1" if BINUTILS_V_2_16_1
default "2.17" if BINUTILS_V_2_17
default "2.17.50.0.1" if BINUTILS_V_2_17_50_0_1
default "2.17.50.0.2" if BINUTILS_V_2_17_50_0_2
default "2.17.50.0.3" if BINUTILS_V_2_17_50_0_3
default "2.17.50.0.4" if BINUTILS_V_2_17_50_0_4
default "2.17.50.0.5" if BINUTILS_V_2_17_50_0_5
default "2.17.50.0.6" if BINUTILS_V_2_17_50_0_6
default "2.17.50.0.7" if BINUTILS_V_2_17_50_0_7
default "2.17.50.0.8" if BINUTILS_V_2_17_50_0_8
default "2.17.50.0.9" if BINUTILS_V_2_17_50_0_9
default "2.17.50.0.10" if BINUTILS_V_2_17_50_0_10
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove qbove line!
config BINUTILS_EXTRA_CONFIG
string
prompt "binutils extra config"
default ""
help
Extra flags passed onto ./configure when configuring
endmenu

185
config/cc.in Normal file
View File

@ -0,0 +1,185 @@
# Compiler options
menu "C compiler"
comment "Core C Compiler (used to build the C library)"
config CC_USE_CORE
bool
prompt "Use a different core C compiler"
default n
help
Use a different compiler to build the C library than the one
in the final toolchain.
You can change the compiler used, or only the version used.
You most probably don't need that.
config CC_CORE_GCC
bool
default y if ! CC_USE_CORE && CC_GCC
default n if CC_USE_CORE || ! CC_GCC
config CC_CORE_TCC
bool
default y if ! CC_USE_CORE && CC_TCC
default n if CC_USE_CORE || ! CC_TCC
choice
bool
prompt "Core C compiler:"
depends on CC_USE_CORE
config CC_CORE_GCC
bool
prompt "gcc"
#config CC_CORE_TCC
# bool
# prompt "tcc (EXPERIMENTAL)"
endchoice
config CC_CORE_VERSION
string
config CC_CORE
string
default "gcc" if CC_CORE_GCC
default "tcc" if CC_CORE_TCC
if CC_CORE_GCC && CC_USE_CORE
source config/cc_core_gcc.in
endif
if CC_CORE_TCC && CC_USE_CORE
source config/cc_core_tcc.in
endif
comment "Final C compiler"
choice
bool
prompt "Final C compiler"
default CC_GCC
config CC_GCC
bool
prompt "gcc"
select CC_SUPPORT_CXX
select CC_SUPPORT_FORTRAN
select CC_SUPPORT_JAVA
select CC_SUPPORT_ADA
select CC_SUPPORT_OBJC
select CC_SUPPORT_OBJCXX
#config CC_TCC
# bool
# prompt "tcc (EXPERIMENTAL)"
# select CC_LANG_C
endchoice
config CC_VERSION
string
config CC
string
default "gcc" if CC_GCC
default "tcc" if CC_TCC
if CC_GCC
source config/cc_gcc.in
endif
if CC_GCC
source config/cc_tcc.in
endif
config CC_SUPPORT_CXX
bool
config CC_SUPPORT_FORTRAN
bool
config CC_SUPPORT_JAVA
bool
config CC_SUPPORT_ADA
bool
config CC_SUPPORT_OBJC
bool
config CC_SUPPORT_OBJCXX
bool
comment "Additionnal supported languages:"
config CC_LANG_CXX
bool
prompt "C++"
default n
depends on CC_SUPPORT_CXX
help
Only select this if you know that your specific combination of
compiler and its version does support this language.
config CC_LANG_FORTRAN
bool
prompt "Fortran"
default n
depends on CC_SUPPORT_FORTRAN
help
Only select this if you know that your specific combination of
compiler and its version does support this language.
config CC_LANG_JAVA
bool
prompt "Java"
default n
depends on CC_SUPPORT_JAVA
help
Only select this if you know that your specific combination of
compiler and its version does support this language.
config CC_LANG_ADA
bool
prompt "ADA"
default n
depends on CC_SUPPORT_ADA
help
Only select this if you know that your specific combination of
compiler and its version does support this language.
config CC_LANG_OBJC
bool
prompt "Objective-C"
default n
depends on CC_SUPPORT_OBJC
help
Only select this if you know that your specific combination of
compiler and its version does support this language.
config CC_LANG_OBJCXX
bool
prompt "Objective-C++"
default n
depends on CC_SUPPORT_OBJCXX
help
Only select this if you know that your specific combination of
compiler and its version does support this language.
config CC_LANG_OTHERS
string
prompt "Other languages"
default ""
help
Enter here a comma-separated list of languages that you know your compiler
supports, besides those listed above.
Eg. gcc-4.1+ has a toy programming language, treelang. As it is not usefull
in real life, it is not available in the selection above.
endmenu

137
config/cc_core_gcc.in Normal file
View File

@ -0,0 +1,137 @@
# Compiler options
choice
bool
prompt "Core gcc version"
config CC_CORE_V_2_95_3
bool
prompt "2.95.3"
config CC_CORE_V_3_2_3
bool
prompt "3.2.3"
config CC_CORE_V_3_3
bool
prompt "3.3"
config CC_CORE_V_3_3_1
bool
prompt "3.3.1"
config CC_CORE_V_3_3_2
bool
prompt "3.3.2"
config CC_CORE_V_3_3_3
bool
prompt "3.3.3"
config CC_CORE_V_3_3_4
bool
prompt "3.3.4"
config CC_CORE_V_3_3_5
bool
prompt "3.3.5"
config CC_CORE_V_3_3_6
bool
prompt "3.3.6"
config CC_CORE_V_3_4_0
bool
prompt "3.4.0"
config CC_CORE_V_3_4_1
bool
prompt "3.4.1"
config CC_CORE_V_3_4_2
bool
prompt "3.4.2"
config CC_CORE_V_3_4_3
bool
prompt "3.4.3"
config CC_CORE_V_3_4_4
bool
prompt "3.4.4"
config CC_CORE_V_3_4_5
bool
prompt "3.4.5"
config CC_CORE_V_3_4_6
bool
prompt "3.4.6"
config CC_CORE_V_4_0_0
bool
prompt "4.0.0"
config CC_CORE_V_4_0_1
bool
prompt "4.0.1"
config CC_CORE_V_4_0_2
bool
prompt "4.0.2"
config CC_CORE_V_4_0_3
bool
prompt "4.0.3"
config CC_CORE_V_4_0_4
bool
prompt "4.0.4"
config CC_CORE_V_4_1_0
bool
prompt "4.1.0"
config CC_CORE_V_4_1_1
bool
prompt "4.1.1"
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config CC_CORE_VERSION
string
default "2.95.3" if CC_CORE_V_2_95_3
default "3.2.3" if CC_CORE_V_3_2_3
default "3.3" if CC_CORE_V_3_3
default "3.3.1" if CC_CORE_V_3_3_1
default "3.3.2" if CC_CORE_V_3_3_2
default "3.3.3" if CC_CORE_V_3_3_3
default "3.3.4" if CC_CORE_V_3_3_4
default "3.3.5" if CC_CORE_V_3_3_5
default "3.3.6" if CC_CORE_V_3_3_6
default "3.4.0" if CC_CORE_V_3_4_0
default "3.4.1" if CC_CORE_V_3_4_1
default "3.4.2" if CC_CORE_V_3_4_2
default "3.4.3" if CC_CORE_V_3_4_3
default "3.4.4" if CC_CORE_V_3_4_4
default "3.4.5" if CC_CORE_V_3_4_5
default "3.4.6" if CC_CORE_V_3_4_6
default "4.0.0" if CC_CORE_V_4_0_0
default "4.0.1" if CC_CORE_V_4_0_1
default "4.0.2" if CC_CORE_V_4_0_2
default "4.0.3" if CC_CORE_V_4_0_3
default "4.0.4" if CC_CORE_V_4_0_4
default "4.1.0" if CC_CORE_V_4_1_0
default "4.1.1" if CC_CORE_V_4_1_1
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!
config CC_CORE_EXTRA_CONFIG
string
prompt "Core gcc extra config"
default ""
depends on CC_USE_CORE && CC_CORE_GCC || ! CC_USE_CORE && CC_GCC
help
Extra flags to pass onto ./configure when configuring the core gcc.

0
config/cc_core_tcc.in Normal file
View File

131
config/cc_gcc.in Normal file
View File

@ -0,0 +1,131 @@
# Compiler options
choice
bool
prompt "Final gcc version"
config CC_V_2_95_3
bool
prompt "2.95.3"
config CC_V_3_2_3
bool
prompt "3.2.3"
config CC_V_3_3
bool
prompt "3.3"
config CC_V_3_3_1
bool
prompt "3.3.1"
config CC_V_3_3_2
bool
prompt "3.3.2"
config CC_V_3_3_3
bool
prompt "3.3.3"
config CC_V_3_3_4
bool
prompt "3.3.4"
config CC_V_3_3_5
bool
prompt "3.3.5"
config CC_V_3_3_6
bool
prompt "3.3.6"
config CC_V_3_4_0
bool
prompt "3.4.0"
config CC_V_3_4_1
bool
prompt "3.4.1"
config CC_V_3_4_2
bool
prompt "3.4.2"
config CC_V_3_4_3
bool
prompt "3.4.3"
config CC_V_3_4_4
bool
prompt "3.4.4"
config CC_V_3_4_5
bool
prompt "3.4.5"
config CC_V_4_0_0
bool
prompt "4.0.0"
config CC_V_4_0_1
bool
prompt "4.0.1"
config CC_V_4_0_2
bool
prompt "4.0.2"
config CC_V_4_0_3
bool
prompt "4.0.3"
config CC_V_4_0_4
bool
prompt "4.0.4"
config CC_V_4_1_0
bool
prompt "4.1.0"
config CC_V_4_1_1
bool
prompt "4.1.1"
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config CC_VERSION
string
default "2.95.3" if CC_V_2_95_3
default "3.2.3" if CC_V_3_2_3
default "3.3" if CC_V_3_3
default "3.3.1" if CC_V_3_3_1
default "3.3.2" if CC_V_3_3_2
default "3.3.3" if CC_V_3_3_3
default "3.3.4" if CC_V_3_3_4
default "3.3.5" if CC_V_3_3_5
default "3.3.6" if CC_V_3_3_6
default "3.4.0" if CC_V_3_4_0
default "3.4.1" if CC_V_3_4_1
default "3.4.2" if CC_V_3_4_2
default "3.4.3" if CC_V_3_4_3
default "3.4.4" if CC_V_3_4_4
default "3.4.5" if CC_V_3_4_5
default "4.0.0" if CC_V_4_0_0
default "4.0.1" if CC_V_4_0_1
default "4.0.2" if CC_V_4_0_2
default "4.0.3" if CC_V_4_0_3
default "4.0.4" if CC_V_4_0_4
default "4.1.0" if CC_V_4_1_0
default "4.1.1" if CC_V_4_1_1
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!
config CC_EXTRA_CONFIG
string
prompt "Final gcc extra config"
default ""
help
Extra flags to pass onto ./configure when configuring gcc.

0
config/cc_tcc.in Normal file
View File

6
config/config.in Normal file
View File

@ -0,0 +1,6 @@
source config/global.in
source config/target.in
source config/kernel.in
source config/binutils.in
source config/cc.in
source config/libc.in

256
config/global.in Normal file
View File

@ -0,0 +1,256 @@
# Overall toolchain configuration: paths, jobs, etc...
menu "Paths and misc options"
config PARALLEL_JOBS
int
prompt "Number of parallel jobs"
default 1
help
Number of jobs make will be allowed to run concurently.
Set this higher than the number of processors you have, but not too high.
A good rule of thumb is twice the number of processors you have.
Enter 1 (or 0) to have only one job at a time.
config LOAD
int
prompt "Maximum allowed load"
default 0
help
Specifies that no new jobs should be started if there are others jobs
running and the load average is at least this value.
Makes sense on SMP machines only.
Enter 0 to have no limit on the load average.
Note: only the integer part of the load is allowed here (you can't enter
0.75 for example).
config NICE
int
prompt "Nice level"
default 0
range 0 19
help
Renices the build process up.
config USE_PIPES
bool
prompt "Use -pipe"
default y
help
Use gcc's option -pipe to use pipes rather than temp files when building
the toolchain.
comment "Paths"
config TARBALLS_DIR
string
prompt "Tarballs directory"
default "`pwd`/tarballs"
help
This is the directory into which tarballs are going to be stored once
they are downloaded (or otherwise retrieved).
config SRC_DIR
string
prompt "Extract directory"
default "`pwd`/${CT_TARGET}/src"
help
This is the directory into which tarballs will be extracted.
If you will build multiple toolchains, you should arrange to have one
SRC_DIR for each toolchain, as different targets may require different
patches to be applied.
config BUILD_DIR
string
prompt "Build directory"
default "`pwd`/${CT_TARGET}/gcc-${CT_CC_VERSION}-${CT_LIBC}-${CT_LIBC_VERSION}"
help
This is the directory into which builds will occur.
Once again, arrange for one build directory for each toolchain you build,
to avoid collision.
config PREFIX_DIR
string
prompt "Prefix directory"
default "${HOME}/${CT_TARGET}"
help
This is the path the toolchain will run from.
config INSTALL_DIR
string
# prompt "Install directory"
default "${CT_PREFIX_DIR}"
# help
# This is the path the target will be installed into.
#
# Normally, you would set this to ${CT_PREFIX_DIR}, but if for some reasons
# you can't write there, you can install somewhere else and have a third
# person do the install for you.
# The reason you might also want to install elsewhere is if you are going
# to package your shinny new toolchain for distribution.
config CUSTOM_PATCH
bool
prompt "Use custom patch directory"
default n
help
If you have custom patches that you want to be applied, say 'Y' here and
enter the path directory below.
Note that you must ensure that the patch directory is arranged the same
way the official directory is.
config CUSTOM_PATCH_ONLY
bool
prompt "Only use custom patches"
default n
depends on CUSTOM_PATCH
help
Don't apply patches coming with CT-NG, only those patches available in
the directory below.
If you say 'N' here, then the patches provided with CT-NG will be applied
first, and then your patches.
config CUSTOM_PATCH_DIR
string
prompt "Custom patch directory"
default ""
depends on CUSTOM_PATCH
help
Enter the custom patch directory here.
comment "Downloading and extracting"
config NO_DOWNLOAD
bool
prompt "Avoid downloads"
default n
help
Avoid downloading anything. Bail out if a tarball is missing.
config ONLY_DOWNLOAD
bool
prompt "Only download tarballs"
default n
depends on ! NO_DOWNLOAD
help
Only download the tarballs. Exit once it done.
Usefull to pre-retrieve the tarballs before going off-line.
config FORCE_DOWNLOAD
bool
prompt "Force downloads"
default n
depends on ! NO_DOWNLOAD
help
Force downloading tarballs, even if one already exists.
Usefull if you suspect a tarball to be damaged.
config FORCE_EXTRACT
bool
prompt "Force extractions"
depends on ! ONLY_DOWNLOAD
default n
help
Force extraction of already exctracted tarballs.
Usefull if you suspect a previous extract did not complete (eg. broken
tarball), or you added a new set of patches for this component.
comment "Logging"
choice
bool
prompt "Maximum log level to see:"
default LOG_INFO
config LOG_ERROR
bool
prompt "ERROR"
help
The build will be silent.
Only if there is an error will you see a mesage.
config LOG_WARN
bool
prompt "WARN"
help
The same as above, plus warnings.
config LOG_INFO
bool
prompt "INFO"
help
The same as above, plus informational messages (main steps).
config LOG_EXTRA
bool
prompt "EXTRA"
help
The same as above, plus extra messages (sub-steps).
config LOG_DEBUG
bool
prompt "DEBUG"
help
The same as above, plus lots of debug information, of which each
component's build messages (very noisy!).
endchoice
config LOG_LEVEL_MAX
string
default "ERROR" if LOG_ERROR
default "WARN" if LOG_WARN
default "INFO" if LOG_INFO
default "EXTRA" if LOG_EXTRA
default "DEBUG" if LOG_DEBUG
config LOG_PROGRESS_BAR
bool
prompt "Progress bar"
default n
depends on ! LOG_DEBUG
help
This option will print a "rotating bar" (/-\|) below the last log line
to show work is not stalled.
Available when not in DEBUG log level.
config LOG_USE_COLORS
bool
prompt "Use colors for logging to console"
default n
help
Use colors to highlight important messages.
ERROR: bright red
WARN : bright yellow
INFO : bright green
EXTRA: dim green
DEBUG: dim white
config LOG_TO_FILE
bool
prompt "Log to a file"
default y
help
Save *full* logs to a file. Even log levels you didn't specify above
will be available in this file.
config LOG_FILE
string
prompt "Log file"
default "${CT_PREFIX_DIR}/${CT_TARGET}.log"
depends on LOG_TO_FILE
help
File name into which to put logs.
endmenu

36
config/kernel.in Normal file
View File

@ -0,0 +1,36 @@
# Kernel options
menu "Kernel"
choice
bool
prompt "\"Kernel\" to use:"
default KERNEL_LINUX
config KERNEL_LINUX
bool
prompt "linux"
help
Build a toolchain targeting systems running Linux as a kernel.
config KERNEL_CYGWIN
bool
prompt "cygwin"
depends on ARCH_x86 || ARCH_x86_64
help
Build a toolchain targeting systems running Windows/cygwin as a kernel.
endchoice
config KERNEL_VERSION
string
if KERNEL_LINUX
source config/kernel_linux.in
endif
if KERNEL_CYGWIN
source config/kernel_cygwin.in
endif
endmenu

5
config/kernel_cygwin.in Normal file
View File

@ -0,0 +1,5 @@
# Cygwin 'kernel' options
config KERNEL
string
default "cygwin"

102
config/kernel_linux.in Normal file
View File

@ -0,0 +1,102 @@
# Linux kernel options
choice
bool
prompt "Get kernel headers from:"
config KERNEL_LINUX_HEADERS_INSTALL
bool
prompt "kernel's 'headers_install'"
help
This will make use of the new headers_install rule in recent kernels.
This is most probably what you want to use.
config KERNEL_LINUX_HEADERS_SANITISED
bool
prompt "Mazur's sanitized headers (OBSOLETE)"
help
M. Mazur used to maintain a tree of sanitised headers, but it is now
obsoleted by the headers_install rule (above), and has not seen eny
update since 2.6.12
config KERNEL_LINUX_HEADERS_COPY
bool
prompt "pure kernel headers (NOT RECOMMENDED)"
help
This will simply copy the kernel headers to the toolchain.
You do NOT want this. It's badly broken because it leaks kernel internals
to userspace.
endchoice
config KERNEL
string
default "linux" if KERNEL_LINUX_HEADERS_INSTALL || KERNEL_LINUX_HEADERS_COPY
default "linux-libc-headers" if KERNEL_LINUX_HEADERS_SANITISED
config KERNEL_VERSION_SEE_EXTRAVERSION
bool
prompt "See extra versions"
default n
depends on ! KERNEL_LINUX_HEADERS_SANITISED
help
See extra versions (kernel with 4 numbers, eg 2.6.19.1).
If you say 'no', you'll only see sub-level, 3-digit versions.
If you say 'yes', you'll see far more versions!
It is recommended that you say 'no', unless you _*know*_
that an extra version fixes a headers bug.
if KERNEL_LINUX_HEADERS_INSTALL
source config/kernel_linux_headers_install.in
endif
if KERNEL_LINUX_HEADERS_COPY
source config/kernel_linux_headers_copy.in
endif
if KERNEL_LINUX_HEADERS_SANITISED
source config/kernel_linux_headers_sanitised.in
endif
choice
bool
prompt "Kernel verbosity:"
default KERNEL_LINUX_VERBOSITY_0
config KERNEL_LINUX_VERBOSITY_0
bool
prompt "Simplified"
help
Print simplified command lines.
config KERNEL_LINUX_VERBOSITY_1
bool
prompt "Full commands"
help
Print full command lines.
config KERNEL_LINUX_VERBOSITY_2
bool
prompt "Exec reasons"
help
Print the reasons why a make target is rebuild.
endchoice
config KERNEL_LINUX_VERBOSE_LEVEL
int
default 0 if KERNEL_LINUX_VERBOSITY_0
default 1 if KERNEL_LINUX_VERBOSITY_1
default 2 if KERNEL_LINUX_VERBOSITY_2
config KERNEL_LINUX_CONFIG_FILE
string
prompt "Configuration file"
default ""
help
Path to the kernel configuration file.
You _must_ provide one (for now).

View File

@ -0,0 +1,682 @@
choice
bool
prompt "Linux kernel version"
config KERNEL_COPY_V_2_6_0
bool
prompt "2.6.0"
config KERNEL_COPY_V_2_6_1
bool
prompt "2.6.1"
config KERNEL_COPY_V_2_6_2
bool
prompt "2.6.2"
config KERNEL_COPY_V_2_6_3
bool
prompt "2.6.3"
config KERNEL_COPY_V_2_6_4
bool
prompt "2.6.4"
config KERNEL_COPY_V_2_6_5
bool
prompt "2.6.5"
config KERNEL_COPY_V_2_6_6
bool
prompt "2.6.6"
config KERNEL_COPY_V_2_6_7
bool
prompt "2.6.7"
config KERNEL_COPY_V_2_6_8
bool
prompt "2.6.8"
config KERNEL_COPY_V_2_6_8_1
bool
prompt "2.6.8.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_9
bool
prompt "2.6.9"
config KERNEL_COPY_V_2_6_10
bool
prompt "2.6.10"
config KERNEL_COPY_V_2_6_11
bool
prompt "2.6.11"
config KERNEL_COPY_V_2_6_11_1
bool
prompt "2.6.11.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_10
bool
prompt "2.6.11.10"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_11
bool
prompt "2.6.11.11"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_12
bool
prompt "2.6.11.12"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_2
bool
prompt "2.6.11.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_3
bool
prompt "2.6.11.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_4
bool
prompt "2.6.11.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_5
bool
prompt "2.6.11.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_6
bool
prompt "2.6.11.6"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_7
bool
prompt "2.6.11.7"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_8
bool
prompt "2.6.11.8"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_11_9
bool
prompt "2.6.11.9"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_12
bool
prompt "2.6.12"
config KERNEL_COPY_V_2_6_12_1
bool
prompt "2.6.12.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_12_2
bool
prompt "2.6.12.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_12_3
bool
prompt "2.6.12.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_12_4
bool
prompt "2.6.12.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_12_5
bool
prompt "2.6.12.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_12_6
bool
prompt "2.6.12.6"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_13
bool
prompt "2.6.13"
config KERNEL_COPY_V_2_6_13_1
bool
prompt "2.6.13.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_13_2
bool
prompt "2.6.13.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_13_3
bool
prompt "2.6.13.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_13_4
bool
prompt "2.6.13.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_13_5
bool
prompt "2.6.13.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_14
bool
prompt "2.6.14"
config KERNEL_COPY_V_2_6_14_1
bool
prompt "2.6.14.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_14_2
bool
prompt "2.6.14.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_14_3
bool
prompt "2.6.14.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_14_4
bool
prompt "2.6.14.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_14_5
bool
prompt "2.6.14.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_14_6
bool
prompt "2.6.14.6"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_14_7
bool
prompt "2.6.14.7"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_15
bool
prompt "2.6.15"
config KERNEL_COPY_V_2_6_15_1
bool
prompt "2.6.15.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_15_2
bool
prompt "2.6.15.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_15_3
bool
prompt "2.6.15.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_15_4
bool
prompt "2.6.15.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_15_5
bool
prompt "2.6.15.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_15_6
bool
prompt "2.6.15.6"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_15_7
bool
prompt "2.6.15.7"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16
bool
prompt "2.6.16"
config KERNEL_COPY_V_2_6_16_1
bool
prompt "2.6.16.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_10
bool
prompt "2.6.16.10"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_11
bool
prompt "2.6.16.11"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_12
bool
prompt "2.6.16.12"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_13
bool
prompt "2.6.16.13"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_14
bool
prompt "2.6.16.14"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_15
bool
prompt "2.6.16.15"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_16
bool
prompt "2.6.16.16"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_17
bool
prompt "2.6.16.17"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_18
bool
prompt "2.6.16.18"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_19
bool
prompt "2.6.16.19"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_2
bool
prompt "2.6.16.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_20
bool
prompt "2.6.16.20"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_21
bool
prompt "2.6.16.21"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_22
bool
prompt "2.6.16.22"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_23
bool
prompt "2.6.16.23"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_24
bool
prompt "2.6.16.24"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_25
bool
prompt "2.6.16.25"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_26
bool
prompt "2.6.16.26"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_27
bool
prompt "2.6.16.27"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_28
bool
prompt "2.6.16.28"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_29
bool
prompt "2.6.16.29"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_3
bool
prompt "2.6.16.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_30
bool
prompt "2.6.16.30"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_31
bool
prompt "2.6.16.31"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_32
bool
prompt "2.6.16.32"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_33
bool
prompt "2.6.16.33"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_34
bool
prompt "2.6.16.34"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_35
bool
prompt "2.6.16.35"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_36
bool
prompt "2.6.16.36"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_4
bool
prompt "2.6.16.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_5
bool
prompt "2.6.16.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_6
bool
prompt "2.6.16.6"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_7
bool
prompt "2.6.16.7"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_8
bool
prompt "2.6.16.8"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_16_9
bool
prompt "2.6.16.9"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17
bool
prompt "2.6.17"
config KERNEL_COPY_V_2_6_17_1
bool
prompt "2.6.17.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_10
bool
prompt "2.6.17.10"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_11
bool
prompt "2.6.17.11"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_12
bool
prompt "2.6.17.12"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_13
bool
prompt "2.6.17.13"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_14
bool
prompt "2.6.17.14"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_2
bool
prompt "2.6.17.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_3
bool
prompt "2.6.17.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_4
bool
prompt "2.6.17.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_5
bool
prompt "2.6.17.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_6
bool
prompt "2.6.17.6"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_7
bool
prompt "2.6.17.7"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_8
bool
prompt "2.6.17.8"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_17_9
bool
prompt "2.6.17.9"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_18
bool
prompt "2.6.18"
config KERNEL_COPY_V_2_6_18_1
bool
prompt "2.6.18.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_18_2
bool
prompt "2.6.18.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_18_3
bool
prompt "2.6.18.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_18_4
bool
prompt "2.6.18.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_18_5
bool
prompt "2.6.18.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_18_6
bool
prompt "2.6.18.6"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_COPY_V_2_6_19
bool
prompt "2.6.19"
config KERNEL_COPY_V_2_6_19_1
bool
prompt "2.6.19.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config KERNEL_VERSION
string
default "2.6.0" if KERNEL_COPY_V_2_6_0
default "2.6.1" if KERNEL_COPY_V_2_6_1
default "2.6.2" if KERNEL_COPY_V_2_6_2
default "2.6.3" if KERNEL_COPY_V_2_6_3
default "2.6.4" if KERNEL_COPY_V_2_6_4
default "2.6.5" if KERNEL_COPY_V_2_6_5
default "2.6.6" if KERNEL_COPY_V_2_6_6
default "2.6.7" if KERNEL_COPY_V_2_6_7
default "2.6.8" if KERNEL_COPY_V_2_6_8
default "2.6.8.1" if KERNEL_COPY_V_2_6_8_1
default "2.6.9" if KERNEL_COPY_V_2_6_9
default "2.6.10" if KERNEL_COPY_V_2_6_10
default "2.6.11" if KERNEL_COPY_V_2_6_11
default "2.6.11.1" if KERNEL_COPY_V_2_6_11_1
default "2.6.11.10" if KERNEL_COPY_V_2_6_11_10
default "2.6.11.11" if KERNEL_COPY_V_2_6_11_11
default "2.6.11.12" if KERNEL_COPY_V_2_6_11_12
default "2.6.11.2" if KERNEL_COPY_V_2_6_11_2
default "2.6.11.3" if KERNEL_COPY_V_2_6_11_3
default "2.6.11.4" if KERNEL_COPY_V_2_6_11_4
default "2.6.11.5" if KERNEL_COPY_V_2_6_11_5
default "2.6.11.6" if KERNEL_COPY_V_2_6_11_6
default "2.6.11.7" if KERNEL_COPY_V_2_6_11_7
default "2.6.11.8" if KERNEL_COPY_V_2_6_11_8
default "2.6.11.9" if KERNEL_COPY_V_2_6_11_9
default "2.6.12" if KERNEL_COPY_V_2_6_12
default "2.6.12.1" if KERNEL_COPY_V_2_6_12_1
default "2.6.12.2" if KERNEL_COPY_V_2_6_12_2
default "2.6.12.3" if KERNEL_COPY_V_2_6_12_3
default "2.6.12.4" if KERNEL_COPY_V_2_6_12_4
default "2.6.12.5" if KERNEL_COPY_V_2_6_12_5
default "2.6.12.6" if KERNEL_COPY_V_2_6_12_6
default "2.6.13" if KERNEL_COPY_V_2_6_13
default "2.6.13.1" if KERNEL_COPY_V_2_6_13_1
default "2.6.13.2" if KERNEL_COPY_V_2_6_13_2
default "2.6.13.3" if KERNEL_COPY_V_2_6_13_3
default "2.6.13.4" if KERNEL_COPY_V_2_6_13_4
default "2.6.13.5" if KERNEL_COPY_V_2_6_13_5
default "2.6.14" if KERNEL_COPY_V_2_6_14
default "2.6.14.1" if KERNEL_COPY_V_2_6_14_1
default "2.6.14.2" if KERNEL_COPY_V_2_6_14_2
default "2.6.14.3" if KERNEL_COPY_V_2_6_14_3
default "2.6.14.4" if KERNEL_COPY_V_2_6_14_4
default "2.6.14.5" if KERNEL_COPY_V_2_6_14_5
default "2.6.14.6" if KERNEL_COPY_V_2_6_14_6
default "2.6.14.7" if KERNEL_COPY_V_2_6_14_7
default "2.6.15" if KERNEL_COPY_V_2_6_15
default "2.6.15.1" if KERNEL_COPY_V_2_6_15_1
default "2.6.15.2" if KERNEL_COPY_V_2_6_15_2
default "2.6.15.3" if KERNEL_COPY_V_2_6_15_3
default "2.6.15.4" if KERNEL_COPY_V_2_6_15_4
default "2.6.15.5" if KERNEL_COPY_V_2_6_15_5
default "2.6.15.6" if KERNEL_COPY_V_2_6_15_6
default "2.6.15.7" if KERNEL_COPY_V_2_6_15_7
default "2.6.16" if KERNEL_COPY_V_2_6_16
default "2.6.16.1" if KERNEL_COPY_V_2_6_16_1
default "2.6.16.10" if KERNEL_COPY_V_2_6_16_10
default "2.6.16.11" if KERNEL_COPY_V_2_6_16_11
default "2.6.16.12" if KERNEL_COPY_V_2_6_16_12
default "2.6.16.13" if KERNEL_COPY_V_2_6_16_13
default "2.6.16.14" if KERNEL_COPY_V_2_6_16_14
default "2.6.16.15" if KERNEL_COPY_V_2_6_16_15
default "2.6.16.16" if KERNEL_COPY_V_2_6_16_16
default "2.6.16.17" if KERNEL_COPY_V_2_6_16_17
default "2.6.16.18" if KERNEL_COPY_V_2_6_16_18
default "2.6.16.19" if KERNEL_COPY_V_2_6_16_19
default "2.6.16.2" if KERNEL_COPY_V_2_6_16_2
default "2.6.16.20" if KERNEL_COPY_V_2_6_16_20
default "2.6.16.21" if KERNEL_COPY_V_2_6_16_21
default "2.6.16.22" if KERNEL_COPY_V_2_6_16_22
default "2.6.16.23" if KERNEL_COPY_V_2_6_16_23
default "2.6.16.24" if KERNEL_COPY_V_2_6_16_24
default "2.6.16.25" if KERNEL_COPY_V_2_6_16_25
default "2.6.16.26" if KERNEL_COPY_V_2_6_16_26
default "2.6.16.27" if KERNEL_COPY_V_2_6_16_27
default "2.6.16.28" if KERNEL_COPY_V_2_6_16_28
default "2.6.16.29" if KERNEL_COPY_V_2_6_16_29
default "2.6.16.3" if KERNEL_COPY_V_2_6_16_3
default "2.6.16.30" if KERNEL_COPY_V_2_6_16_30
default "2.6.16.31" if KERNEL_COPY_V_2_6_16_31
default "2.6.16.32" if KERNEL_COPY_V_2_6_16_32
default "2.6.16.33" if KERNEL_COPY_V_2_6_16_33
default "2.6.16.34" if KERNEL_COPY_V_2_6_16_34
default "2.6.16.35" if KERNEL_COPY_V_2_6_16_35
default "2.6.16.36" if KERNEL_COPY_V_2_6_16_36
default "2.6.16.4" if KERNEL_COPY_V_2_6_16_4
default "2.6.16.5" if KERNEL_COPY_V_2_6_16_5
default "2.6.16.6" if KERNEL_COPY_V_2_6_16_6
default "2.6.16.7" if KERNEL_COPY_V_2_6_16_7
default "2.6.16.8" if KERNEL_COPY_V_2_6_16_8
default "2.6.16.9" if KERNEL_COPY_V_2_6_16_9
default "2.6.17" if KERNEL_COPY_V_2_6_17
default "2.6.17.1" if KERNEL_COPY_V_2_6_17_1
default "2.6.17.10" if KERNEL_COPY_V_2_6_17_10
default "2.6.17.11" if KERNEL_COPY_V_2_6_17_11
default "2.6.17.12" if KERNEL_COPY_V_2_6_17_12
default "2.6.17.13" if KERNEL_COPY_V_2_6_17_13
default "2.6.17.14" if KERNEL_COPY_V_2_6_17_14
default "2.6.17.2" if KERNEL_COPY_V_2_6_17_2
default "2.6.17.3" if KERNEL_COPY_V_2_6_17_3
default "2.6.17.4" if KERNEL_COPY_V_2_6_17_4
default "2.6.17.5" if KERNEL_COPY_V_2_6_17_5
default "2.6.17.6" if KERNEL_COPY_V_2_6_17_6
default "2.6.17.7" if KERNEL_COPY_V_2_6_17_7
default "2.6.17.8" if KERNEL_COPY_V_2_6_17_8
default "2.6.17.9" if KERNEL_COPY_V_2_6_17_9
default "2.6.18" if KERNEL_COPY_V_2_6_18
default "2.6.18.1" if KERNEL_COPY_V_2_6_18_1
default "2.6.18.2" if KERNEL_COPY_V_2_6_18_2
default "2.6.18.3" if KERNEL_COPY_V_2_6_18_3
default "2.6.18.4" if KERNEL_COPY_V_2_6_18_4
default "2.6.18.5" if KERNEL_COPY_V_2_6_18_5
default "2.6.18.6" if KERNEL_COPY_V_2_6_18_6
default "2.6.19" if KERNEL_COPY_V_2_6_19
default "2.6.19.1" if KERNEL_COPY_V_2_6_19_1
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!

View File

@ -0,0 +1,75 @@
choice
bool
prompt "Linux kernel version"
config KERNEL_INSTALL_V_2_6_18
bool
prompt "2.6.18"
config KERNEL_INSTALL_V_2_6_18_1
bool
prompt "2.6.18.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_INSTALL_V_2_6_18_2
bool
prompt "2.6.18.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_INSTALL_V_2_6_18_3
bool
prompt "2.6.18.3"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_INSTALL_V_2_6_18_4
bool
prompt "2.6.18.4"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_INSTALL_V_2_6_18_5
bool
prompt "2.6.18.5"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_INSTALL_V_2_6_18_6
bool
prompt "2.6.18.6"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_INSTALL_V_2_6_19
bool
prompt "2.6.19"
config KERNEL_INSTALL_V_2_6_19_1
bool
prompt "2.6.19.1"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_INSTALL_V_2_6_19_2
bool
prompt "2.6.19.2"
depends on KERNEL_VERSION_SEE_EXTRAVERSION
config KERNEL_INSTALL_V_2_6_20
bool
prompt "2.6.20"
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config KERNEL_VERSION
string
default "2.6.18" if KERNEL_INSTALL_V_2_6_18
default "2.6.18.1" if KERNEL_INSTALL_V_2_6_18_1
default "2.6.18.2" if KERNEL_INSTALL_V_2_6_18_2
default "2.6.18.3" if KERNEL_INSTALL_V_2_6_18_3
default "2.6.18.4" if KERNEL_INSTALL_V_2_6_18_4
default "2.6.18.5" if KERNEL_INSTALL_V_2_6_18_5
default "2.6.18.6" if KERNEL_INSTALL_V_2_6_18_6
default "2.6.19" if KERNEL_INSTALL_V_2_6_19
default "2.6.19.1" if KERNEL_INSTALL_V_2_6_19_1
default "2.6.19.2" if KERNEL_INSTALL_V_2_6_19_2
default "2.6.20" if KERNEL_INSTALL_V_2_6_20
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!

View File

@ -0,0 +1,62 @@
choice
bool
prompt "Linux headers version"
config KERNEL_SANITISED_V_2_6_7_0
bool
prompt "2.6.7.0"
config KERNEL_SANITISED_V_2_6_8_0
bool
prompt "2.6.8.0"
config KERNEL_SANITISED_V_2_6_8_1
bool
prompt "2.6.8.1"
config KERNEL_SANITISED_V_2_6_9_0
bool
prompt "2.6.9.0"
config KERNEL_SANITISED_V_2_6_9_1
bool
prompt "2.6.9.1"
config KERNEL_SANITISED_V_2_6_10_0
bool
prompt "2.6.10.0"
config KERNEL_SANITISED_V_2_6_11_0
bool
prompt "2.6.11.0"
config KERNEL_SANITISED_V_2_6_11_1
bool
prompt "2.6.11.1"
config KERNEL_SANITISED_V_2_6_11_2
bool
prompt "2.6.11.2"
config KERNEL_SANITISED_V_2_6_12_0
bool
prompt "2.6.12.0"
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config KERNEL_VERSION
string
default "2.6.7.0" if KERNEL_SANITISED_V_2_6_7_0
default "2.6.8.0" if KERNEL_SANITISED_V_2_6_8_0
default "2.6.8.1" if KERNEL_SANITISED_V_2_6_8_1
default "2.6.9.0" if KERNEL_SANITISED_V_2_6_9_0
default "2.6.9.1" if KERNEL_SANITISED_V_2_6_9_1
default "2.6.10.0" if KERNEL_SANITISED_V_2_6_10_0
default "2.6.11.0" if KERNEL_SANITISED_V_2_6_11_0
default "2.6.11.1" if KERNEL_SANITISED_V_2_6_11_1
default "2.6.11.2" if KERNEL_SANITISED_V_2_6_11_2
default "2.6.12.0" if KERNEL_SANITISED_V_2_6_12_0
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!

36
config/libc.in Normal file
View File

@ -0,0 +1,36 @@
# C library options
menu "C-library"
choice
bool
prompt "C-library to use:"
default LIBC_GLIBC
config LIBC_GLIBC
bool
prompt "glibc"
config LIBC_UCLIBC
bool
prompt "uClibc"
endchoice
config LIBC_VERSION
string
config LIBC
string
default "glibc" if LIBC_GLIBC
default "uClibc" if LIBC_UCLIBC
if LIBC_GLIBC
source config/libc_glibc.in
endif
if LIBC_UCLIBC
source config/libc_uClibc.in
endif
endmenu

199
config/libc_glibc.in Normal file
View File

@ -0,0 +1,199 @@
# glibc options
choice
bool
prompt "glibc version"
config LIBC_V_1_09_1
bool
prompt "1.09.1"
config LIBC_V_2_0_1
bool
prompt "2.0.1"
config LIBC_V_2_0_6
bool
prompt "2.0.6"
config LIBC_V_2_1_1
bool
prompt "2.1.1"
config LIBC_V_2_1_2
bool
prompt "2.1.2"
config LIBC_V_2_1_3
bool
prompt "2.1.3"
config LIBC_V_2_2
bool
prompt "2.2"
config LIBC_V_2_2_1
bool
prompt "2.2.1"
config LIBC_V_2_2_2
bool
prompt "2.2.2"
config LIBC_V_2_2_3
bool
prompt "2.2.3"
config LIBC_V_2_2_4
bool
prompt "2.2.4"
config LIBC_V_2_2_5
bool
prompt "2.2.5"
config LIBC_V_2_3
bool
prompt "2.3"
config LIBC_V_2_3_1
bool
prompt "2.3.1"
config LIBC_V_2_3_2
bool
prompt "2.3.2"
config LIBC_V_2_3_3
bool
prompt "2.3.3"
config LIBC_V_2_3_4
bool
prompt "2.3.4"
config LIBC_V_2_3_5
bool
prompt "2.3.5"
config LIBC_V_2_3_6
bool
prompt "2.3.6"
config LIBC_V_2_4
bool
prompt "2.4"
config LIBC_V_2_5
bool
prompt "2.5"
# CT_INSERT_VERSION_ABOVE
# Don't remove qbove line!
endchoice
config LIBC_VERSION
string
default "1.09.1" if LIBC_V_1_09_1
default "2.0.1" if LIBC_V_2_0_1
default "2.0.6" if LIBC_V_2_0_6
default "2.1.1" if LIBC_V_2_1_1
default "2.1.2" if LIBC_V_2_1_2
default "2.1.3" if LIBC_V_2_1_3
default "2.2" if LIBC_V_2_2
default "2.2.1" if LIBC_V_2_2_1
default "2.2.2" if LIBC_V_2_2_2
default "2.2.3" if LIBC_V_2_2_3
default "2.2.4" if LIBC_V_2_2_4
default "2.2.5" if LIBC_V_2_2_5
default "2.3" if LIBC_V_2_3
default "2.3.1" if LIBC_V_2_3_1
default "2.3.2" if LIBC_V_2_3_2
default "2.3.3" if LIBC_V_2_3_3
default "2.3.4" if LIBC_V_2_3_4
default "2.3.5" if LIBC_V_2_3_5
default "2.3.6" if LIBC_V_2_3_6
default "2.4" if LIBC_V_2_4
default "2.5" if LIBC_V_2_5
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!
choice
bool
prompt "Threading implentation to use:"
default LIBC_GLIBC_THREADS_LINUXTHREADS
config LIBC_GLIBC_THREADS_NPTL
bool
prompt "nptl (not implemented)"
config LIBC_GLIBC_THREADS_LINUXTHREADS
bool
prompt "linuxthreads"
config LIBC_GLIBC_THREADS_NONE
bool
prompt "none"
endchoice
config LIBC_GLIBC_EXTRA_CONFIG
string
prompt "glibc extra config"
default ""
help
Extra flags to pass onto ./configure when configuring glibc.
Eg.: --enable-static-nss
config LIBC_GLIBC_EXTRA_CFLAGS
string
prompt "glibc extra target CFLAGS"
default ""
help
Extra target CFLAGS to use when building glibc.
config LIBC_EXTRA_CC_ARGS
string
prompt "gcc extra flags"
default ""
help
Extra flags to pass gcc when building glibc.
Seldom used, except for sparc64 which seems to need the flag -64
to be passed onto gcc.
# Please note: This is not used for now (no sh support).
config LIBC_GLIBC_CONFIGPARMS
string
prompt "Extra config params (READ HELP)"
default "" if ARCH != "sh3" && ARCH != "sh4"
default "no-z-defs=yes" if ARCH = "sh3" || ARCH = "sh4"
help
Some architectures need to set options in the file configparms.
This is the case for sh3/4, which really need to set configparms as of
gcc-3.4/glibc-2.3.2.
Unless you are building a toolchain for sh3/4, you should leave that empty.
Note: this is awkward, doesn't work well if you need more than one
line in configparms
config LIBC_ADDONS
bool
prompt "Pass extra addons list"
default n
help
If you say Y here, you'll be able to give the list of addons you want to
include in your C library.
config LIBC_ADDONS_LIST
string
prompt "Extra addons"
default ""
help
Extra addons to include in glibc.
Eg.: crypt (for very old glibces)
ports (for the ports addon, with other architectures)
linuxthreads (for the linuxthreads implementation of threads)

92
config/libc_uClibc.in Normal file
View File

@ -0,0 +1,92 @@
# uClibc options
choice
bool
prompt "uClibc version"
config LIBC_V_snapshot
bool
prompt "latest snapshot"
config LIBC_V_specific_date
bool
prompt "<specific date>"
config LIBC_V_0_9_26
bool
prompt "0.9.26"
config LIBC_V_0_9_27
bool
prompt "0.9.27"
config LIBC_V_0_9_28
bool
prompt "0.9.28"
config LIBC_V_0_9_28_1
bool
prompt "0.9.28.1"
config LIBC_V_0_9_28_2
bool
prompt "0.9.28.2"
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config LIBC_VERSION
string
prompt "Enter date (YYYYMMDD)" if LIBC_V_specific_date
default "snapshot" if LIBC_V_snapshot
default "0.9.26" if LIBC_V_0_9_26
default "0.9.27" if LIBC_V_0_9_27
default "0.9.28" if LIBC_V_0_9_28
default "0.9.28.1" if LIBC_V_0_9_28_1
default "0.9.28.2" if LIBC_V_0_9_28_2
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove qbove line!
choice
bool
prompt "Debug level"
default LIBC_UCLIBC_DEBUG_LEVEL_0
config LIBC_UCLIBC_DEBUG_LEVEL_0
bool
prompt "none"
config LIBC_UCLIBC_DEBUG_LEVEL_1
bool
prompt "minimal"
config LIBC_UCLIBC_DEBUG_LEVEL_2
bool
prompt "all"
endchoice
config LIBC_UCLIBC_DEBUG_LEVEL
int
default 0 if LIBC_UCLIBC_DEBUG_LEVEL_0
default 1 if LIBC_UCLIBC_DEBUG_LEVEL_1
default 2 if LIBC_UCLIBC_DEBUG_LEVEL_2
config LIBC_UCLIBC_CONFIG_FILE
string
prompt "Configuration file"
default ""
help
Path to the configuration file.
You _must_ provide one (for now).
config LIBC_UCLIBC_LOCALES
bool
prompt "Add support for locales"
default n
help
Say y if you want uClibc to support localisation.
Note that seems to be broken on recent uClibc releases.

300
config/target.in Normal file
View File

@ -0,0 +1,300 @@
# Target definition: architecture, optimisations, etc...
menu "Target options"
comment "General target options"
choice
bool
prompt "Target architecture:"
default ARCH_x86
config ARCH_ARM
bool
prompt "arm"
config ARCH_MIPS
bool
prompt "mips"
config ARCH_x86
bool
prompt "x86"
config ARCH_x86_64
bool
prompt "x86_64"
endchoice
choice
bool
prompt "Endianness:"
config ARCH_BE
bool
prompt "Big endian"
config ARCH_LE
bool
prompt "Little endian"
endchoice
comment "Target optimisations"
config ARCH_CPU
string
prompt "Emit assembly for CPU"
default ""
help
This specifies the name of the target ARM processor. GCC uses this name
to determine what kind of instructions it can emit when generating
assembly code.
Pick a value from the gcc manual for your choosen gcc version and your
target CPU.
Leave blank if you don't know, or if your target architecture does not
offer this option.
config ARCH_TUNE
string
prompt "Tune for CPU"
default ""
help
This option is very similar to the ARCH_CPU option (above), except
that instead of specifying the actual target processor type, and hence
restricting which instructions can be used, it specifies that GCC should
tune the performance of the code as if the target were of the type
specified in this option, but still choosing the instructions that it
will generate based on the cpu specified by the ARCH_CPU option
(above), or a (command-line) -mcpu= option.
Pick a value from the gcc manual for your choosen gcc version and your
target CPU.
Leave blank if you don't know, or if your target architecture does not
offer this option.
config ARCH_ARCH
string
prompt "Achitecture level"
default ""
help
GCC uses this name to determine what kind of instructions it can emit
when generating assembly code. This option can be used in conjunction
with or instead of the ARCH_CPU option (above), or a (command-line)
-mcpu= option.
Pick a value from the gcc manual for your choosen gcc version and your
target CPU.
Leave blank if you don't know, or if your target architecture does not
offer this option.
config ARCH_FPU
string
prompt "Use FPU"
default ""
help
On some targets (eg. ARM), you can specify the kind of FPU to emit
code for.
See below wether to actually emit FP opcodes, or to emulate them.
Pick a value from the gcc manual for your choosen gcc version and your
target CPU.
Leave blank if you don't know, or if your target architecture does not
offer this option.
choice
bool
prompt "Floating point:"
config ARCH_FLOAT_HW
bool
prompt "hardware (FPU)"
help
Emit hardware floating point opcodes.
If you've got a processor with a FPU, then you want that.
If your hardware has no FPU, you still can use HW floating point, but
need to compile support for FPU emulation in your kernel. Needless to
say that emulating the FPU is /slooowwwww/...
One situation you'd want HW floating point without a FPU is if you get
binary blobs from different vendors that are compiling this way and
can't (don't wan't to) change.
config ARCH_FLOAT_SW
bool
prompt "software"
help
Do not emit any hardware floating point opcode.
If your processor has no FPU, then you most probably want this, as it
is faster than emulating the FPU in the kernel.
endchoice
config ARCH_FLOAT_SW_LIBFLOAT
bool
prompt "Use libfloat"
default n
depends on ARCH_FLOAT_SW
help
For those targets upporting it, you can use libfloat for the software
floating point emulation.
Note that some versions of gcc have support code that supersedes libfloat,
while others don't. Known version of gcc that don't have support code are
versions prior to 3.0, and version above 4.0.
You should check gcc before deciding to use libfloat.
config TARGET_CFLAGS
string
prompt "Default target CFLAGS"
default ""
help
Used to add specific options when compiling libraries of the toolchain,
that will run on the target (eg. libc.so).
Note that the options above for CPU, tune, arch and FPU will be
automaticaly used. You don't need to specify them here.
Leave blank if you don't know better.
comment "Toolchain options"
config USE_SYSROOT
bool
prompt "Use sysroot'ed toolchain"
default y
help
Use the 'shinny new' sysroot feature of gcc: libraries split between
prefix/target/sys-root/lib and prefix/target/sys-root/usr/lib
You definitely want to say 'Y' here. Yes you do. I know you do. Say 'Y'.
config SHARED_LIBS
bool
prompt "Build shared libraries"
default y
help
Say 'y' here, unless you don't want shared libraries.
You might not want shared librries if you're building for a target that
don't support it (maybe some nommu targets, for example, or bare metal).
config TARGET_MULTILIB
bool
# prompt "Enable 'multilib' support (EXPERIMENTAL)"
default n
help
Enable the so-called 'multilib' support.
With the same toolchain, and on some architectures, you will be able to
build big and little endian binaries, soft- and hard-float, etc...
See the gcc configure manual at http://gcc.gnu.org/install/configure.html
to see what multilib your target supports.
It's preferable for now to build two (or more) toolchains, one for each
configuration you need to support (eg. one for thumb and one for ARM,
etc...). You can use the vendor string to diferentiate those toolchains.
config TARGET_VENDOR
string
prompt "Vendor string"
default "unknown"
help
Vendor part of the machine triplet.
A triplet is of the form arch-vendor-kernel-system.
You can set the second part, vendor, to whatever you see fit.
Use a single word, or use underscores "_" to separate words.
Keep the default (unkown) if you don't know better.
config TARGET_ALIAS
string
prompt "Target alias"
default ""
help
Normaly, you'd call your toolchain component (especially gcc) by
prefixing the target triplet followed by a dash and the component name
(eg. armeb-unknown-linux-uclibc-gcc).
You can enter a shortcut here. This string will be used to create
symbolic links to the toolchain tools (eg. if you enter "foo-bar" here,
then gcc for your toolchain will also be available as "foo-bar-gcc" along
with the original name).
You shouldn't need to enter anything here, unless you plan to manually
call the tools (autotools-based ./configure will use the standard name).
config ARCH
string
default "arm" if ARCH_ARM
default "mips" if ARCH_MIPS
default "x86" if ARCH_x86
default "x86_64" if ARCH_x86_64
config BUILD
string
prompt "Build system triplet"
default ""
help
Canonical name of the machine building the toolchain.
You should leave empty, unless you really now what you're doing.
config CC_NATIVE
string
prompt "Native gcc"
default "gcc"
help
The native C compiler.
You can set this to an alternative compiler if you have more than one
installed (eg. gcc is gcc-4.1.1 and you want to use gcc-3.4.6).
You can leave this empty as well, in which case gcc will be used.
config CANADIAN
bool
prompt "Canadian build (EXPERIMENTAL)"
default n
help
A canadian build allows to build a compiler on a first machine
(build system), that will run on second machine (host system),
targetting a third machine (target system).
An example where you'd want a candian cross-compiler is to create
a native compiler for your target. In this case host and target
are the same.
config HOST
string
prompt "Host system triplet"
default ""
depends on CANADIAN
help
Canonical name of the machine serving as host.
config HOST_CC
string
prompt "Host system compiler"
default "${CT_HOST}-"
depends on CANADIAN
help
C compiler targeting the host system.
If HOST_CC ends with a dash (-), then it is considered to be the
prefix to gcc (eg. x86-pc-linuc-gnu-).
If it is empty, it is formed by appending '-gcc' to HOST.
Else it is considered to be the complete name of the compiler, with
full path, or without path (provided that it can be found in PATH).
endmenu

108
docs/overview.txt Normal file
View File

@ -0,0 +1,108 @@
File.........: overview.txt
Content......: Overview of how ct-ng works.
Copyrigth....: (C) 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
License......: see COPYING in the root of this package
________________
/
Introduction /
_____________/
crosstool-NG aims at building toolchains. Toolchains are an essential component
in a software development project. It will compile, assemble and link the code
that is being developped. Some pieces of the toolchain will eventually end up
in the resulting binary/ies: static libraries are but an example.
So, a toolchain is a very sensitive piece of software, as any bug in one of the
components, or a poorly configured component, can lead to execution problems,
ranging from poor performance, to applications ending unexpectedly, to
mis-behaving software (which more than often is hard to detect), to hardware
damage, or even to human risks (which is more than regretable).
Toolchains are made of different piece of software, each being quite complex
and requiring specially crafted options to build and work seamlessly. This
is usually not that easy, even in the not-so-trivial case of native toolchains.
The work reaches a higher degree of complexity when it comes to cross-
compilation, where it can becomes quite a nightmare...
Some cross-toolchain exits on the internet, and can be used for general
development, but they have a number of limitations:
- they can be general purpose, in that they are configured for the majority:
no optimisation for your specific target,
- they can be prepared for a specific target and thus are not easy to use,
nor optimised for, or even supporting your target,
- they often are using ageing components (compiler, C library, etc...) not
supporting special features of your shiny new processor;
On the other side, these toolchain offer some advantages:
- they are ready to use and quite easy to install and setup,
- they are proven if used by a wide community.
But once you want to get all the juice out of your specific hardware, you will
want to build your own toolchain. This is where crosstool-ng comes into play.
There are also a number of tools that builds toolchains for specific needs,
which is not really scalable. Examples are:
- buildroot (buildroot.uclibc.org) whose main puprpose is to build root file
systems, hence the name. But once you have your toolchain with buildroot,
part of it is installed in the root-to-be, so if you want to build a whole
new root, you either have to save the existing one as a template and
restore it later, or restart again from scratch. This is not convenient,
- ptxdist (www.pengutronix.de/software/ptxdist), whose purpose is very
similar to buildroot,
- other projects (openembeded.org for example), which is again used to
build root file systems.
crosstool-NG is really targetted at building toolchains, and only toolchains.
It is then up to you to use it the way you want.
___________
/
History /
________/
crosstool was first 'conceived' by Dan Kegel, which offered it to the community,
as a set of scripts, a repository of patches, and some pre-configured, general
purpose setup files to be used to configure crosstool. This is available at
www.kegel.com/crosstool, and the subversion repository is hosted on google at
http://code.google.com/p/crosstool/.
At the time of writing, crosstool only supports building with one C library,
namely glibc, and one C compiler, gcc; it is cripled with historical support
for legacy components, and is some kind of a mess to upgrade.
I once managed to add support for uClibc-based toolchains, but it did not make
into mainline, mostly because I don't have time to port the patch forward to
the new versions, due in part to the big effort it was taking.
So I decided to clean up crosstool in the state it was, re-order the things
in place, and add appropriate support for what I needed, that is uClibc
support.
The only option left to me was rewrite crosstool from scratch. I decided to go
this way, and name the new implementation ct-ng, standing for crosstool Next
Generation, as many other comunity projects do, and as a wink at the TV series
"Star Trek: The Next Generation". ;-)
_____________
/
Operation /
__________/
ct-ng is configured by a configurator presenting a menu-stuctured set of
options. These options let you specify the way you want your toolchain built,
where you want it installed, what architecture and specific processor it
will support, the version of the components you want to use, etc... The
value for those options are then stored in a configuration file.
You then simply run make. It will use this configuration file to retrieve,
extract and patch the components, build, install and test your newly built
toolchain.
You are then free to add the toolchain /bin directory in your PATH to use
it at will.
_____________
/
Internals /
__________/
<To be completed>

71
kconfig/Makefile Normal file
View File

@ -0,0 +1,71 @@
# ===========================================================================
# crosstool-ng configuration targets
# These targets are used from top-level makefile
KCONFIG_TOP = config/config.in
obj = ./kconfig
PHONY += clean help oldconfig menuconfig config silentoldconfig \
randconfig allyesconfig allnoconfig allmodconfig defconfig
menuconfig: $(obj)/mconf
@$< $(KCONFIG_TOP)
config: $(obj)/conf
@$< $(KCONFIG_TOP)
oldconfig: $(obj)/conf
@$< -s $(KCONFIG_TOP)
randconfig: $(obj)/conf
@$< -r $(KCONFIG_TOP)
allyesconfig: $(obj)/conf
@$< -y $(KCONFIG_TOP)
allnoconfig: $(obj)/conf
@$< -n $(KCONFIG_TOP)
defconfig: $(obj)/conf
@$< -d $(KCONFIG_TOP)
# Build a list of all available samples
SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%,%,$(filter-out %Makefile,$(wildcard $(CT_TOP_DIR)/samples/*)))
SAMPLES_CONFIG = $(patsubst %,%_config,$(SAMPLES))
.PHONY: $(SAMPLES_CONFIG)
$(SAMPLES_CONFIG):
@cp "$(CT_TOP_DIR)/samples/$(patsubst %_config,%,$@)/crosstool.config" "$(CT_TOP_DIR)/.config"
@$(MAKE) oldconfig
# Help text used by make help
help::
@echo 'General purpose configuration targets:'
@echo ' config - Update current config utilising a line-oriented program'
@echo ' menuconfig - Update current config utilising a menu based program'
@echo ' oldconfig - Update current config utilising a provided .config as base'
@echo ' randconfig - New config with random answer to all options'
@echo ' defconfig - New config with default answer to all options'
@echo ' allyesconfig - New config where all options are accepted with yes'
@echo ' allnoconfig - New config where all options are answered with no'
@echo
@echo 'Preconfigured configuration targets:'
@for s in $(SAMPLES_CONFIG); do \
echo " $${s}"; \
done
@echo ''
# Cheesy build
SHIPPED = kconfig/zconf.tab.c kconfig/lex.zconf.c kconfig/zconf.hash.c
%.c: %.c_shipped
@ln -s $(notdir $<) $@
kconfig/mconf: $(SHIPPED) kconfig/mconf.c
@$(HOST_CC) -o $@ kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
-lcurses "-DCURSES_LOC=<ncurses.h>"
kconfig/conf: $(SHIPPED) kconfig/conf.c
@$(HOST_CC) -o $@ kconfig/{conf.c,zconf.tab.c}
clean::
@rm -f $(wildcard kconfig/*zconf*.c) kconfig/{conf,mconf}

623
kconfig/conf.c Normal file
View File

@ -0,0 +1,623 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
static void conf(struct menu *menu);
static void check_conf(struct menu *menu);
enum {
ask_all,
ask_new,
ask_silent,
set_default,
set_yes,
set_mod,
set_no,
set_random
} input_mode = ask_all;
char *defconfig_file;
static int indent = 1;
static int valid_stdin = 1;
static int conf_cnt;
static char line[128];
static struct menu *rootEntry;
static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
static void strip(char *str)
{
char *p = str;
int l;
while ((isspace(*p)))
p++;
l = strlen(p);
if (p != str)
memmove(str, p, l + 1);
if (!l)
return;
p = str + l - 1;
while ((isspace(*p)))
*p-- = 0;
}
static void check_stdin(void)
{
if (!valid_stdin && input_mode == ask_silent) {
printf(_("aborted!\n\n"));
printf(_("Console input/output is redirected. "));
printf(_("Run 'make oldconfig' to update configuration.\n\n"));
exit(1);
}
}
static void conf_askvalue(struct symbol *sym, const char *def)
{
enum symbol_type type = sym_get_type(sym);
tristate val;
if (!sym_has_value(sym))
printf("(NEW) ");
line[0] = '\n';
line[1] = 0;
if (!sym_is_changable(sym)) {
printf("%s\n", def);
line[0] = '\n';
line[1] = 0;
return;
}
switch (input_mode) {
case set_no:
case set_mod:
case set_yes:
case set_random:
if (sym_has_value(sym)) {
printf("%s\n", def);
return;
}
break;
case ask_new:
case ask_silent:
if (sym_has_value(sym)) {
printf("%s\n", def);
return;
}
check_stdin();
case ask_all:
fflush(stdout);
fgets(line, 128, stdin);
return;
case set_default:
printf("%s\n", def);
return;
default:
break;
}
switch (type) {
case S_INT:
case S_HEX:
case S_STRING:
printf("%s\n", def);
return;
default:
;
}
switch (input_mode) {
case set_yes:
if (sym_tristate_within_range(sym, yes)) {
line[0] = 'y';
line[1] = '\n';
line[2] = 0;
break;
}
case set_mod:
if (type == S_TRISTATE) {
if (sym_tristate_within_range(sym, mod)) {
line[0] = 'm';
line[1] = '\n';
line[2] = 0;
break;
}
} else {
if (sym_tristate_within_range(sym, yes)) {
line[0] = 'y';
line[1] = '\n';
line[2] = 0;
break;
}
}
case set_no:
if (sym_tristate_within_range(sym, no)) {
line[0] = 'n';
line[1] = '\n';
line[2] = 0;
break;
}
case set_random:
do {
val = (tristate)(random() % 3);
} while (!sym_tristate_within_range(sym, val));
switch (val) {
case no: line[0] = 'n'; break;
case mod: line[0] = 'm'; break;
case yes: line[0] = 'y'; break;
}
line[1] = '\n';
line[2] = 0;
break;
default:
break;
}
printf("%s", line);
}
int conf_string(struct menu *menu)
{
struct symbol *sym = menu->sym;
const char *def, *help;
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
printf("(%s) ", sym->name);
def = sym_get_string_value(sym);
if (sym_get_string_value(sym))
printf("[%s] ", def);
conf_askvalue(sym, def);
switch (line[0]) {
case '\n':
break;
case '?':
/* print help */
if (line[1] == '\n') {
help = nohelp_text;
if (menu->sym->help)
help = menu->sym->help;
printf("\n%s\n", menu->sym->help);
def = NULL;
break;
}
default:
line[strlen(line)-1] = 0;
def = line;
}
if (def && sym_set_string_value(sym, def))
return 0;
}
}
static int conf_sym(struct menu *menu)
{
struct symbol *sym = menu->sym;
int type;
tristate oldval, newval;
const char *help;
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
if (sym->name)
printf("(%s) ", sym->name);
type = sym_get_type(sym);
putchar('[');
oldval = sym_get_tristate_value(sym);
switch (oldval) {
case no:
putchar('N');
break;
case mod:
putchar('M');
break;
case yes:
putchar('Y');
break;
}
if (oldval != no && sym_tristate_within_range(sym, no))
printf("/n");
if (oldval != mod && sym_tristate_within_range(sym, mod))
printf("/m");
if (oldval != yes && sym_tristate_within_range(sym, yes))
printf("/y");
if (sym->help)
printf("/?");
printf("] ");
conf_askvalue(sym, sym_get_string_value(sym));
strip(line);
switch (line[0]) {
case 'n':
case 'N':
newval = no;
if (!line[1] || !strcmp(&line[1], "o"))
break;
continue;
case 'm':
case 'M':
newval = mod;
if (!line[1])
break;
continue;
case 'y':
case 'Y':
newval = yes;
if (!line[1] || !strcmp(&line[1], "es"))
break;
continue;
case 0:
newval = oldval;
break;
case '?':
goto help;
default:
continue;
}
if (sym_set_tristate_value(sym, newval))
return 0;
help:
help = nohelp_text;
if (sym->help)
help = sym->help;
printf("\n%s\n", help);
}
}
static int conf_choice(struct menu *menu)
{
struct symbol *sym, *def_sym;
struct menu *child;
int type;
bool is_new;
sym = menu->sym;
type = sym_get_type(sym);
is_new = !sym_has_value(sym);
if (sym_is_changable(sym)) {
conf_sym(menu);
sym_calc_value(sym);
switch (sym_get_tristate_value(sym)) {
case no:
return 1;
case mod:
return 0;
case yes:
break;
}
} else {
switch (sym_get_tristate_value(sym)) {
case no:
return 1;
case mod:
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
return 0;
case yes:
break;
}
}
while (1) {
int cnt, def;
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
def_sym = sym_get_choice_value(sym);
cnt = def = 0;
line[0] = 0;
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
if (!child->sym) {
printf("%*c %s\n", indent, '*', menu_get_prompt(child));
continue;
}
cnt++;
if (child->sym == def_sym) {
def = cnt;
printf("%*c", indent, '>');
} else
printf("%*c", indent, ' ');
printf(" %d. %s", cnt, menu_get_prompt(child));
if (child->sym->name)
printf(" (%s)", child->sym->name);
if (!sym_has_value(child->sym))
printf(" (NEW)");
printf("\n");
}
printf("%*schoice", indent - 1, "");
if (cnt == 1) {
printf("[1]: 1\n");
goto conf_childs;
}
printf("[1-%d", cnt);
if (sym->help)
printf("?");
printf("]: ");
switch (input_mode) {
case ask_new:
case ask_silent:
if (!is_new) {
cnt = def;
printf("%d\n", cnt);
break;
}
check_stdin();
case ask_all:
fflush(stdout);
fgets(line, 128, stdin);
strip(line);
if (line[0] == '?') {
printf("\n%s\n", menu->sym->help ?
menu->sym->help : nohelp_text);
continue;
}
if (!line[0])
cnt = def;
else if (isdigit(line[0]))
cnt = atoi(line);
else
continue;
break;
case set_random:
def = (random() % cnt) + 1;
case set_default:
case set_yes:
case set_mod:
case set_no:
cnt = def;
printf("%d\n", cnt);
break;
}
conf_childs:
for (child = menu->list; child; child = child->next) {
if (!child->sym || !menu_is_visible(child))
continue;
if (!--cnt)
break;
}
if (!child)
continue;
if (line[strlen(line) - 1] == '?') {
printf("\n%s\n", child->sym->help ?
child->sym->help : nohelp_text);
continue;
}
sym_set_choice_value(sym, child->sym);
if (child->list) {
indent += 2;
conf(child->list);
indent -= 2;
}
return 1;
}
}
static void conf(struct menu *menu)
{
struct symbol *sym;
struct property *prop;
struct menu *child;
if (!menu_is_visible(menu))
return;
sym = menu->sym;
prop = menu->prompt;
if (prop) {
const char *prompt;
switch (prop->type) {
case P_MENU:
if (input_mode == ask_silent && rootEntry != menu) {
check_conf(menu);
return;
}
case P_COMMENT:
prompt = menu_get_prompt(menu);
if (prompt)
printf("%*c\n%*c %s\n%*c\n",
indent, '*',
indent, '*', prompt,
indent, '*');
default:
;
}
}
if (!sym)
goto conf_childs;
if (sym_is_choice(sym)) {
conf_choice(menu);
if (sym->curr.tri != mod)
return;
goto conf_childs;
}
switch (sym->type) {
case S_INT:
case S_HEX:
case S_STRING:
conf_string(menu);
break;
default:
conf_sym(menu);
break;
}
conf_childs:
if (sym)
indent += 2;
for (child = menu->list; child; child = child->next)
conf(child);
if (sym)
indent -= 2;
}
static void check_conf(struct menu *menu)
{
struct symbol *sym;
struct menu *child;
if (!menu_is_visible(menu))
return;
sym = menu->sym;
if (sym && !sym_has_value(sym)) {
if (sym_is_changable(sym) ||
(sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
if (!conf_cnt++)
printf(_("*\n* Restart config...\n*\n"));
rootEntry = menu_get_parent_menu(menu);
conf(rootEntry);
}
}
for (child = menu->list; child; child = child->next)
check_conf(child);
}
int main(int ac, char **av)
{
int i = 1;
const char *name;
struct stat tmpstat;
if (ac > i && av[i][0] == '-') {
switch (av[i++][1]) {
case 'o':
input_mode = ask_new;
break;
case 's':
input_mode = ask_silent;
valid_stdin = isatty(0) && isatty(1) && isatty(2);
break;
case 'd':
input_mode = set_default;
break;
case 'D':
input_mode = set_default;
defconfig_file = av[i++];
if (!defconfig_file) {
printf(_("%s: No default config file specified\n"),
av[0]);
exit(1);
}
break;
case 'n':
input_mode = set_no;
break;
case 'm':
input_mode = set_mod;
break;
case 'y':
input_mode = set_yes;
break;
case 'r':
input_mode = set_random;
srandom(time(NULL));
break;
case 'h':
case '?':
fprintf(stderr, "See README for usage info\n");
exit(0);
}
}
name = av[i];
if (!name) {
printf(_("%s: Kconfig file missing\n"), av[0]);
exit(1);
}
conf_parse(name);
//zconfdump(stdout);
switch (input_mode) {
case set_default:
if (!defconfig_file)
defconfig_file = conf_get_default_confname();
if (conf_read(defconfig_file)) {
printf("***\n"
"*** Can't find default configuration \"%s\"!\n"
"***\n", defconfig_file);
exit(1);
}
break;
case ask_silent:
if (stat(".config", &tmpstat)) {
printf(_("***\n"
"*** You have not yet configured your "PROJECT_NAME"!\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make xconfig\").\n"
"***\n"));
exit(1);
}
case ask_all:
case ask_new:
conf_read(NULL);
break;
case set_no:
case set_mod:
case set_yes:
case set_random:
name = getenv("KCONFIG_ALLCONFIG");
if (name && !stat(name, &tmpstat)) {
conf_read_simple(name, S_DEF_USER);
break;
}
switch (input_mode) {
case set_no: name = "allno.config"; break;
case set_mod: name = "allmod.config"; break;
case set_yes: name = "allyes.config"; break;
case set_random: name = "allrandom.config"; break;
default: break;
}
if (!stat(name, &tmpstat))
conf_read_simple(name, S_DEF_USER);
else if (!stat("all.config", &tmpstat))
conf_read_simple("all.config", S_DEF_USER);
break;
default:
break;
}
if (input_mode != ask_silent) {
rootEntry = &rootmenu;
conf(&rootmenu);
if (input_mode == ask_all) {
input_mode = ask_silent;
valid_stdin = 1;
}
} else if (sym_change_count) {
name = getenv("KCONFIG_NOSILENTUPDATE");
if (name && *name) {
fprintf(stderr, _("\n*** "PROJECT_NAME" configuration requires explicit update.\n\n"));
return 1;
}
} else
goto skip_check;
do {
conf_cnt = 0;
check_conf(&rootmenu);
} while (conf_cnt);
if (!conf_write(NULL)) {
skip_check:
return 0;
}
fprintf(stderr, _("\n*** Error writing "PROJECT_NAME" configuration.\n\n"));
return 1;
}

800
kconfig/confdata.c Normal file
View File

@ -0,0 +1,800 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
static void conf_warning(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
static const char *conf_filename;
static int conf_lineno, conf_warnings, conf_unsaved;
#ifndef conf_defname
const char conf_defname[] = "arch/$ARCH/defconfig";
#endif
static void conf_warning(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s:%d:warning: ", conf_filename, conf_lineno);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
conf_warnings++;
}
const char *conf_get_configname(void)
{
char *name = getenv("KCONFIG_CONFIG");
return name ? name : ".config";
}
static char *conf_expand_value(const char *in)
{
struct symbol *sym;
const char *src;
static char res_value[SYMBOL_MAXLENGTH];
char *dst, name[SYMBOL_MAXLENGTH];
res_value[0] = 0;
dst = name;
while ((src = strchr(in, '$'))) {
strncat(res_value, in, src - in);
src++;
dst = name;
while (isalnum(*src) || *src == '_')
*dst++ = *src++;
*dst = 0;
sym = sym_lookup(name, 0);
sym_calc_value(sym);
strcat(res_value, sym_get_string_value(sym));
in = src;
}
strcat(res_value, in);
return res_value;
}
char *conf_get_default_confname(void)
{
struct stat buf;
static char fullname[PATH_MAX+1];
char *env, *name;
name = conf_expand_value(conf_defname);
env = getenv(SRCTREE);
if (env) {
sprintf(fullname, "%s/%s", env, name);
if (!stat(fullname, &buf))
return fullname;
}
return name;
}
int conf_read_simple(const char *name, int def)
{
FILE *in = NULL;
char line[1024];
char *p, *p2;
struct symbol *sym;
int i, def_flags;
if (name) {
in = zconf_fopen(name);
} else {
struct property *prop;
name = conf_get_configname();
in = zconf_fopen(name);
if (in)
goto load;
sym_change_count++;
if (!sym_defconfig_list)
return 1;
for_all_defaults(sym_defconfig_list, prop) {
if (expr_calc_value(prop->visible.expr) == no ||
prop->expr->type != E_SYMBOL)
continue;
name = conf_expand_value(prop->expr->left.sym->name);
in = zconf_fopen(name);
if (in) {
printf(_("#\n"
"# using defaults found in %s\n"
"#\n"), name);
goto load;
}
}
}
if (!in)
return 1;
load:
conf_filename = name;
conf_lineno = 0;
conf_warnings = 0;
conf_unsaved = 0;
def_flags = SYMBOL_DEF << def;
for_all_symbols(i, sym) {
sym->flags |= SYMBOL_CHANGED;
sym->flags &= ~(def_flags|SYMBOL_VALID);
if (sym_is_choice(sym))
sym->flags |= def_flags;
switch (sym->type) {
case S_INT:
case S_HEX:
case S_STRING:
if (sym->def[def].val)
free(sym->def[def].val);
default:
sym->def[def].val = NULL;
sym->def[def].tri = no;
}
}
while (fgets(line, sizeof(line), in)) {
conf_lineno++;
sym = NULL;
switch (line[0]) {
case '#':
if (memcmp(line + 2, "CT_", 3))
continue;
p = strchr(line + 5, ' ');
if (!p)
continue;
*p++ = 0;
if (strncmp(p, "is not set", 10))
continue;
if (def == S_DEF_USER) {
sym = sym_find(line + 5);
if (!sym) {
conf_warning("trying to assign nonexistent symbol %s", line + 5);
break;
}
} else {
sym = sym_lookup(line + 5, 0);
if (sym->type == S_UNKNOWN)
sym->type = S_BOOLEAN;
}
if (sym->flags & def_flags) {
conf_warning("trying to reassign symbol %s", sym->name);
break;
}
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
sym->def[def].tri = no;
sym->flags |= def_flags;
break;
default:
;
}
break;
case 'C':
if (memcmp(line, "CT_", 3)) {
conf_warning("unexpected data");
continue;
}
p = strchr(line + 3, '=');
if (!p)
continue;
*p++ = 0;
p2 = strchr(p, '\n');
if (p2) {
*p2-- = 0;
if (*p2 == '\r')
*p2 = 0;
}
if (def == S_DEF_USER) {
sym = sym_find(line + 3);
if (!sym) {
conf_warning("trying to assign nonexistent symbol %s", line + 3);
break;
}
} else {
sym = sym_lookup(line + 3, 0);
if (sym->type == S_UNKNOWN)
sym->type = S_OTHER;
}
if (sym->flags & def_flags) {
conf_warning("trying to reassign symbol %s", sym->name);
break;
}
switch (sym->type) {
case S_TRISTATE:
if (p[0] == 'm') {
sym->def[def].tri = mod;
sym->flags |= def_flags;
break;
}
case S_BOOLEAN:
if (p[0] == 'y') {
sym->def[def].tri = yes;
sym->flags |= def_flags;
break;
}
if (p[0] == 'n') {
sym->def[def].tri = no;
sym->flags |= def_flags;
break;
}
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
break;
case S_OTHER:
if (*p != '"') {
for (p2 = p; *p2 && !isspace(*p2); p2++)
;
sym->type = S_STRING;
goto done;
}
case S_STRING:
if (*p++ != '"')
break;
for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
if (*p2 == '"') {
*p2 = 0;
break;
}
memmove(p2, p2 + 1, strlen(p2));
}
if (!p2) {
conf_warning("invalid string found");
continue;
}
case S_INT:
case S_HEX:
done:
if (sym_string_valid(sym, p)) {
sym->def[def].val = strdup(p);
sym->flags |= def_flags;
} else {
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
continue;
}
break;
default:
;
}
break;
case '\r':
case '\n':
break;
default:
conf_warning("unexpected data");
continue;
}
if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->def[def].tri) {
case no:
break;
case mod:
if (cs->def[def].tri == yes) {
conf_warning("%s creates inconsistent choice state", sym->name);
cs->flags &= ~def_flags;
}
break;
case yes:
if (cs->def[def].tri != no) {
conf_warning("%s creates inconsistent choice state", sym->name);
cs->flags &= ~def_flags;
} else
cs->def[def].val = sym;
break;
}
cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri);
}
}
fclose(in);
if (modules_sym)
sym_calc_value(modules_sym);
return 0;
}
int conf_read(const char *name)
{
struct symbol *sym;
struct property *prop;
struct expr *e;
int i, flags;
sym_change_count = 0;
if (conf_read_simple(name, S_DEF_USER))
return 1;
for_all_symbols(i, sym) {
sym_calc_value(sym);
if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO))
goto sym_ok;
if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
/* check that calculated value agrees with saved value */
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym))
break;
if (!sym_is_choice(sym))
goto sym_ok;
default:
if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
goto sym_ok;
break;
}
} else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE))
/* no previous value and not saved */
goto sym_ok;
conf_unsaved++;
/* maybe print value in verbose mode... */
sym_ok:
if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
if (sym->visible == no)
sym->flags &= ~SYMBOL_DEF_USER;
switch (sym->type) {
case S_STRING:
case S_INT:
case S_HEX:
if (!sym_string_within_range(sym, sym->def[S_DEF_USER].val))
sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER);
default:
break;
}
}
if (!sym_is_choice(sym))
continue;
prop = sym_get_choice_prop(sym);
flags = sym->flags;
for (e = prop->expr; e; e = e->left.expr)
if (e->right.sym->visible != no)
flags &= e->right.sym->flags;
sym->flags &= flags | ~SYMBOL_DEF_USER;
}
sym_change_count += conf_warnings || conf_unsaved;
return 0;
}
struct menu *next_menu(struct menu *menu)
{
if (menu->list) return menu->list;
do {
if (menu->next) {
menu = menu->next;
break;
}
} while ((menu = menu->parent));
return menu;
}
#define SYMBOL_FORCEWRITE (1<<31)
int conf_write(const char *name)
{
FILE *out;
struct symbol *sym;
struct menu *menu;
const char *basename;
char dirname[128], tmpname[128], newname[128];
int type, l, writetype;
const char *str;
time_t now;
int use_timestamp = 1;
char *env;
dirname[0] = 0;
if (name && name[0]) {
struct stat st;
char *slash;
if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
strcpy(dirname, name);
strcat(dirname, "/");
basename = conf_get_configname();
} else if ((slash = strrchr(name, '/'))) {
int size = slash - name + 1;
memcpy(dirname, name, size);
dirname[size] = 0;
if (slash[1])
basename = slash + 1;
else
basename = conf_get_configname();
} else
basename = name;
} else
basename = conf_get_configname();
sprintf(newname, "%s%s", dirname, basename);
env = getenv("KCONFIG_OVERWRITECONFIG");
if (!env || !*env) {
sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
out = fopen(tmpname, "w");
} else {
*tmpname = 0;
out = fopen(newname, "w");
}
if (!out)
return 1;
sym = sym_lookup("PROJECTVERSION", 0);
sym_calc_value(sym);
time(&now);
env = getenv("KCONFIG_NOTIMESTAMP");
if (env && *env)
use_timestamp = 0;
fprintf(out, _("#\n"
"# Automatically generated make config: don't edit\n"
"# "PROJECT_NAME" version: %s\n"
"%s%s"
"#\n"),
sym_get_string_value(sym),
use_timestamp ? "# " : "",
use_timestamp ? ctime(&now) : "");
if (!sym_change_count)
sym_clear_all_valid();
// Write out all symbols (even in closed sub-menus).
if (1) {
for (menu = rootmenu.list; menu; menu = next_menu(menu))
if (menu->sym) menu->sym->flags |= SYMBOL_FORCEWRITE;
writetype = SYMBOL_FORCEWRITE;
// Don't write out symbols in closed menus.
} else writetype = SYMBOL_WRITE;
menu = rootmenu.list;
while (menu) {
sym = menu->sym;
if (!sym) {
if (!menu_is_visible(menu))
goto next;
str = menu_get_prompt(menu);
fprintf(out, "\n"
"#\n"
"# %s\n"
"#\n", str);
} else if (!(sym->flags & SYMBOL_CHOICE)) {
sym_calc_value(sym);
if (!(sym->flags & writetype))
goto next;
sym->flags &= ~writetype;
type = sym->type;
if (type == S_TRISTATE) {
sym_calc_value(modules_sym);
if (modules_sym->curr.tri == no)
type = S_BOOLEAN;
}
switch (type) {
case S_BOOLEAN:
case S_TRISTATE:
switch (sym_get_tristate_value(sym)) {
case no:
fprintf(out, "# CT_%s is not set\n", sym->name);
break;
case mod:
fprintf(out, "CT_%s=m\n", sym->name);
break;
case yes:
fprintf(out, "CT_%s=y\n", sym->name);
break;
}
break;
case S_STRING:
str = sym_get_string_value(sym);
fprintf(out, "CT_%s=\"", sym->name);
while (1) {
l = strcspn(str, "\"\\");
if (l) {
fwrite(str, l, 1, out);
str += l;
}
if (!*str)
break;
fprintf(out, "\\%c", *str++);
}
fputs("\"\n", out);
break;
case S_HEX:
str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
fprintf(out, "CT_%s=%s\n", sym->name, *str ? str : "0");
break;
}
case S_INT:
str = sym_get_string_value(sym);
fprintf(out, "CT_%s=%s\n", sym->name, *str ? str : "0");
break;
}
}
next:
if (writetype == SYMBOL_WRITE) {
if (menu->list) {
menu = menu->list;
continue;
}
if (menu->next)
menu = menu->next;
else while ((menu = menu->parent)) {
if (menu->next) {
menu = menu->next;
break;
}
}
} else
menu = next_menu(menu);
}
fclose(out);
if (*tmpname) {
strcat(dirname, basename);
strcat(dirname, ".old");
rename(newname, dirname);
if (rename(tmpname, newname))
return 1;
}
printf(_("#\n"
"# configuration written to %s\n"
"#\n"), newname);
sym_change_count = 0;
return 0;
}
int conf_split_config(void)
{
char *name, path[128];
char *s, *d, c;
struct symbol *sym;
struct stat sb;
int res, i, fd;
name = getenv("KCONFIG_AUTOCONFIG");
if (!name)
name = "include/config/auto.conf";
conf_read_simple(name, S_DEF_AUTO);
if (chdir("include/config"))
return 1;
res = 0;
for_all_symbols(i, sym) {
sym_calc_value(sym);
if ((sym->flags & SYMBOL_AUTO) || !sym->name)
continue;
if (sym->flags & SYMBOL_WRITE) {
if (sym->flags & SYMBOL_DEF_AUTO) {
/*
* symbol has old and new value,
* so compare them...
*/
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
if (sym_get_tristate_value(sym) ==
sym->def[S_DEF_AUTO].tri)
continue;
break;
case S_STRING:
case S_HEX:
case S_INT:
if (!strcmp(sym_get_string_value(sym),
sym->def[S_DEF_AUTO].val))
continue;
break;
default:
break;
}
} else {
/*
* If there is no old value, only 'no' (unset)
* is allowed as new value.
*/
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
if (sym_get_tristate_value(sym) == no)
continue;
break;
default:
break;
}
}
} else if (!(sym->flags & SYMBOL_DEF_AUTO))
/* There is neither an old nor a new value. */
continue;
/* else
* There is an old value, but no new value ('no' (unset)
* isn't saved in auto.conf, so the old value is always
* different from 'no').
*/
/* Replace all '_' and append ".h" */
s = sym->name;
d = path;
while ((c = *s++)) {
c = tolower(c);
*d++ = (c == '_') ? '/' : c;
}
strcpy(d, ".h");
/* Assume directory path already exists. */
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
if (errno != ENOENT) {
res = 1;
break;
}
/*
* Create directory components,
* unless they exist already.
*/
d = path;
while ((d = strchr(d, '/'))) {
*d = 0;
if (stat(path, &sb) && mkdir(path, 0755)) {
res = 1;
goto out;
}
*d++ = '/';
}
/* Try it again. */
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
res = 1;
break;
}
}
close(fd);
}
out:
if (chdir("../.."))
return 1;
return res;
}
int conf_write_autoconf(void)
{
struct symbol *sym;
const char *str;
char *name;
FILE *out, *out_h;
time_t now;
int i, l;
sym_clear_all_valid();
file_write_dep("include/config/auto.conf.cmd");
if (conf_split_config())
return 1;
out = fopen(".tmpconfig", "w");
if (!out)
return 1;
out_h = fopen(".tmpconfig.h", "w");
if (!out_h) {
fclose(out);
return 1;
}
sym = sym_lookup("PROJECTVERSION", 0);
sym_calc_value(sym);
time(&now);
fprintf(out, "#\n"
"# Automatically generated make config: don't edit\n"
"# "PROJECT_NAME" version: %s\n"
"# %s"
"#\n",
sym_get_string_value(sym), ctime(&now));
fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n"
" * "PROJECT_NAME" version: %s\n"
" * %s"
" */\n"
"#define AUTOCONF_INCLUDED\n",
sym_get_string_value(sym), ctime(&now));
for_all_symbols(i, sym) {
sym_calc_value(sym);
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
continue;
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
switch (sym_get_tristate_value(sym)) {
case no:
break;
case mod:
fprintf(out, "CT_%s=m\n", sym->name);
fprintf(out_h, "#define CT_%s_MODULE 1\n", sym->name);
break;
case yes:
fprintf(out, "CT_%s=y\n", sym->name);
fprintf(out_h, "#define CT_%s 1\n", sym->name);
break;
}
break;
case S_STRING:
str = sym_get_string_value(sym);
fprintf(out, "CT_%s=\"", sym->name);
fprintf(out_h, "#define CT_%s \"", sym->name);
while (1) {
l = strcspn(str, "\"\\");
if (l) {
fwrite(str, l, 1, out);
fwrite(str, l, 1, out_h);
str += l;
}
if (!*str)
break;
fprintf(out, "\\%c", *str);
fprintf(out_h, "\\%c", *str);
str++;
}
fputs("\"\n", out);
fputs("\"\n", out_h);
break;
case S_HEX:
str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
fprintf(out, "CT_%s=%s\n", sym->name, str);
fprintf(out_h, "#define CT_%s 0x%s\n", sym->name, str);
break;
}
case S_INT:
str = sym_get_string_value(sym);
fprintf(out, "CT_%s=%s\n", sym->name, str);
fprintf(out_h, "#define CT_%s %s\n", sym->name, str);
break;
default:
break;
}
}
fclose(out);
fclose(out_h);
name = getenv("KCONFIG_AUTOHEADER");
if (!name)
name = "include/linux/autoconf.h";
if (rename(".tmpconfig.h", name))
return 1;
name = getenv("KCONFIG_AUTOCONFIG");
if (!name)
name = "include/config/auto.conf";
/*
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
*/
if (rename(".tmpconfig", name))
return 1;
return 0;
}

1100
kconfig/expr.c Normal file

File diff suppressed because it is too large Load Diff

202
kconfig/expr.h Normal file
View File

@ -0,0 +1,202 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#ifndef EXPR_H
#define EXPR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#ifndef __cplusplus
#include <stdbool.h>
#endif
struct file {
struct file *next;
struct file *parent;
char *name;
int lineno;
int flags;
};
#define FILE_BUSY 0x0001
#define FILE_SCANNED 0x0002
#define FILE_PRINTED 0x0004
typedef enum tristate {
no, mod, yes
} tristate;
enum expr_type {
E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE
};
union expr_data {
struct expr *expr;
struct symbol *sym;
};
struct expr {
enum expr_type type;
union expr_data left, right;
};
#define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
#define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define E_NOT(dep) (2-(dep))
struct expr_value {
struct expr *expr;
tristate tri;
};
struct symbol_value {
void *val;
tristate tri;
};
enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
};
enum {
S_DEF_USER, /* main user value */
S_DEF_AUTO,
};
struct symbol {
struct symbol *next;
char *name;
char *help;
enum symbol_type type;
struct symbol_value curr;
struct symbol_value def[4];
tristate visible;
int flags;
struct property *prop;
struct expr *dep, *dep2;
struct expr_value rev_dep;
};
#define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
#define SYMBOL_CONST 0x0001
#define SYMBOL_CHECK 0x0008
#define SYMBOL_CHOICE 0x0010
#define SYMBOL_CHOICEVAL 0x0020
#define SYMBOL_PRINTED 0x0040
#define SYMBOL_VALID 0x0080
#define SYMBOL_OPTIONAL 0x0100
#define SYMBOL_WRITE 0x0200
#define SYMBOL_CHANGED 0x0400
#define SYMBOL_AUTO 0x1000
#define SYMBOL_CHECKED 0x2000
#define SYMBOL_WARNED 0x8000
#define SYMBOL_DEF 0x10000
#define SYMBOL_DEF_USER 0x10000
#define SYMBOL_DEF_AUTO 0x20000
#define SYMBOL_DEF3 0x40000
#define SYMBOL_DEF4 0x80000
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 257
#define SYMBOL_HASHMASK 0xff
enum prop_type {
P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE
};
struct property {
struct property *next;
struct symbol *sym;
enum prop_type type;
const char *text;
struct expr_value visible;
struct expr *expr;
struct menu *menu;
struct file *file;
int lineno;
};
#define for_all_properties(sym, st, tok) \
for (st = sym->prop; st; st = st->next) \
if (st->type == (tok))
#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
#define for_all_prompts(sym, st) \
for (st = sym->prop; st; st = st->next) \
if (st->text)
struct menu {
struct menu *next;
struct menu *parent;
struct menu *list;
struct symbol *sym;
struct property *prompt;
struct expr *dep;
unsigned int flags;
//char *help;
struct file *file;
int lineno;
void *data;
};
#define MENU_CHANGED 0x0001
#define MENU_ROOT 0x0002
#ifndef SWIG
extern struct file *file_list;
extern struct file *current_file;
struct file *lookup_file(const char *name);
extern struct symbol symbol_yes, symbol_no, symbol_mod;
extern struct symbol *modules_sym;
extern struct symbol *sym_defconfig_list;
extern int cdebug;
struct expr *expr_alloc_symbol(struct symbol *sym);
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2);
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(struct expr *org);
void expr_free(struct expr *e);
int expr_eq(struct expr *e1, struct expr *e2);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
tristate expr_calc_value(struct expr *e);
struct expr *expr_eliminate_yn(struct expr *e);
struct expr *expr_trans_bool(struct expr *e);
struct expr *expr_eliminate_dups(struct expr *e);
struct expr *expr_transform(struct expr *e);
int expr_contains_symbol(struct expr *dep, struct symbol *sym);
bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
void expr_fprint(struct expr *e, FILE *out);
struct gstr; /* forward */
void expr_gstr_print(struct expr *e, struct gstr *gs);
static inline int expr_is_yes(struct expr *e)
{
return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
}
static inline int expr_is_no(struct expr *e)
{
return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* EXPR_H */

2350
kconfig/lex.zconf.c_shipped Normal file

File diff suppressed because it is too large Load Diff

157
kconfig/lkc.h Normal file
View File

@ -0,0 +1,157 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#ifndef LKC_H
#define LKC_H
#define PROJECT_NAME "crosstool-NG"
// Make some warnings go away
#define YYENABLE_NLS 0
#define YYLTYPE_IS_TRIVIAL 0
#include "expr.h"
#ifndef KBUILD_NO_NLS
# include <libintl.h>
#else
# define gettext(Msgid) ((const char *) (Msgid))
# define textdomain(Domainname) ((const char *) (Domainname))
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LKC_DIRECT_LINK
#define P(name,type,arg) extern type name arg
#else
#include "lkc_defs.h"
#define P(name,type,arg) extern type (*name ## _p) arg
#endif
#include "lkc_proto.h"
#undef P
#define SRCTREE "srctree"
#define PACKAGE "crosstool-NG"
#define LOCALEDIR "/usr/share/locale"
#define _(text) gettext(text)
#define N_(text) (text)
#define TF_COMMAND 0x0001
#define TF_PARAM 0x0002
#define TF_OPTION 0x0004
#define T_OPT_MODULES 1
#define T_OPT_DEFCONFIG_LIST 2
struct kconf_id {
int name;
int token;
unsigned int flags;
enum symbol_type stype;
};
int zconfparse(void);
void zconfdump(FILE *out);
extern int zconfdebug;
void zconf_starthelp(void);
FILE *zconf_fopen(const char *name);
void zconf_initscan(const char *name);
void zconf_nextfile(const char *name);
int zconf_lineno(void);
char *zconf_curname(void);
/* confdata.c */
char *conf_get_default_confname(void);
/* kconfig_load.c */
void kconfig_load(void);
/* menu.c */
void menu_init(void);
struct menu *menu_add_menu(void);
void menu_end_menu(void);
void menu_add_entry(struct symbol *sym);
void menu_end_entry(void);
void menu_add_dep(struct expr *dep);
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
void menu_add_option(int token, char *arg);
void menu_finalize(struct menu *parent);
void menu_set_type(int type);
/* util.c */
struct file *file_lookup(const char *name);
int file_write_dep(const char *name);
struct gstr {
size_t len;
char *s;
};
struct gstr str_new(void);
struct gstr str_assign(const char *s);
void str_free(struct gstr *gs);
void str_append(struct gstr *gs, const char *s);
void str_printf(struct gstr *gs, const char *fmt, ...);
const char *str_get(struct gstr *gs);
/* symbol.c */
void sym_init(void);
void sym_clear_all_valid(void);
void sym_set_all_changed(void);
void sym_set_changed(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
struct symbol *prop_get_symbol(struct property *prop);
static inline tristate sym_get_tristate_value(struct symbol *sym)
{
return sym->curr.tri;
}
static inline struct symbol *sym_get_choice_value(struct symbol *sym)
{
return (struct symbol *)sym->curr.val;
}
static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval)
{
return sym_set_tristate_value(chval, yes);
}
static inline bool sym_is_choice(struct symbol *sym)
{
return sym->flags & SYMBOL_CHOICE ? true : false;
}
static inline bool sym_is_choice_value(struct symbol *sym)
{
return sym->flags & SYMBOL_CHOICEVAL ? true : false;
}
static inline bool sym_is_optional(struct symbol *sym)
{
return sym->flags & SYMBOL_OPTIONAL ? true : false;
}
static inline bool sym_has_value(struct symbol *sym)
{
return sym->flags & SYMBOL_DEF_USER ? true : false;
}
#ifdef __cplusplus
}
#endif
#endif /* LKC_H */

42
kconfig/lkc_proto.h Normal file
View File

@ -0,0 +1,42 @@
/* confdata.c */
P(conf_parse,void,(const char *name));
P(conf_read,int,(const char *name));
P(conf_read_simple,int,(const char *name, int));
P(conf_write,int,(const char *name));
P(conf_write_autoconf,int,(void));
/* menu.c */
P(rootmenu,struct menu,);
P(menu_is_visible,bool,(struct menu *menu));
P(menu_get_prompt,const char *,(struct menu *menu));
P(menu_get_root_menu,struct menu *,(struct menu *menu));
P(menu_get_parent_menu,struct menu *,(struct menu *menu));
/* symbol.c */
P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
P(sym_change_count,int,);
P(sym_lookup,struct symbol *,(const char *name, int isconst));
P(sym_find,struct symbol *,(const char *name));
P(sym_re_search,struct symbol **,(const char *pattern));
P(sym_type_name,const char *,(enum symbol_type type));
P(sym_calc_value,void,(struct symbol *sym));
P(sym_get_type,enum symbol_type,(struct symbol *sym));
P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri));
P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri));
P(sym_toggle_tristate_value,tristate,(struct symbol *sym));
P(sym_string_valid,bool,(struct symbol *sym, const char *newval));
P(sym_string_within_range,bool,(struct symbol *sym, const char *str));
P(sym_set_string_value,bool,(struct symbol *sym, const char *newval));
P(sym_is_changable,bool,(struct symbol *sym));
P(sym_get_choice_prop,struct property *,(struct symbol *sym));
P(sym_get_default_prop,struct property *,(struct symbol *sym));
P(sym_get_string_value,const char *,(struct symbol *sym));
P(prop_get_type_name,const char *,(enum prop_type type));
/* expr.c */
P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2));
P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken));

View File

@ -0,0 +1,4 @@
This is NOT the official version of dialog. This version has been
significantly modified from the original. It is for use by the Linux
kernel configuration script. Please do not bother Savio Lam with
questions about this program.

View File

@ -0,0 +1,84 @@
#!/bin/sh
# Check ncurses compatibility
# What library to link
ldflags()
{
$cc -print-file-name=libncursesw.so | grep -q /
if [ $? -eq 0 ]; then
echo '-lncursesw'
exit
fi
$cc -print-file-name=libncurses.so | grep -q /
if [ $? -eq 0 ]; then
echo '-lncurses'
exit
fi
$cc -print-file-name=libcurses.so | grep -q /
if [ $? -eq 0 ]; then
echo '-lcurses'
exit
fi
exit 1
}
# Where is ncurses.h?
ccflags()
{
if [ -f /usr/include/ncurses/ncurses.h ]; then
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
elif [ -f /usr/include/ncurses/curses.h ]; then
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
elif [ -f /usr/include/ncurses.h ]; then
echo '-DCURSES_LOC="<ncurses.h>"'
else
echo '-DCURSES_LOC="<curses.h>"'
fi
}
# Temp file, try to clean up after us
tmp=.lxdialog.tmp
trap "rm -f $tmp" 0 1 2 3 15
# Check if we can link to ncurses
check() {
echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
if [ $? != 0 ]; then
echo " *** Unable to find the ncurses libraries." 1>&2
echo " *** make menuconfig require the ncurses libraries" 1>&2
echo " *** " 1>&2
echo " *** Install ncurses (ncurses-devel) and try again" 1>&2
echo " *** " 1>&2
exit 1
fi
}
usage() {
printf "Usage: $0 [-check compiler options|-header|-library]\n"
}
if [ $# == 0 ]; then
usage
exit 1
fi
cc=""
case "$1" in
"-check")
shift
cc="$@"
check
;;
"-ccflags")
ccflags
;;
"-ldflags")
shift
cc="$@"
ldflags
;;
"*")
usage
exit 1
;;
esac

View File

@ -0,0 +1,325 @@
/*
* checklist.c -- implements the checklist box
*
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension
* Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "dialog.h"
static int list_width, check_x, item_x;
/*
* Print list item
*/
static void print_item(WINDOW * win, int choice, int selected)
{
int i;
/* Clear 'residue' of last item */
wattrset(win, dlg.menubox.atr);
wmove(win, choice, 0);
for (i = 0; i < list_width; i++)
waddch(win, ' ');
wmove(win, choice, check_x);
wattrset(win, selected ? dlg.check_selected.atr
: dlg.check.atr);
wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr);
mvwaddch(win, choice, item_x, item_str()[0]);
wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
waddstr(win, (char *)item_str() + 1);
if (selected) {
wmove(win, choice, check_x + 1);
wrefresh(win);
}
}
/*
* Print the scroll indicators.
*/
static void print_arrows(WINDOW * win, int choice, int item_no, int scroll,
int y, int x, int height)
{
wmove(win, y, x);
if (scroll > 0) {
wattrset(win, dlg.uarrow.atr);
waddch(win, ACS_UARROW);
waddstr(win, "(-)");
} else {
wattrset(win, dlg.menubox.atr);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
}
y = y + height + 1;
wmove(win, y, x);
if ((height < item_no) && (scroll + choice < item_no - 1)) {
wattrset(win, dlg.darrow.atr);
waddch(win, ACS_DARROW);
waddstr(win, "(+)");
} else {
wattrset(win, dlg.menubox_border.atr);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
}
}
/*
* Display the termination buttons
*/
static void print_buttons(WINDOW * dialog, int height, int width, int selected)
{
int x = width / 2 - 11;
int y = height - 2;
print_button(dialog, "Select", y, x, selected == 0);
print_button(dialog, " Help ", y, x + 14, selected == 1);
wmove(dialog, y, x + 1 + 14 * selected);
wrefresh(dialog);
}
/*
* Display a dialog box with a list of options that can be turned on or off
* in the style of radiolist (only one option turned on at a time).
*/
int dialog_checklist(const char *title, const char *prompt, int height,
int width, int list_height)
{
int i, x, y, box_x, box_y;
int key = 0, button = 0, choice = 0, scroll = 0, max_choice;
WINDOW *dialog, *list;
/* which item to highlight */
item_foreach() {
if (item_is_tag('X'))
choice = item_n();
if (item_is_selected()) {
choice = item_n();
break;
}
}
do_resize:
if (getmaxy(stdscr) < (height + 6))
return -ERRDISPLAYTOOSMALL;
if (getmaxx(stdscr) < (width + 6))
return -ERRDISPLAYTOOSMALL;
max_choice = MIN(list_height, item_count());
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
draw_shadow(stdscr, y, x, height, width);
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);
draw_box(dialog, 0, 0, height, width,
dlg.dialog.atr, dlg.border.atr);
wattrset(dialog, dlg.border.atr);
mvwaddch(dialog, height - 3, 0, ACS_LTEE);
for (i = 0; i < width - 2; i++)
waddch(dialog, ACS_HLINE);
wattrset(dialog, dlg.dialog.atr);
waddch(dialog, ACS_RTEE);
print_title(dialog, title, width);
wattrset(dialog, dlg.dialog.atr);
print_autowrap(dialog, prompt, width - 2, 1, 3);
list_width = width - 6;
box_y = height - list_height - 5;
box_x = (width - list_width) / 2 - 1;
/* create new window for the list */
list = subwin(dialog, list_height, list_width, y + box_y + 1,
x + box_x + 1);
keypad(list, TRUE);
/* draw a box around the list items */
draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2,
dlg.menubox_border.atr, dlg.menubox.atr);
/* Find length of longest item in order to center checklist */
check_x = 0;
item_foreach()
check_x = MAX(check_x, strlen(item_str()) + 4);
check_x = (list_width - check_x) / 2;
item_x = check_x + 4;
if (choice >= list_height) {
scroll = choice - list_height + 1;
choice -= scroll;
}
/* Print the list */
for (i = 0; i < max_choice; i++) {
item_set(scroll + i);
print_item(list, i, i == choice);
}
print_arrows(dialog, choice, item_count(), scroll,
box_y, box_x + check_x + 5, list_height);
print_buttons(dialog, height, width, 0);
wnoutrefresh(dialog);
wnoutrefresh(list);
doupdate();
while (key != KEY_ESC) {
key = wgetch(dialog);
for (i = 0; i < max_choice; i++) {
item_set(i + scroll);
if (toupper(key) == toupper(item_str()[0]))
break;
}
if (i < max_choice || key == KEY_UP || key == KEY_DOWN ||
key == '+' || key == '-') {
if (key == KEY_UP || key == '-') {
if (!choice) {
if (!scroll)
continue;
/* Scroll list down */
if (list_height > 1) {
/* De-highlight current first item */
item_set(scroll);
print_item(list, 0, FALSE);
scrollok(list, TRUE);
wscrl(list, -1);
scrollok(list, FALSE);
}
scroll--;
item_set(scroll);
print_item(list, 0, TRUE);
print_arrows(dialog, choice, item_count(),
scroll, box_y, box_x + check_x + 5, list_height);
wnoutrefresh(dialog);
wrefresh(list);
continue; /* wait for another key press */
} else
i = choice - 1;
} else if (key == KEY_DOWN || key == '+') {
if (choice == max_choice - 1) {
if (scroll + choice >= item_count() - 1)
continue;
/* Scroll list up */
if (list_height > 1) {
/* De-highlight current last item before scrolling up */
item_set(scroll + max_choice - 1);
print_item(list,
max_choice - 1,
FALSE);
scrollok(list, TRUE);
wscrl(list, 1);
scrollok(list, FALSE);
}
scroll++;
item_set(scroll + max_choice - 1);
print_item(list, max_choice - 1, TRUE);
print_arrows(dialog, choice, item_count(),
scroll, box_y, box_x + check_x + 5, list_height);
wnoutrefresh(dialog);
wrefresh(list);
continue; /* wait for another key press */
} else
i = choice + 1;
}
if (i != choice) {
/* De-highlight current item */
item_set(scroll + choice);
print_item(list, choice, FALSE);
/* Highlight new item */
choice = i;
item_set(scroll + choice);
print_item(list, choice, TRUE);
wnoutrefresh(dialog);
wrefresh(list);
}
continue; /* wait for another key press */
}
switch (key) {
case 'H':
case 'h':
case '?':
button = 1;
/* fall-through */
case 'S':
case 's':
case ' ':
case '\n':
item_foreach()
item_set_selected(0);
item_set(scroll + choice);
item_set_selected(1);
delwin(list);
delwin(dialog);
return button;
case TAB:
case KEY_LEFT:
case KEY_RIGHT:
button = ((key == KEY_LEFT ? --button : ++button) < 0)
? 1 : (button > 1 ? 0 : button);
print_buttons(dialog, height, width, button);
wrefresh(dialog);
break;
case 'X':
case 'x':
key = KEY_ESC;
break;
case KEY_ESC:
key = on_key_esc(dialog);
break;
case KEY_RESIZE:
delwin(list);
delwin(dialog);
on_key_resize();
goto do_resize;
}
/* Now, update everything... */
doupdate();
}
delwin(list);
delwin(dialog);
return key; /* ESC pressed */
}

224
kconfig/lxdialog/dialog.h Normal file
View File

@ -0,0 +1,224 @@
/*
* dialog.h -- common declarations for all dialog modules
*
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#ifdef __sun__
#define CURS_MACROS
#endif
#include CURSES_LOC
/*
* Colors in ncurses 1.9.9e do not work properly since foreground and
* background colors are OR'd rather than separately masked. This version
* of dialog was hacked to work with ncurses 1.9.9e, making it incompatible
* with standard curses. The simplest fix (to make this work with standard
* curses) uses the wbkgdset() function, not used in the original hack.
* Turn it off if we're building with 1.9.9e, since it just confuses things.
*/
#if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE)
#define OLD_NCURSES 1
#undef wbkgdset
#define wbkgdset(w,p) /*nothing */
#else
#define OLD_NCURSES 0
#endif
#define TR(params) _tracef params
#define KEY_ESC 27
#define TAB 9
#define MAX_LEN 2048
#define BUF_SIZE (10*1024)
#define MIN(x,y) (x < y ? x : y)
#define MAX(x,y) (x > y ? x : y)
#ifndef ACS_ULCORNER
#define ACS_ULCORNER '+'
#endif
#ifndef ACS_LLCORNER
#define ACS_LLCORNER '+'
#endif
#ifndef ACS_URCORNER
#define ACS_URCORNER '+'
#endif
#ifndef ACS_LRCORNER
#define ACS_LRCORNER '+'
#endif
#ifndef ACS_HLINE
#define ACS_HLINE '-'
#endif
#ifndef ACS_VLINE
#define ACS_VLINE '|'
#endif
#ifndef ACS_LTEE
#define ACS_LTEE '+'
#endif
#ifndef ACS_RTEE
#define ACS_RTEE '+'
#endif
#ifndef ACS_UARROW
#define ACS_UARROW '^'
#endif
#ifndef ACS_DARROW
#define ACS_DARROW 'v'
#endif
/* error return codes */
#define ERRDISPLAYTOOSMALL (KEY_MAX + 1)
/*
* Color definitions
*/
struct dialog_color {
chtype atr; /* Color attribute */
int fg; /* foreground */
int bg; /* background */
int hl; /* highlight this item */
};
struct dialog_info {
const char *backtitle;
struct dialog_color screen;
struct dialog_color shadow;
struct dialog_color dialog;
struct dialog_color title;
struct dialog_color border;
struct dialog_color button_active;
struct dialog_color button_inactive;
struct dialog_color button_key_active;
struct dialog_color button_key_inactive;
struct dialog_color button_label_active;
struct dialog_color button_label_inactive;
struct dialog_color inputbox;
struct dialog_color inputbox_border;
struct dialog_color searchbox;
struct dialog_color searchbox_title;
struct dialog_color searchbox_border;
struct dialog_color position_indicator;
struct dialog_color menubox;
struct dialog_color menubox_border;
struct dialog_color item;
struct dialog_color item_selected;
struct dialog_color tag;
struct dialog_color tag_selected;
struct dialog_color tag_key;
struct dialog_color tag_key_selected;
struct dialog_color check;
struct dialog_color check_selected;
struct dialog_color uarrow;
struct dialog_color darrow;
};
/*
* Global variables
*/
extern struct dialog_info dlg;
extern char dialog_input_result[];
/*
* Function prototypes
*/
/* item list as used by checklist and menubox */
void item_reset(void);
void item_make(const char *fmt, ...);
void item_add_str(const char *fmt, ...);
void item_set_tag(char tag);
void item_set_data(void *p);
void item_set_selected(int val);
int item_activate_selected(void);
void *item_data(void);
char item_tag(void);
/* item list manipulation for lxdialog use */
#define MAXITEMSTR 200
struct dialog_item {
char str[MAXITEMSTR]; /* promtp displayed */
char tag;
void *data; /* pointer to menu item - used by menubox+checklist */
int selected; /* Set to 1 by dialog_*() function if selected. */
};
/* list of lialog_items */
struct dialog_list {
struct dialog_item node;
struct dialog_list *next;
};
extern struct dialog_list *item_cur;
extern struct dialog_list item_nil;
extern struct dialog_list *item_head;
int item_count(void);
void item_set(int n);
int item_n(void);
const char *item_str(void);
int item_is_selected(void);
int item_is_tag(char tag);
#define item_foreach() \
for (item_cur = item_head ? item_head: item_cur; \
item_cur && (item_cur != &item_nil); item_cur = item_cur->next)
/* generic key handlers */
int on_key_esc(WINDOW *win);
int on_key_resize(void);
void init_dialog(const char *backtitle);
void reset_dialog(void);
void end_dialog(void);
void attr_clear(WINDOW * win, int height, int width, chtype attr);
void dialog_clear(void);
void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);
void print_button(WINDOW * win, const char *label, int y, int x, int selected);
void print_title(WINDOW *dialog, const char *title, int width);
void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box,
chtype border);
void draw_shadow(WINDOW * win, int y, int x, int height, int width);
int first_alpha(const char *string, const char *exempt);
int dialog_yesno(const char *title, const char *prompt, int height, int width);
int dialog_msgbox(const char *title, const char *prompt, int height,
int width, int pause);
int dialog_textbox(const char *title, const char *file, int height, int width);
int dialog_menu(const char *title, const char *prompt,
const void *selected, int *s_scroll);
int dialog_checklist(const char *title, const char *prompt, int height,
int width, int list_height);
extern char dialog_input_result[];
int dialog_inputbox(const char *title, const char *prompt, int height,
int width, const char *init);
/*
* This is the base for fictitious keys, which activate
* the buttons.
*
* Mouse-generated keys are the following:
* -- the first 32 are used as numbers, in addition to '0'-'9'
* -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o')
* -- uppercase chars are used to invoke the button (M_EVENT + 'O')
*/
#define M_EVENT (KEY_MAX+1)

238
kconfig/lxdialog/inputbox.c Normal file
View File

@ -0,0 +1,238 @@
/*
* inputbox.c -- implements the input box
*
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "dialog.h"
char dialog_input_result[MAX_LEN + 1];
/*
* Print the termination buttons
*/
static void print_buttons(WINDOW * dialog, int height, int width, int selected)
{
int x = width / 2 - 11;
int y = height - 2;
print_button(dialog, " Ok ", y, x, selected == 0);
print_button(dialog, " Help ", y, x + 14, selected == 1);
wmove(dialog, y, x + 1 + 14 * selected);
wrefresh(dialog);
}
/*
* Display a dialog box for inputing a string
*/
int dialog_inputbox(const char *title, const char *prompt, int height, int width,
const char *init)
{
int i, x, y, box_y, box_x, box_width;
int input_x = 0, scroll = 0, key = 0, button = -1;
char *instr = dialog_input_result;
WINDOW *dialog;
if (!init)
instr[0] = '\0';
else
strcpy(instr, init);
do_resize:
if (getmaxy(stdscr) <= (height - 2))
return -ERRDISPLAYTOOSMALL;
if (getmaxx(stdscr) <= (width - 2))
return -ERRDISPLAYTOOSMALL;
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
draw_shadow(stdscr, y, x, height, width);
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);
draw_box(dialog, 0, 0, height, width,
dlg.dialog.atr, dlg.border.atr);
wattrset(dialog, dlg.border.atr);
mvwaddch(dialog, height - 3, 0, ACS_LTEE);
for (i = 0; i < width - 2; i++)
waddch(dialog, ACS_HLINE);
wattrset(dialog, dlg.dialog.atr);
waddch(dialog, ACS_RTEE);
print_title(dialog, title, width);
wattrset(dialog, dlg.dialog.atr);
print_autowrap(dialog, prompt, width - 2, 1, 3);
/* Draw the input field box */
box_width = width - 6;
getyx(dialog, y, x);
box_y = y + 2;
box_x = (width - box_width) / 2;
draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2,
dlg.border.atr, dlg.dialog.atr);
print_buttons(dialog, height, width, 0);
/* Set up the initial value */
wmove(dialog, box_y, box_x);
wattrset(dialog, dlg.inputbox.atr);
input_x = strlen(instr);
if (input_x >= box_width) {
scroll = input_x - box_width + 1;
input_x = box_width - 1;
for (i = 0; i < box_width - 1; i++)
waddch(dialog, instr[scroll + i]);
} else {
waddstr(dialog, instr);
}
wmove(dialog, box_y, box_x + input_x);
wrefresh(dialog);
while (key != KEY_ESC) {
key = wgetch(dialog);
if (button == -1) { /* Input box selected */
switch (key) {
case TAB:
case KEY_UP:
case KEY_DOWN:
break;
case KEY_LEFT:
continue;
case KEY_RIGHT:
continue;
case KEY_BACKSPACE:
case 127:
if (input_x || scroll) {
wattrset(dialog, dlg.inputbox.atr);
if (!input_x) {
scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1);
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++)
waddch(dialog,
instr[scroll + input_x + i] ?
instr[scroll + input_x + i] : ' ');
input_x = strlen(instr) - scroll;
} else
input_x--;
instr[scroll + input_x] = '\0';
mvwaddch(dialog, box_y, input_x + box_x, ' ');
wmove(dialog, box_y, input_x + box_x);
wrefresh(dialog);
}
continue;
default:
if (key < 0x100 && isprint(key)) {
if (scroll + input_x < MAX_LEN) {
wattrset(dialog, dlg.inputbox.atr);
instr[scroll + input_x] = key;
instr[scroll + input_x + 1] = '\0';
if (input_x == box_width - 1) {
scroll++;
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width - 1; i++)
waddch(dialog, instr [scroll + i]);
} else {
wmove(dialog, box_y, input_x++ + box_x);
waddch(dialog, key);
}
wrefresh(dialog);
} else
flash(); /* Alarm user about overflow */
continue;
}
}
}
switch (key) {
case 'O':
case 'o':
delwin(dialog);
return 0;
case 'H':
case 'h':
delwin(dialog);
return 1;
case KEY_UP:
case KEY_LEFT:
switch (button) {
case -1:
button = 1; /* Indicates "Cancel" button is selected */
print_buttons(dialog, height, width, 1);
break;
case 0:
button = -1; /* Indicates input box is selected */
print_buttons(dialog, height, width, 0);
wmove(dialog, box_y, box_x + input_x);
wrefresh(dialog);
break;
case 1:
button = 0; /* Indicates "OK" button is selected */
print_buttons(dialog, height, width, 0);
break;
}
break;
case TAB:
case KEY_DOWN:
case KEY_RIGHT:
switch (button) {
case -1:
button = 0; /* Indicates "OK" button is selected */
print_buttons(dialog, height, width, 0);
break;
case 0:
button = 1; /* Indicates "Cancel" button is selected */
print_buttons(dialog, height, width, 1);
break;
case 1:
button = -1; /* Indicates input box is selected */
print_buttons(dialog, height, width, 0);
wmove(dialog, box_y, box_x + input_x);
wrefresh(dialog);
break;
}
break;
case ' ':
case '\n':
delwin(dialog);
return (button == -1 ? 0 : button);
case 'X':
case 'x':
key = KEY_ESC;
break;
case KEY_ESC:
key = on_key_esc(dialog);
break;
case KEY_RESIZE:
delwin(dialog);
on_key_resize();
goto do_resize;
}
}
delwin(dialog);
return KEY_ESC; /* ESC pressed */
}

434
kconfig/lxdialog/menubox.c Normal file
View File

@ -0,0 +1,434 @@
/*
* menubox.c -- implements the menu box
*
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Changes by Clifford Wolf (god@clifford.at)
*
* [ 1998-06-13 ]
*
* *) A bugfix for the Page-Down problem
*
* *) Formerly when I used Page Down and Page Up, the cursor would be set
* to the first position in the menu box. Now lxdialog is a bit
* smarter and works more like other menu systems (just have a look at
* it).
*
* *) Formerly if I selected something my scrolling would be broken because
* lxdialog is re-invoked by the Menuconfig shell script, can't
* remember the last scrolling position, and just sets it so that the
* cursor is at the bottom of the box. Now it writes the temporary file
* lxdialog.scrltmp which contains this information. The file is
* deleted by lxdialog if the user leaves a submenu or enters a new
* one, but it would be nice if Menuconfig could make another "rm -f"
* just to be sure. Just try it out - you will recognise a difference!
*
* [ 1998-06-14 ]
*
* *) Now lxdialog is crash-safe against broken "lxdialog.scrltmp" files
* and menus change their size on the fly.
*
* *) If for some reason the last scrolling position is not saved by
* lxdialog, it sets the scrolling so that the selected item is in the
* middle of the menu box, not at the bottom.
*
* 02 January 1999, Michael Elizabeth Chastain (mec@shout.net)
* Reset 'scroll' to 0 if the value from lxdialog.scrltmp is bogus.
* This fixes a bug in Menuconfig where using ' ' to descend into menus
* would leave mis-synchronized lxdialog.scrltmp files lying around,
* fscanf would read in 'scroll', and eventually that value would get used.
*/
#include "dialog.h"
static int menu_width, item_x;
/*
* Print menu item
*/
static void do_print_item(WINDOW * win, const char *item, int line_y,
int selected, int hotkey)
{
int j;
char *menu_item = malloc(menu_width + 1);
strncpy(menu_item, item, menu_width - item_x);
menu_item[menu_width - item_x] = '\0';
j = first_alpha(menu_item, "YyNnMmHh");
/* Clear 'residue' of last item */
wattrset(win, dlg.menubox.atr);
wmove(win, line_y, 0);
#if OLD_NCURSES
{
int i;
for (i = 0; i < menu_width; i++)
waddch(win, ' ');
}
#else
wclrtoeol(win);
#endif
wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
mvwaddstr(win, line_y, item_x, menu_item);
if (hotkey) {
wattrset(win, selected ? dlg.tag_key_selected.atr
: dlg.tag_key.atr);
mvwaddch(win, line_y, item_x + j, menu_item[j]);
}
if (selected) {
wmove(win, line_y, item_x + 1);
}
free(menu_item);
wrefresh(win);
}
#define print_item(index, choice, selected) \
do { \
item_set(index); \
do_print_item(menu, item_str(), choice, selected, !item_is_tag(':')); \
} while (0)
/*
* Print the scroll indicators.
*/
static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
int height)
{
int cur_y, cur_x;
getyx(win, cur_y, cur_x);
wmove(win, y, x);
if (scroll > 0) {
wattrset(win, dlg.uarrow.atr);
waddch(win, ACS_UARROW);
waddstr(win, "(-)");
} else {
wattrset(win, dlg.menubox.atr);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
}
y = y + height + 1;
wmove(win, y, x);
wrefresh(win);
if ((height < item_no) && (scroll + height < item_no)) {
wattrset(win, dlg.darrow.atr);
waddch(win, ACS_DARROW);
waddstr(win, "(+)");
} else {
wattrset(win, dlg.menubox_border.atr);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
}
wmove(win, cur_y, cur_x);
wrefresh(win);
}
/*
* Display the termination buttons.
*/
static void print_buttons(WINDOW * win, int height, int width, int selected)
{
int x = width / 2 - 16;
int y = height - 2;
print_button(win, "Select", y, x, selected == 0);
print_button(win, " Exit ", y, x + 12, selected == 1);
print_button(win, " Help ", y, x + 24, selected == 2);
wmove(win, y, x + 1 + 12 * selected);
wrefresh(win);
}
/* scroll up n lines (n may be negative) */
static void do_scroll(WINDOW *win, int *scroll, int n)
{
/* Scroll menu up */
scrollok(win, TRUE);
wscrl(win, n);
scrollok(win, FALSE);
*scroll = *scroll + n;
wrefresh(win);
}
/*
* Display a menu for choosing among a number of options
*/
int dialog_menu(const char *title, const char *prompt,
const void *selected, int *s_scroll)
{
int i, j, x, y, box_x, box_y;
int height, width, menu_height;
int key = 0, button = 0, scroll = 0, choice = 0;
int first_item = 0, max_choice;
WINDOW *dialog, *menu;
do_resize:
height = getmaxy(stdscr);
width = getmaxx(stdscr);
if (height < 15 || width < 65)
return -ERRDISPLAYTOOSMALL;
height -= 4;
width -= 5;
menu_height = height - 10;
max_choice = MIN(menu_height, item_count());
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
draw_shadow(stdscr, y, x, height, width);
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);
draw_box(dialog, 0, 0, height, width,
dlg.dialog.atr, dlg.border.atr);
wattrset(dialog, dlg.border.atr);
mvwaddch(dialog, height - 3, 0, ACS_LTEE);
for (i = 0; i < width - 2; i++)
waddch(dialog, ACS_HLINE);
wattrset(dialog, dlg.dialog.atr);
wbkgdset(dialog, dlg.dialog.atr & A_COLOR);
waddch(dialog, ACS_RTEE);
print_title(dialog, title, width);
wattrset(dialog, dlg.dialog.atr);
print_autowrap(dialog, prompt, width - 2, 1, 3);
menu_width = width - 6;
box_y = height - menu_height - 5;
box_x = (width - menu_width) / 2 - 1;
/* create new window for the menu */
menu = subwin(dialog, menu_height, menu_width,
y + box_y + 1, x + box_x + 1);
keypad(menu, TRUE);
/* draw a box around the menu items */
draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
dlg.menubox_border.atr, dlg.menubox.atr);
if (menu_width >= 80)
item_x = (menu_width - 70) / 2;
else
item_x = 4;
/* Set choice to default item */
item_foreach()
if (selected && (selected == item_data()))
choice = item_n();
/* get the saved scroll info */
scroll = *s_scroll;
if ((scroll <= choice) && (scroll + max_choice > choice) &&
(scroll >= 0) && (scroll + max_choice <= item_count())) {
first_item = scroll;
choice = choice - scroll;
} else {
scroll = 0;
}
if ((choice >= max_choice)) {
if (choice >= item_count() - max_choice / 2)
scroll = first_item = item_count() - max_choice;
else
scroll = first_item = choice - max_choice / 2;
choice = choice - scroll;
}
/* Print the menu */
for (i = 0; i < max_choice; i++) {
print_item(first_item + i, i, i == choice);
}
wnoutrefresh(menu);
print_arrows(dialog, item_count(), scroll,
box_y, box_x + item_x + 1, menu_height);
print_buttons(dialog, height, width, 0);
wmove(menu, choice, item_x + 1);
wrefresh(menu);
while (key != KEY_ESC) {
key = wgetch(menu);
if (key < 256 && isalpha(key))
key = tolower(key);
if (strchr("ynmh", key))
i = max_choice;
else {
for (i = choice + 1; i < max_choice; i++) {
item_set(scroll + i);
j = first_alpha(item_str(), "YyNnMmHh");
if (key == tolower(item_str()[j]))
break;
}
if (i == max_choice)
for (i = 0; i < max_choice; i++) {
item_set(scroll + i);
j = first_alpha(item_str(), "YyNnMmHh");
if (key == tolower(item_str()[j]))
break;
}
}
if (i < max_choice ||
key == KEY_UP || key == KEY_DOWN ||
key == '-' || key == '+' ||
key == KEY_PPAGE || key == KEY_NPAGE) {
/* Remove highligt of current item */
print_item(scroll + choice, choice, FALSE);
if (key == KEY_UP || key == '-') {
if (choice < 2 && scroll) {
/* Scroll menu down */
do_scroll(menu, &scroll, -1);
print_item(scroll, 0, FALSE);
} else
choice = MAX(choice - 1, 0);
} else if (key == KEY_DOWN || key == '+') {
print_item(scroll+choice, choice, FALSE);
if ((choice > max_choice - 3) &&
(scroll + max_choice < item_count())) {
/* Scroll menu up */
do_scroll(menu, &scroll, 1);
print_item(scroll+max_choice - 1,
max_choice - 1, FALSE);
} else
choice = MIN(choice + 1, max_choice - 1);
} else if (key == KEY_PPAGE) {
scrollok(menu, TRUE);
for (i = 0; (i < max_choice); i++) {
if (scroll > 0) {
do_scroll(menu, &scroll, -1);
print_item(scroll, 0, FALSE);
} else {
if (choice > 0)
choice--;
}
}
} else if (key == KEY_NPAGE) {
for (i = 0; (i < max_choice); i++) {
if (scroll + max_choice < item_count()) {
do_scroll(menu, &scroll, 1);
print_item(scroll+max_choice-1,
max_choice - 1, FALSE);
} else {
if (choice + 1 < max_choice)
choice++;
}
}
} else
choice = i;
print_item(scroll + choice, choice, TRUE);
print_arrows(dialog, item_count(), scroll,
box_y, box_x + item_x + 1, menu_height);
wnoutrefresh(dialog);
wrefresh(menu);
continue; /* wait for another key press */
}
switch (key) {
case KEY_LEFT:
case TAB:
case KEY_RIGHT:
button = ((key == KEY_LEFT ? --button : ++button) < 0)
? 2 : (button > 2 ? 0 : button);
print_buttons(dialog, height, width, button);
wrefresh(menu);
break;
case ' ':
case 's':
case 'y':
case 'n':
case 'm':
case '/':
/* save scroll info */
*s_scroll = scroll;
delwin(menu);
delwin(dialog);
item_set(scroll + choice);
item_set_selected(1);
switch (key) {
case 's':
return 3;
case 'y':
return 3;
case 'n':
return 4;
case 'm':
return 5;
case ' ':
return 6;
case '/':
return 7;
}
return 0;
case 'h':
case '?':
button = 2;
case '\n':
*s_scroll = scroll;
delwin(menu);
delwin(dialog);
item_set(scroll + choice);
item_set_selected(1);
return button;
case 'e':
case 'x':
key = KEY_ESC;
break;
case KEY_ESC:
key = on_key_esc(menu);
break;
case KEY_RESIZE:
on_key_resize();
delwin(menu);
delwin(dialog);
goto do_resize;
}
}
delwin(menu);
delwin(dialog);
return key; /* ESC pressed */
}

391
kconfig/lxdialog/textbox.c Normal file
View File

@ -0,0 +1,391 @@
/*
* textbox.c -- implements the text box
*
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "dialog.h"
static void back_lines(int n);
static void print_page(WINDOW * win, int height, int width);
static void print_line(WINDOW * win, int row, int width);
static char *get_line(void);
static void print_position(WINDOW * win);
static int hscroll;
static int begin_reached, end_reached, page_length;
static const char *buf;
static const char *page;
/*
* refresh window content
*/
static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw,
int cur_y, int cur_x)
{
print_page(box, boxh, boxw);
print_position(dialog);
wmove(dialog, cur_y, cur_x); /* Restore cursor position */
wrefresh(dialog);
}
/*
* Display text from a file in a dialog box.
*/
int dialog_textbox(const char *title, const char *tbuf,
int initial_height, int initial_width)
{
int i, x, y, cur_x, cur_y, key = 0;
int height, width, boxh, boxw;
int passed_end;
WINDOW *dialog, *box;
begin_reached = 1;
end_reached = 0;
page_length = 0;
hscroll = 0;
buf = tbuf;
page = buf; /* page is pointer to start of page to be displayed */
do_resize:
getmaxyx(stdscr, height, width);
if (height < 8 || width < 8)
return -ERRDISPLAYTOOSMALL;
if (initial_height != 0)
height = initial_height;
else
if (height > 4)
height -= 4;
else
height = 0;
if (initial_width != 0)
width = initial_width;
else
if (width > 5)
width -= 5;
else
width = 0;
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
draw_shadow(stdscr, y, x, height, width);
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);
/* Create window for box region, used for scrolling text */
boxh = height - 4;
boxw = width - 2;
box = subwin(dialog, boxh, boxw, y + 1, x + 1);
wattrset(box, dlg.dialog.atr);
wbkgdset(box, dlg.dialog.atr & A_COLOR);
keypad(box, TRUE);
/* register the new window, along with its borders */
draw_box(dialog, 0, 0, height, width,
dlg.dialog.atr, dlg.border.atr);
wattrset(dialog, dlg.border.atr);
mvwaddch(dialog, height - 3, 0, ACS_LTEE);
for (i = 0; i < width - 2; i++)
waddch(dialog, ACS_HLINE);
wattrset(dialog, dlg.dialog.atr);
wbkgdset(dialog, dlg.dialog.atr & A_COLOR);
waddch(dialog, ACS_RTEE);
print_title(dialog, title, width);
print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE);
wnoutrefresh(dialog);
getyx(dialog, cur_y, cur_x); /* Save cursor position */
/* Print first page of text */
attr_clear(box, boxh, boxw, dlg.dialog.atr);
refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x);
while ((key != KEY_ESC) && (key != '\n')) {
key = wgetch(dialog);
switch (key) {
case 'E': /* Exit */
case 'e':
case 'X':
case 'x':
delwin(box);
delwin(dialog);
return 0;
case 'g': /* First page */
case KEY_HOME:
if (!begin_reached) {
begin_reached = 1;
page = buf;
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
}
break;
case 'G': /* Last page */
case KEY_END:
end_reached = 1;
/* point to last char in buf */
page = buf + strlen(buf);
back_lines(boxh);
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
break;
case 'K': /* Previous line */
case 'k':
case KEY_UP:
if (!begin_reached) {
back_lines(page_length + 1);
/* We don't call print_page() here but use
* scrolling to ensure faster screen update.
* However, 'end_reached' and 'page_length'
* should still be updated, and 'page' should
* point to start of next page. This is done
* by calling get_line() in the following
* 'for' loop. */
scrollok(box, TRUE);
wscrl(box, -1); /* Scroll box region down one line */
scrollok(box, FALSE);
page_length = 0;
passed_end = 0;
for (i = 0; i < boxh; i++) {
if (!i) {
/* print first line of page */
print_line(box, 0, boxw);
wnoutrefresh(box);
} else
/* Called to update 'end_reached' and 'page' */
get_line();
if (!passed_end)
page_length++;
if (end_reached && !passed_end)
passed_end = 1;
}
print_position(dialog);
wmove(dialog, cur_y, cur_x); /* Restore cursor position */
wrefresh(dialog);
}
break;
case 'B': /* Previous page */
case 'b':
case KEY_PPAGE:
if (begin_reached)
break;
back_lines(page_length + boxh);
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
break;
case 'J': /* Next line */
case 'j':
case KEY_DOWN:
if (!end_reached) {
begin_reached = 0;
scrollok(box, TRUE);
scroll(box); /* Scroll box region up one line */
scrollok(box, FALSE);
print_line(box, boxh - 1, boxw);
wnoutrefresh(box);
print_position(dialog);
wmove(dialog, cur_y, cur_x); /* Restore cursor position */
wrefresh(dialog);
}
break;
case KEY_NPAGE: /* Next page */
case ' ':
if (end_reached)
break;
begin_reached = 0;
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
break;
case '0': /* Beginning of line */
case 'H': /* Scroll left */
case 'h':
case KEY_LEFT:
if (hscroll <= 0)
break;
if (key == '0')
hscroll = 0;
else
hscroll--;
/* Reprint current page to scroll horizontally */
back_lines(page_length);
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
break;
case 'L': /* Scroll right */
case 'l':
case KEY_RIGHT:
if (hscroll >= MAX_LEN)
break;
hscroll++;
/* Reprint current page to scroll horizontally */
back_lines(page_length);
refresh_text_box(dialog, box, boxh, boxw,
cur_y, cur_x);
break;
case KEY_ESC:
key = on_key_esc(dialog);
break;
case KEY_RESIZE:
back_lines(height);
delwin(box);
delwin(dialog);
on_key_resize();
goto do_resize;
}
}
delwin(box);
delwin(dialog);
return key; /* ESC pressed */
}
/*
* Go back 'n' lines in text. Called by dialog_textbox().
* 'page' will be updated to point to the desired line in 'buf'.
*/
static void back_lines(int n)
{
int i;
begin_reached = 0;
/* Go back 'n' lines */
for (i = 0; i < n; i++) {
if (*page == '\0') {
if (end_reached) {
end_reached = 0;
continue;
}
}
if (page == buf) {
begin_reached = 1;
return;
}
page--;
do {
if (page == buf) {
begin_reached = 1;
return;
}
page--;
} while (*page != '\n');
page++;
}
}
/*
* Print a new page of text. Called by dialog_textbox().
*/
static void print_page(WINDOW * win, int height, int width)
{
int i, passed_end = 0;
page_length = 0;
for (i = 0; i < height; i++) {
print_line(win, i, width);
if (!passed_end)
page_length++;
if (end_reached && !passed_end)
passed_end = 1;
}
wnoutrefresh(win);
}
/*
* Print a new line of text. Called by dialog_textbox() and print_page().
*/
static void print_line(WINDOW * win, int row, int width)
{
int y, x;
char *line;
line = get_line();
line += MIN(strlen(line), hscroll); /* Scroll horizontally */
wmove(win, row, 0); /* move cursor to correct line */
waddch(win, ' ');
waddnstr(win, line, MIN(strlen(line), width - 2));
getyx(win, y, x);
/* Clear 'residue' of previous line */
#if OLD_NCURSES
{
int i;
for (i = 0; i < width - x; i++)
waddch(win, ' ');
}
#else
wclrtoeol(win);
#endif
}
/*
* Return current line of text. Called by dialog_textbox() and print_line().
* 'page' should point to start of current line before calling, and will be
* updated to point to start of next line.
*/
static char *get_line(void)
{
int i = 0;
static char line[MAX_LEN + 1];
end_reached = 0;
while (*page != '\n') {
if (*page == '\0') {
if (!end_reached) {
end_reached = 1;
break;
}
} else if (i < MAX_LEN)
line[i++] = *(page++);
else {
/* Truncate lines longer than MAX_LEN characters */
if (i == MAX_LEN)
line[i++] = '\0';
page++;
}
}
if (i <= MAX_LEN)
line[i] = '\0';
if (!end_reached)
page++; /* move pass '\n' */
return line;
}
/*
* Print current position
*/
static void print_position(WINDOW * win)
{
int percent;
wattrset(win, dlg.position_indicator.atr);
wbkgdset(win, dlg.position_indicator.atr & A_COLOR);
percent = (page - buf) * 100 / strlen(buf);
wmove(win, getmaxy(win) - 3, getmaxx(win) - 9);
wprintw(win, "(%3d%%)", percent);
}

642
kconfig/lxdialog/util.c Normal file
View File

@ -0,0 +1,642 @@
/*
* util.c
*
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "dialog.h"
struct dialog_info dlg;
static void set_mono_theme(void)
{
dlg.screen.atr = A_NORMAL;
dlg.shadow.atr = A_NORMAL;
dlg.dialog.atr = A_NORMAL;
dlg.title.atr = A_BOLD;
dlg.border.atr = A_NORMAL;
dlg.button_active.atr = A_REVERSE;
dlg.button_inactive.atr = A_DIM;
dlg.button_key_active.atr = A_REVERSE;
dlg.button_key_inactive.atr = A_BOLD;
dlg.button_label_active.atr = A_REVERSE;
dlg.button_label_inactive.atr = A_NORMAL;
dlg.inputbox.atr = A_NORMAL;
dlg.inputbox_border.atr = A_NORMAL;
dlg.searchbox.atr = A_NORMAL;
dlg.searchbox_title.atr = A_BOLD;
dlg.searchbox_border.atr = A_NORMAL;
dlg.position_indicator.atr = A_BOLD;
dlg.menubox.atr = A_NORMAL;
dlg.menubox_border.atr = A_NORMAL;
dlg.item.atr = A_NORMAL;
dlg.item_selected.atr = A_REVERSE;
dlg.tag.atr = A_BOLD;
dlg.tag_selected.atr = A_REVERSE;
dlg.tag_key.atr = A_BOLD;
dlg.tag_key_selected.atr = A_REVERSE;
dlg.check.atr = A_BOLD;
dlg.check_selected.atr = A_REVERSE;
dlg.uarrow.atr = A_BOLD;
dlg.darrow.atr = A_BOLD;
}
#define DLG_COLOR(dialog, f, b, h) \
do { \
dlg.dialog.fg = (f); \
dlg.dialog.bg = (b); \
dlg.dialog.hl = (h); \
} while (0)
static void set_classic_theme(void)
{
DLG_COLOR(screen, COLOR_CYAN, COLOR_BLUE, true);
DLG_COLOR(shadow, COLOR_BLACK, COLOR_BLACK, true);
DLG_COLOR(dialog, COLOR_BLACK, COLOR_WHITE, false);
DLG_COLOR(title, COLOR_YELLOW, COLOR_WHITE, true);
DLG_COLOR(border, COLOR_WHITE, COLOR_WHITE, true);
DLG_COLOR(button_active, COLOR_WHITE, COLOR_BLUE, true);
DLG_COLOR(button_inactive, COLOR_BLACK, COLOR_WHITE, false);
DLG_COLOR(button_key_active, COLOR_WHITE, COLOR_BLUE, true);
DLG_COLOR(button_key_inactive, COLOR_RED, COLOR_WHITE, false);
DLG_COLOR(button_label_active, COLOR_YELLOW, COLOR_BLUE, true);
DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_WHITE, true);
DLG_COLOR(inputbox, COLOR_BLACK, COLOR_WHITE, false);
DLG_COLOR(inputbox_border, COLOR_BLACK, COLOR_WHITE, false);
DLG_COLOR(searchbox, COLOR_BLACK, COLOR_WHITE, false);
DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_WHITE, true);
DLG_COLOR(searchbox_border, COLOR_WHITE, COLOR_WHITE, true);
DLG_COLOR(position_indicator, COLOR_YELLOW, COLOR_WHITE, true);
DLG_COLOR(menubox, COLOR_BLACK, COLOR_WHITE, false);
DLG_COLOR(menubox_border, COLOR_WHITE, COLOR_WHITE, true);
DLG_COLOR(item, COLOR_BLACK, COLOR_WHITE, false);
DLG_COLOR(item_selected, COLOR_WHITE, COLOR_BLUE, true);
DLG_COLOR(tag, COLOR_YELLOW, COLOR_WHITE, true);
DLG_COLOR(tag_selected, COLOR_YELLOW, COLOR_BLUE, true);
DLG_COLOR(tag_key, COLOR_YELLOW, COLOR_WHITE, true);
DLG_COLOR(tag_key_selected, COLOR_YELLOW, COLOR_BLUE, true);
DLG_COLOR(check, COLOR_BLACK, COLOR_WHITE, false);
DLG_COLOR(check_selected, COLOR_WHITE, COLOR_BLUE, true);
DLG_COLOR(uarrow, COLOR_GREEN, COLOR_WHITE, true);
DLG_COLOR(darrow, COLOR_GREEN, COLOR_WHITE, true);
}
static void set_blackbg_theme(void)
{
DLG_COLOR(screen, COLOR_RED, COLOR_BLACK, true);
DLG_COLOR(shadow, COLOR_BLACK, COLOR_BLACK, false);
DLG_COLOR(dialog, COLOR_WHITE, COLOR_BLACK, false);
DLG_COLOR(title, COLOR_RED, COLOR_BLACK, false);
DLG_COLOR(border, COLOR_BLACK, COLOR_BLACK, true);
DLG_COLOR(button_active, COLOR_YELLOW, COLOR_RED, false);
DLG_COLOR(button_inactive, COLOR_YELLOW, COLOR_BLACK, false);
DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_RED, true);
DLG_COLOR(button_key_inactive, COLOR_RED, COLOR_BLACK, false);
DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_RED, false);
DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_BLACK, true);
DLG_COLOR(inputbox, COLOR_YELLOW, COLOR_BLACK, false);
DLG_COLOR(inputbox_border, COLOR_YELLOW, COLOR_BLACK, false);
DLG_COLOR(searchbox, COLOR_YELLOW, COLOR_BLACK, false);
DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_BLACK, true);
DLG_COLOR(searchbox_border, COLOR_BLACK, COLOR_BLACK, true);
DLG_COLOR(position_indicator, COLOR_RED, COLOR_BLACK, false);
DLG_COLOR(menubox, COLOR_YELLOW, COLOR_BLACK, false);
DLG_COLOR(menubox_border, COLOR_BLACK, COLOR_BLACK, true);
DLG_COLOR(item, COLOR_WHITE, COLOR_BLACK, false);
DLG_COLOR(item_selected, COLOR_WHITE, COLOR_RED, false);
DLG_COLOR(tag, COLOR_RED, COLOR_BLACK, false);
DLG_COLOR(tag_selected, COLOR_YELLOW, COLOR_RED, true);
DLG_COLOR(tag_key, COLOR_RED, COLOR_BLACK, false);
DLG_COLOR(tag_key_selected, COLOR_YELLOW, COLOR_RED, true);
DLG_COLOR(check, COLOR_YELLOW, COLOR_BLACK, false);
DLG_COLOR(check_selected, COLOR_YELLOW, COLOR_RED, true);
DLG_COLOR(uarrow, COLOR_RED, COLOR_BLACK, false);
DLG_COLOR(darrow, COLOR_RED, COLOR_BLACK, false);
}
static void set_bluetitle_theme(void)
{
set_classic_theme();
DLG_COLOR(title, COLOR_BLUE, COLOR_WHITE, true);
DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_BLUE, true);
DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_BLUE, true);
DLG_COLOR(searchbox_title, COLOR_BLUE, COLOR_WHITE, true);
DLG_COLOR(position_indicator, COLOR_BLUE, COLOR_WHITE, true);
DLG_COLOR(tag, COLOR_BLUE, COLOR_WHITE, true);
DLG_COLOR(tag_key, COLOR_BLUE, COLOR_WHITE, true);
}
/*
* Select color theme
*/
static int set_theme(const char *theme)
{
int use_color = 1;
if (!theme)
set_bluetitle_theme();
else if (strcmp(theme, "classic") == 0)
set_classic_theme();
else if (strcmp(theme, "bluetitle") == 0)
set_bluetitle_theme();
else if (strcmp(theme, "blackbg") == 0)
set_blackbg_theme();
else if (strcmp(theme, "mono") == 0)
use_color = 0;
return use_color;
}
static void init_one_color(struct dialog_color *color)
{
static int pair = 0;
pair++;
init_pair(pair, color->fg, color->bg);
if (color->hl)
color->atr = A_BOLD | COLOR_PAIR(pair);
else
color->atr = COLOR_PAIR(pair);
}
static void init_dialog_colors(void)
{
init_one_color(&dlg.screen);
init_one_color(&dlg.shadow);
init_one_color(&dlg.dialog);
init_one_color(&dlg.title);
init_one_color(&dlg.border);
init_one_color(&dlg.button_active);
init_one_color(&dlg.button_inactive);
init_one_color(&dlg.button_key_active);
init_one_color(&dlg.button_key_inactive);
init_one_color(&dlg.button_label_active);
init_one_color(&dlg.button_label_inactive);
init_one_color(&dlg.inputbox);
init_one_color(&dlg.inputbox_border);
init_one_color(&dlg.searchbox);
init_one_color(&dlg.searchbox_title);
init_one_color(&dlg.searchbox_border);
init_one_color(&dlg.position_indicator);
init_one_color(&dlg.menubox);
init_one_color(&dlg.menubox_border);
init_one_color(&dlg.item);
init_one_color(&dlg.item_selected);
init_one_color(&dlg.tag);
init_one_color(&dlg.tag_selected);
init_one_color(&dlg.tag_key);
init_one_color(&dlg.tag_key_selected);
init_one_color(&dlg.check);
init_one_color(&dlg.check_selected);
init_one_color(&dlg.uarrow);
init_one_color(&dlg.darrow);
}
/*
* Setup for color display
*/
static void color_setup(const char *theme)
{
if (set_theme(theme)) {
if (has_colors()) { /* Terminal supports color? */
start_color();
init_dialog_colors();
}
}
else
{
set_mono_theme();
}
}
/*
* Set window to attribute 'attr'
*/
void attr_clear(WINDOW * win, int height, int width, chtype attr)
{
int i, j;
wattrset(win, attr);
for (i = 0; i < height; i++) {
wmove(win, i, 0);
for (j = 0; j < width; j++)
waddch(win, ' ');
}
touchwin(win);
}
void dialog_clear(void)
{
attr_clear(stdscr, LINES, COLS, dlg.screen.atr);
/* Display background title if it exists ... - SLH */
if (dlg.backtitle != NULL) {
int i;
wattrset(stdscr, dlg.screen.atr);
mvwaddstr(stdscr, 0, 1, (char *)dlg.backtitle);
wmove(stdscr, 1, 1);
for (i = 1; i < COLS - 1; i++)
waddch(stdscr, ACS_HLINE);
}
wnoutrefresh(stdscr);
}
/*
* Do some initialization for dialog
*/
void init_dialog(const char *backtitle)
{
dlg.backtitle = backtitle;
color_setup(getenv("MENUCONFIG_COLOR"));
}
void reset_dialog(void)
{
initscr(); /* Init curses */
keypad(stdscr, TRUE);
cbreak();
noecho();
dialog_clear();
}
/*
* End using dialog functions.
*/
void end_dialog(void)
{
endwin();
}
/* Print the title of the dialog. Center the title and truncate
* tile if wider than dialog (- 2 chars).
**/
void print_title(WINDOW *dialog, const char *title, int width)
{
if (title) {
int tlen = MIN(width - 2, strlen(title));
wattrset(dialog, dlg.title.atr);
mvwaddch(dialog, 0, (width - tlen) / 2 - 1, ' ');
mvwaddnstr(dialog, 0, (width - tlen)/2, title, tlen);
waddch(dialog, ' ');
}
}
/*
* Print a string of text in a window, automatically wrap around to the
* next line if the string is too long to fit on one line. Newline
* characters '\n' are replaced by spaces. We start on a new line
* if there is no room for at least 4 nonblanks following a double-space.
*/
void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x)
{
int newl, cur_x, cur_y;
int i, prompt_len, room, wlen;
char tempstr[MAX_LEN + 1], *word, *sp, *sp2;
strcpy(tempstr, prompt);
prompt_len = strlen(tempstr);
/*
* Remove newlines
*/
for (i = 0; i < prompt_len; i++) {
if (tempstr[i] == '\n')
tempstr[i] = ' ';
}
if (prompt_len <= width - x * 2) { /* If prompt is short */
wmove(win, y, (width - prompt_len) / 2);
waddstr(win, tempstr);
} else {
cur_x = x;
cur_y = y;
newl = 1;
word = tempstr;
while (word && *word) {
sp = index(word, ' ');
if (sp)
*sp++ = 0;
/* Wrap to next line if either the word does not fit,
or it is the first word of a new sentence, and it is
short, and the next word does not fit. */
room = width - cur_x;
wlen = strlen(word);
if (wlen > room ||
(newl && wlen < 4 && sp
&& wlen + 1 + strlen(sp) > room
&& (!(sp2 = index(sp, ' '))
|| wlen + 1 + (sp2 - sp) > room))) {
cur_y++;
cur_x = x;
}
wmove(win, cur_y, cur_x);
waddstr(win, word);
getyx(win, cur_y, cur_x);
cur_x++;
if (sp && *sp == ' ') {
cur_x++; /* double space */
while (*++sp == ' ') ;
newl = 1;
} else
newl = 0;
word = sp;
}
}
}
/*
* Print a button
*/
void print_button(WINDOW * win, const char *label, int y, int x, int selected)
{
int i, temp;
wmove(win, y, x);
wattrset(win, selected ? dlg.button_active.atr
: dlg.button_inactive.atr);
waddstr(win, "<");
temp = strspn(label, " ");
label += temp;
wattrset(win, selected ? dlg.button_label_active.atr
: dlg.button_label_inactive.atr);
for (i = 0; i < temp; i++)
waddch(win, ' ');
wattrset(win, selected ? dlg.button_key_active.atr
: dlg.button_key_inactive.atr);
waddch(win, label[0]);
wattrset(win, selected ? dlg.button_label_active.atr
: dlg.button_label_inactive.atr);
waddstr(win, (char *)label + 1);
wattrset(win, selected ? dlg.button_active.atr
: dlg.button_inactive.atr);
waddstr(win, ">");
wmove(win, y, x + temp + 1);
}
/*
* Draw a rectangular box with line drawing characters
*/
void
draw_box(WINDOW * win, int y, int x, int height, int width,
chtype box, chtype border)
{
int i, j;
wattrset(win, 0);
for (i = 0; i < height; i++) {
wmove(win, y + i, x);
for (j = 0; j < width; j++)
if (!i && !j)
waddch(win, border | ACS_ULCORNER);
else if (i == height - 1 && !j)
waddch(win, border | ACS_LLCORNER);
else if (!i && j == width - 1)
waddch(win, box | ACS_URCORNER);
else if (i == height - 1 && j == width - 1)
waddch(win, box | ACS_LRCORNER);
else if (!i)
waddch(win, border | ACS_HLINE);
else if (i == height - 1)
waddch(win, box | ACS_HLINE);
else if (!j)
waddch(win, border | ACS_VLINE);
else if (j == width - 1)
waddch(win, box | ACS_VLINE);
else
waddch(win, box | ' ');
}
}
/*
* Draw shadows along the right and bottom edge to give a more 3D look
* to the boxes
*/
void draw_shadow(WINDOW * win, int y, int x, int height, int width)
{
int i;
if (has_colors()) { /* Whether terminal supports color? */
wattrset(win, dlg.shadow.atr);
wmove(win, y + height, x + 2);
for (i = 0; i < width; i++)
waddch(win, winch(win) & A_CHARTEXT);
for (i = y + 1; i < y + height + 1; i++) {
wmove(win, i, x + width);
waddch(win, winch(win) & A_CHARTEXT);
waddch(win, winch(win) & A_CHARTEXT);
}
wnoutrefresh(win);
}
}
/*
* Return the position of the first alphabetic character in a string.
*/
int first_alpha(const char *string, const char *exempt)
{
int i, in_paren = 0, c;
for (i = 0; i < strlen(string); i++) {
c = tolower(string[i]);
if (strchr("<[(", c))
++in_paren;
if (strchr(">])", c) && in_paren > 0)
--in_paren;
if ((!in_paren) && isalpha(c) && strchr(exempt, c) == 0)
return i;
}
return 0;
}
/*
* ncurses uses ESC to detect escaped char sequences. This resutl in
* a small timeout before ESC is actually delivered to the application.
* lxdialog suggest <ESC> <ESC> which is correctly translated to two
* times esc. But then we need to ignore the second esc to avoid stepping
* out one menu too much. Filter away all escaped key sequences since
* keypad(FALSE) turn off ncurses support for escape sequences - and thats
* needed to make notimeout() do as expected.
*/
int on_key_esc(WINDOW *win)
{
int key;
int key2;
int key3;
nodelay(win, TRUE);
keypad(win, FALSE);
key = wgetch(win);
key2 = wgetch(win);
do {
key3 = wgetch(win);
} while (key3 != ERR);
nodelay(win, FALSE);
keypad(win, TRUE);
if (key == KEY_ESC && key2 == ERR)
return KEY_ESC;
else if (key != ERR && key != KEY_ESC && key2 == ERR)
ungetch(key);
return -1;
}
/* redraw screen in new size */
int on_key_resize(void)
{
dialog_clear();
return KEY_RESIZE;
}
struct dialog_list *item_cur;
struct dialog_list item_nil;
struct dialog_list *item_head;
void item_reset(void)
{
struct dialog_list *p, *next;
for (p = item_head; p; p = next) {
next = p->next;
free(p);
}
item_head = NULL;
item_cur = &item_nil;
}
void item_make(const char *fmt, ...)
{
va_list ap;
struct dialog_list *p = malloc(sizeof(*p));
if (item_head)
item_cur->next = p;
else
item_head = p;
item_cur = p;
memset(p, 0, sizeof(*p));
va_start(ap, fmt);
vsnprintf(item_cur->node.str, sizeof(item_cur->node.str), fmt, ap);
va_end(ap);
}
void item_add_str(const char *fmt, ...)
{
va_list ap;
size_t avail;
avail = sizeof(item_cur->node.str) - strlen(item_cur->node.str);
va_start(ap, fmt);
vsnprintf(item_cur->node.str + strlen(item_cur->node.str),
avail, fmt, ap);
item_cur->node.str[sizeof(item_cur->node.str) - 1] = '\0';
va_end(ap);
}
void item_set_tag(char tag)
{
item_cur->node.tag = tag;
}
void item_set_data(void *ptr)
{
item_cur->node.data = ptr;
}
void item_set_selected(int val)
{
item_cur->node.selected = val;
}
int item_activate_selected(void)
{
item_foreach()
if (item_is_selected())
return 1;
return 0;
}
void *item_data(void)
{
return item_cur->node.data;
}
char item_tag(void)
{
return item_cur->node.tag;
}
int item_count(void)
{
int n = 0;
struct dialog_list *p;
for (p = item_head; p; p = p->next)
n++;
return n;
}
void item_set(int n)
{
int i = 0;
item_foreach()
if (i++ == n)
return;
}
int item_n(void)
{
int n = 0;
struct dialog_list *p;
for (p = item_head; p; p = p->next) {
if (p == item_cur)
return n;
n++;
}
return 0;
}
const char *item_str(void)
{
return item_cur->node.str;
}
int item_is_selected(void)
{
return (item_cur->node.selected != 0);
}
int item_is_tag(char tag)
{
return (item_cur->node.tag == tag);
}

114
kconfig/lxdialog/yesno.c Normal file
View File

@ -0,0 +1,114 @@
/*
* yesno.c -- implements the yes/no box
*
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "dialog.h"
/*
* Display termination buttons
*/
static void print_buttons(WINDOW * dialog, int height, int width, int selected)
{
int x = width / 2 - 10;
int y = height - 2;
print_button(dialog, " Yes ", y, x, selected == 0);
print_button(dialog, " No ", y, x + 13, selected == 1);
wmove(dialog, y, x + 1 + 13 * selected);
wrefresh(dialog);
}
/*
* Display a dialog box with two buttons - Yes and No
*/
int dialog_yesno(const char *title, const char *prompt, int height, int width)
{
int i, x, y, key = 0, button = 0;
WINDOW *dialog;
do_resize:
if (getmaxy(stdscr) < (height + 4))
return -ERRDISPLAYTOOSMALL;
if (getmaxx(stdscr) < (width + 4))
return -ERRDISPLAYTOOSMALL;
/* center dialog box on screen */
x = (COLS - width) / 2;
y = (LINES - height) / 2;
draw_shadow(stdscr, y, x, height, width);
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);
draw_box(dialog, 0, 0, height, width,
dlg.dialog.atr, dlg.border.atr);
wattrset(dialog, dlg.border.atr);
mvwaddch(dialog, height - 3, 0, ACS_LTEE);
for (i = 0; i < width - 2; i++)
waddch(dialog, ACS_HLINE);
wattrset(dialog, dlg.dialog.atr);
waddch(dialog, ACS_RTEE);
print_title(dialog, title, width);
wattrset(dialog, dlg.dialog.atr);
print_autowrap(dialog, prompt, width - 2, 1, 3);
print_buttons(dialog, height, width, 0);
while (key != KEY_ESC) {
key = wgetch(dialog);
switch (key) {
case 'Y':
case 'y':
delwin(dialog);
return 0;
case 'N':
case 'n':
delwin(dialog);
return 1;
case TAB:
case KEY_LEFT:
case KEY_RIGHT:
button = ((key == KEY_LEFT ? --button : ++button) < 0) ? 1 : (button > 1 ? 0 : button);
print_buttons(dialog, height, width, button);
wrefresh(dialog);
break;
case ' ':
case '\n':
delwin(dialog);
return button;
case KEY_ESC:
key = on_key_esc(dialog);
break;
case KEY_RESIZE:
delwin(dialog);
on_key_resize();
goto do_resize;
}
}
delwin(dialog);
return key; /* ESC pressed */
}

919
kconfig/mconf.c Normal file
View File

@ -0,0 +1,919 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*
* Introduced single menu mode (show all sub-menus in one large tree).
* 2002-11-06 Petr Baudis <pasky@ucw.cz>
*
* i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*/
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <locale.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
#include "lxdialog/dialog.h"
static char menu_backtitle[128];
static const char mconf_readme[] = N_(
"Overview\n"
"--------\n"
"Some kernel features may be built directly into the kernel.\n"
"Some may be made into loadable runtime modules. Some features\n"
"may be completely removed altogether. There are also certain\n"
"kernel parameters which are not really features, but must be\n"
"entered in as decimal or hexadecimal numbers or possibly text.\n"
"\n"
"Menu items beginning with [*], <M> or [ ] represent features\n"
"configured to be built in, modularized or removed respectively.\n"
"Pointed brackets <> represent module capable features.\n"
"\n"
"To change any of these features, highlight it with the cursor\n"
"keys and press <Y> to build it in, <M> to make it a module or\n"
"<N> to removed it. You may also press the <Space Bar> to cycle\n"
"through the available options (ie. Y->N->M->Y).\n"
"\n"
"Some additional keyboard hints:\n"
"\n"
"Menus\n"
"----------\n"
"o Use the Up/Down arrow keys (cursor keys) to highlight the item\n"
" you wish to change or submenu wish to select and press <Enter>.\n"
" Submenus are designated by \"--->\".\n"
"\n"
" Shortcut: Press the option's highlighted letter (hotkey).\n"
" Pressing a hotkey more than once will sequence\n"
" through all visible items which use that hotkey.\n"
"\n"
" You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n"
" unseen options into view.\n"
"\n"
"o To exit a menu use the cursor keys to highlight the <Exit> button\n"
" and press <ENTER>.\n"
"\n"
" Shortcut: Press <ESC><ESC> or <E> or <X> if there is no hotkey\n"
" using those letters. You may press a single <ESC>, but\n"
" there is a delayed response which you may find annoying.\n"
"\n"
" Also, the <TAB> and cursor keys will cycle between <Select>,\n"
" <Exit> and <Help>\n"
"\n"
"o To get help with an item, use the cursor keys to highlight <Help>\n"
" and Press <ENTER>.\n"
"\n"
" Shortcut: Press <H> or <?>.\n"
"\n"
"\n"
"Radiolists (Choice lists)\n"
"-----------\n"
"o Use the cursor keys to select the option you wish to set and press\n"
" <S> or the <SPACE BAR>.\n"
"\n"
" Shortcut: Press the first letter of the option you wish to set then\n"
" press <S> or <SPACE BAR>.\n"
"\n"
"o To see available help for the item, use the cursor keys to highlight\n"
" <Help> and Press <ENTER>.\n"
"\n"
" Shortcut: Press <H> or <?>.\n"
"\n"
" Also, the <TAB> and cursor keys will cycle between <Select> and\n"
" <Help>\n"
"\n"
"\n"
"Data Entry\n"
"-----------\n"
"o Enter the requested information and press <ENTER>\n"
" If you are entering hexadecimal values, it is not necessary to\n"
" add the '0x' prefix to the entry.\n"
"\n"
"o For help, use the <TAB> or cursor keys to highlight the help option\n"
" and press <ENTER>. You can try <TAB><H> as well.\n"
"\n"
"\n"
"Text Box (Help Window)\n"
"--------\n"
"o Use the cursor keys to scroll up/down/left/right. The VI editor\n"
" keys h,j,k,l function here as do <SPACE BAR> and <B> for those\n"
" who are familiar with less and lynx.\n"
"\n"
"o Press <E>, <X>, <Enter> or <Esc><Esc> to exit.\n"
"\n"
"\n"
"Alternate Configuration Files\n"
"-----------------------------\n"
"Menuconfig supports the use of alternate configuration files for\n"
"those who, for various reasons, find it necessary to switch\n"
"between different kernel configurations.\n"
"\n"
"At the end of the main menu you will find two options. One is\n"
"for saving the current configuration to a file of your choosing.\n"
"The other option is for loading a previously saved alternate\n"
"configuration.\n"
"\n"
"Even if you don't use alternate configuration files, but you\n"
"find during a Menuconfig session that you have completely messed\n"
"up your settings, you may use the \"Load Alternate...\" option to\n"
"restore your previously saved settings from \".config\" without\n"
"restarting Menuconfig.\n"
"\n"
"Other information\n"
"-----------------\n"
"If you use Menuconfig in an XTERM window make sure you have your\n"
"$TERM variable set to point to a xterm definition which supports color.\n"
"Otherwise, Menuconfig will look rather bad. Menuconfig will not\n"
"display correctly in a RXVT window because rxvt displays only one\n"
"intensity of color, bright.\n"
"\n"
"Menuconfig will display larger menus on screens or xterms which are\n"
"set to display more than the standard 25 row by 80 column geometry.\n"
"In order for this to work, the \"stty size\" command must be able to\n"
"display the screen's current row and column geometry. I STRONGLY\n"
"RECOMMEND that you make sure you do NOT have the shell variables\n"
"LINES and COLUMNS exported into your environment. Some distributions\n"
"export those variables via /etc/profile. Some ncurses programs can\n"
"become confused when those variables (LINES & COLUMNS) don't reflect\n"
"the true screen size.\n"
"\n"
"Optional personality available\n"
"------------------------------\n"
"If you prefer to have all of the kernel options listed in a single\n"
"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
"\n"
"make MENUCONFIG_MODE=single_menu menuconfig\n"
"\n"
"<Enter> will then unroll the appropriate category, or enfold it if it\n"
"is already unrolled.\n"
"\n"
"Note that this mode can eventually be a little more CPU expensive\n"
"(especially with a larger number of unrolled categories) than the\n"
"default mode.\n"
"\n"
"Different color themes available\n"
"--------------------------------\n"
"It is possible to select different color themes using the variable\n"
"MENUCONFIG_COLOR. To select a theme use:\n"
"\n"
"make MENUCONFIG_COLOR=<theme> menuconfig\n"
"\n"
"Available themes are\n"
" mono => selects colors suitable for monochrome displays\n"
" blackbg => selects a color scheme with black background\n"
" classic => theme with blue background. The classic look\n"
" bluetitle => a LCD friendly version of classic. (default)\n"
"\n"),
menu_instructions[] = N_(
"Arrow keys navigate the menu. "
"<Enter> selects submenus --->. "
"Highlighted letters are hotkeys. "
"Pressing <Y> includes, <N> excludes, <M> modularizes features. "
"Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
"Legend: [*] built-in [ ] excluded <M> module < > module capable"),
radiolist_instructions[] = N_(
"Use the arrow keys to navigate this window or "
"press the hotkey of the item you wish to select "
"followed by the <SPACE BAR>. "
"Press <?> for additional information about this option."),
inputbox_instructions_int[] = N_(
"Please enter a decimal value. "
"Fractions will not be accepted. "
"Use the <TAB> key to move from the input field to the buttons below it."),
inputbox_instructions_hex[] = N_(
"Please enter a hexadecimal value. "
"Use the <TAB> key to move from the input field to the buttons below it."),
inputbox_instructions_string[] = N_(
"Please enter a string value. "
"Use the <TAB> key to move from the input field to the buttons below it."),
setmod_text[] = N_(
"This feature depends on another which has been configured as a module.\n"
"As a result, this feature will be built as a module."),
nohelp_text[] = N_(
"There is no help available for this kernel option.\n"),
load_config_text[] = N_(
"Enter the name of the configuration file you wish to load. "
"Accept the name shown to restore the configuration you "
"last retrieved. Leave blank to abort."),
load_config_help[] = N_(
"\n"
"For various reasons, one may wish to keep several different kernel\n"
"configurations available on a single machine.\n"
"\n"
"If you have saved a previous configuration in a file other than the\n"
"kernel's default, entering the name of the file here will allow you\n"
"to modify that configuration.\n"
"\n"
"If you are uncertain, then you have probably never used alternate\n"
"configuration files. You should therefor leave this blank to abort.\n"),
save_config_text[] = N_(
"Enter a filename to which this configuration should be saved "
"as an alternate. Leave blank to abort."),
save_config_help[] = N_(
"\n"
"For various reasons, one may wish to keep different kernel\n"
"configurations available on a single machine.\n"
"\n"
"Entering a file name here will allow you to later retrieve, modify\n"
"and use the current configuration as an alternate to whatever\n"
"configuration options you have selected at that time.\n"
"\n"
"If you are uncertain what all this means then you should probably\n"
"leave this blank.\n"),
search_help[] = N_(
"\n"
"Search for CT_ symbols and display their relations.\n"
"Regular expressions are allowed.\n"
"Example: search for \"^FOO\"\n"
"Result:\n"
"-----------------------------------------------------------------\n"
"Symbol: FOO [=m]\n"
"Prompt: Foo bus is used to drive the bar HW\n"
"Defined at drivers/pci/Kconfig:47\n"
"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
"Location:\n"
" -> Bus options (PCI, PCMCIA, EISA, MCA, ISA)\n"
" -> PCI support (PCI [=y])\n"
" -> PCI access mode (<choice> [=y])\n"
"Selects: LIBCRC32\n"
"Selected by: BAR\n"
"-----------------------------------------------------------------\n"
"o The line 'Prompt:' shows the text used in the menu structure for\n"
" this CT_ symbol\n"
"o The 'Defined at' line tell at what file / line number the symbol\n"
" is defined\n"
"o The 'Depends on:' line tell what symbols needs to be defined for\n"
" this symbol to be visible in the menu (selectable)\n"
"o The 'Location:' lines tell where in the menu structure this symbol\n"
" is located\n"
" A location followed by a [=y] indicate that this is a selectable\n"
" menu item - and current value is displayed inside brackets.\n"
"o The 'Selects:' line tell what symbol will be automatically\n"
" selected if this symbol is selected (y or m)\n"
"o The 'Selected by' line tell what symbol has selected this symbol\n"
"\n"
"Only relevant lines are shown.\n"
"\n\n"
"Search examples:\n"
"Examples: USB => find all CT_ symbols containing USB\n"
" ^USB => find all CT_ symbols starting with USB\n"
" USB$ => find all CT_ symbols ending with USB\n"
"\n");
static char filename[PATH_MAX+1] = ".config";
static int indent;
static struct termios ios_org;
static int rows = 0, cols = 0;
static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
static void conf(struct menu *menu);
static void conf_choice(struct menu *menu);
static void conf_string(struct menu *menu);
static void conf_load(void);
static void conf_save(void);
static void show_textbox(const char *title, const char *text, int r, int c);
static void show_helptext(const char *title, const char *text);
static void show_help(struct menu *menu);
static void init_wsize(void)
{
struct winsize ws;
char *env;
if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) {
rows = ws.ws_row;
cols = ws.ws_col;
}
if (!rows) {
env = getenv("LINES");
if (env)
rows = atoi(env);
if (!rows)
rows = 24;
}
if (!cols) {
env = getenv("COLUMNS");
if (env)
cols = atoi(env);
if (!cols)
cols = 80;
}
if (rows < 19 || cols < 80) {
fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
exit(1);
}
rows -= 4;
cols -= 5;
}
static void get_prompt_str(struct gstr *r, struct property *prop)
{
int i, j;
struct menu *submenu[8], *menu;
str_printf(r, "Prompt: %s\n", prop->text);
str_printf(r, " Defined at %s:%d\n", prop->menu->file->name,
prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) {
str_append(r, " Depends on: ");
expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n");
}
menu = prop->menu->parent;
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
submenu[i++] = menu;
if (i > 0) {
str_printf(r, " Location:\n");
for (j = 4; --i >= 0; j += 2) {
menu = submenu[i];
str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu));
if (menu->sym) {
str_printf(r, " (%s [=%s])", menu->sym->name ?
menu->sym->name : "<choice>",
sym_get_string_value(menu->sym));
}
str_append(r, "\n");
}
}
}
static void get_symbol_str(struct gstr *r, struct symbol *sym)
{
bool hit;
struct property *prop;
str_printf(r, "Symbol: %s [=%s]\n", sym->name,
sym_get_string_value(sym));
for_all_prompts(sym, prop)
get_prompt_str(r, prop);
hit = false;
for_all_properties(sym, prop, P_SELECT) {
if (!hit) {
str_append(r, " Selects: ");
hit = true;
} else
str_printf(r, " && ");
expr_gstr_print(prop->expr, r);
}
if (hit)
str_append(r, "\n");
if (sym->rev_dep.expr) {
str_append(r, " Selected by: ");
expr_gstr_print(sym->rev_dep.expr, r);
str_append(r, "\n");
}
str_append(r, "\n\n");
}
static struct gstr get_relations_str(struct symbol **sym_arr)
{
struct symbol *sym;
struct gstr res = str_new();
int i;
for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym);
if (!i)
str_append(&res, "No matches found.\n");
return res;
}
static void search_conf(void)
{
struct symbol **sym_arr;
struct gstr res;
int dres;
again:
dialog_clear();
dres = dialog_inputbox(_("Search Configuration Parameter"),
_("Enter CT_ (sub)string to search for (omit CT_)"),
10, 75, "");
switch (dres) {
case 0:
break;
case 1:
show_helptext(_("Search Configuration"), search_help);
goto again;
default:
return;
}
sym_arr = sym_re_search(dialog_input_result);
res = get_relations_str(sym_arr);
free(sym_arr);
show_textbox(_("Search Results"), str_get(&res), 0, 0);
str_free(&res);
}
static void build_conf(struct menu *menu)
{
struct symbol *sym;
struct property *prop;
struct menu *child;
int type, tmp, doint = 2;
tristate val;
char ch;
if (!menu_is_visible(menu))
return;
sym = menu->sym;
prop = menu->prompt;
if (!sym) {
if (prop && menu != current_menu) {
const char *prompt = menu_get_prompt(menu);
switch (prop->type) {
case P_MENU:
child_count++;
if (single_menu_mode) {
item_make("%s%*c%s",
menu->data ? "-->" : "++>",
indent + 1, ' ', prompt);
} else
item_make(" %*c%s --->", indent + 1, ' ', prompt);
item_set_tag('m');
item_set_data(menu);
if (single_menu_mode && menu->data)
goto conf_childs;
return;
default:
if (prompt) {
child_count++;
item_make("---%*c%s", indent + 1, ' ', prompt);
item_set_tag(':');
item_set_data(menu);
}
}
} else
doint = 0;
goto conf_childs;
}
type = sym_get_type(sym);
if (sym_is_choice(sym)) {
struct symbol *def_sym = sym_get_choice_value(sym);
struct menu *def_menu = NULL;
child_count++;
for (child = menu->list; child; child = child->next) {
if (menu_is_visible(child) && child->sym == def_sym)
def_menu = child;
}
val = sym_get_tristate_value(sym);
if (sym_is_changable(sym)) {
switch (type) {
case S_BOOLEAN:
item_make("[%c]", val == no ? ' ' : '*');
break;
case S_TRISTATE:
switch (val) {
case yes: ch = '*'; break;
case mod: ch = 'M'; break;
default: ch = ' '; break;
}
item_make("<%c>", ch);
break;
}
item_set_tag('t');
item_set_data(menu);
} else {
item_make(" ");
item_set_tag(def_menu ? 't' : ':');
item_set_data(menu);
}
item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu));
if (val == yes) {
if (def_menu) {
item_add_str(" (%s)", menu_get_prompt(def_menu));
item_add_str(" --->");
if (def_menu->list) {
indent += 2;
build_conf(def_menu);
indent -= 2;
}
}
return;
}
} else {
if (menu == current_menu) {
item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu));
item_set_tag(':');
item_set_data(menu);
goto conf_childs;
}
child_count++;
val = sym_get_tristate_value(sym);
if (sym_is_choice_value(sym) && val == yes) {
item_make(" ");
item_set_tag(':');
item_set_data(menu);
} else {
switch (type) {
case S_BOOLEAN:
if (sym_is_changable(sym))
item_make("[%c]", val == no ? ' ' : '*');
else
item_make("---");
item_set_tag('t');
item_set_data(menu);
break;
case S_TRISTATE:
switch (val) {
case yes: ch = '*'; break;
case mod: ch = 'M'; break;
default: ch = ' '; break;
}
if (sym_is_changable(sym))
item_make("<%c>", ch);
else
item_make("---");
item_set_tag('t');
item_set_data(menu);
break;
default:
tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */
item_make("(%s)", sym_get_string_value(sym));
tmp = indent - tmp + 4;
if (tmp < 0)
tmp = 0;
item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu),
(sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : " (NEW)");
item_set_tag('s');
item_set_data(menu);
goto conf_childs;
}
}
item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu),
(sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : " (NEW)");
if (menu->prompt->type == P_MENU) {
item_add_str(" --->");
return;
}
}
conf_childs:
indent += doint;
for (child = menu->list; child; child = child->next)
build_conf(child);
indent -= doint;
}
static void conf(struct menu *menu)
{
struct menu *submenu;
const char *prompt = menu_get_prompt(menu);
struct symbol *sym;
struct menu *active_menu = NULL;
int res;
int s_scroll = 0;
while (1) {
item_reset();
current_menu = menu;
build_conf(menu);
if (!child_count)
break;
if (menu == &rootmenu) {
item_make("--- ");
item_set_tag(':');
item_make(_(" Load an Alternate Configuration File"));
item_set_tag('L');
item_make(_(" Save an Alternate Configuration File"));
item_set_tag('S');
}
dialog_clear();
res = dialog_menu(prompt ? prompt : _("Main Menu"),
_(menu_instructions),
active_menu, &s_scroll);
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
break;
if (!item_activate_selected())
continue;
if (!item_tag())
continue;
submenu = item_data();
active_menu = item_data();
if (submenu)
sym = submenu->sym;
else
sym = NULL;
switch (res) {
case 0:
switch (item_tag()) {
case 'm':
if (single_menu_mode)
submenu->data = (void *) (long) !submenu->data;
else
conf(submenu);
break;
case 't':
if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)
conf_choice(submenu);
else if (submenu->prompt->type == P_MENU)
conf(submenu);
break;
case 's':
conf_string(submenu);
break;
case 'L':
conf_load();
break;
case 'S':
conf_save();
break;
}
break;
case 2:
if (sym)
show_help(submenu);
else
show_helptext("README", _(mconf_readme));
break;
case 3:
if (item_is_tag('t')) {
if (sym_set_tristate_value(sym, yes))
break;
if (sym_set_tristate_value(sym, mod))
show_textbox(NULL, setmod_text, 6, 74);
}
break;
case 4:
if (item_is_tag('t'))
sym_set_tristate_value(sym, no);
break;
case 5:
if (item_is_tag('t'))
sym_set_tristate_value(sym, mod);
break;
case 6:
if (item_is_tag('t'))
sym_toggle_tristate_value(sym);
else if (item_is_tag('m'))
conf(submenu);
break;
case 7:
search_conf();
break;
}
}
}
static void show_textbox(const char *title, const char *text, int r, int c)
{
dialog_clear();
dialog_textbox(title, text, r, c);
}
static void show_helptext(const char *title, const char *text)
{
show_textbox(title, text, 0, 0);
}
static void show_help(struct menu *menu)
{
struct gstr help = str_new();
struct symbol *sym = menu->sym;
if (sym->help)
{
if (sym->name) {
str_printf(&help, "CT_%s:\n\n", sym->name);
str_append(&help, _(sym->help));
str_append(&help, "\n");
}
} else {
str_append(&help, nohelp_text);
}
get_symbol_str(&help, sym);
show_helptext(menu_get_prompt(menu), str_get(&help));
str_free(&help);
}
static void conf_choice(struct menu *menu)
{
const char *prompt = menu_get_prompt(menu);
struct menu *child;
struct symbol *active;
active = sym_get_choice_value(menu->sym);
while (1) {
int res;
int selected;
item_reset();
current_menu = menu;
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
item_make("%s", menu_get_prompt(child));
item_set_data(child);
if (child->sym == active)
item_set_selected(1);
if (child->sym == sym_get_choice_value(menu->sym))
item_set_tag('X');
}
dialog_clear();
res = dialog_checklist(prompt ? prompt : _("Main Menu"),
_(radiolist_instructions),
15, 70, 6);
selected = item_activate_selected();
switch (res) {
case 0:
if (selected) {
child = item_data();
sym_set_tristate_value(child->sym, yes);
}
return;
case 1:
if (selected) {
child = item_data();
show_help(child);
active = child->sym;
} else
show_help(menu);
break;
case KEY_ESC:
return;
case -ERRDISPLAYTOOSMALL:
return;
}
}
}
static void conf_string(struct menu *menu)
{
const char *prompt = menu_get_prompt(menu);
while (1) {
int res;
char *heading;
switch (sym_get_type(menu->sym)) {
case S_INT:
heading = _(inputbox_instructions_int);
break;
case S_HEX:
heading = _(inputbox_instructions_hex);
break;
case S_STRING:
heading = _(inputbox_instructions_string);
break;
default:
heading = "Internal mconf error!";
}
dialog_clear();
res = dialog_inputbox(prompt ? prompt : _("Main Menu"),
heading, 10, 75,
sym_get_string_value(menu->sym));
switch (res) {
case 0:
if (sym_set_string_value(menu->sym, dialog_input_result))
return;
show_textbox(NULL, _("You have made an invalid entry."), 5, 43);
break;
case 1:
show_help(menu);
break;
case KEY_ESC:
return;
}
}
}
static void conf_load(void)
{
while (1) {
int res;
dialog_clear();
res = dialog_inputbox(NULL, load_config_text,
11, 55, filename);
switch(res) {
case 0:
if (!dialog_input_result[0])
return;
if (!conf_read(dialog_input_result))
return;
show_textbox(NULL, _("File does not exist!"), 5, 38);
break;
case 1:
show_helptext(_("Load Alternate Configuration"), load_config_help);
break;
case KEY_ESC:
return;
}
}
}
static void conf_save(void)
{
while (1) {
int res;
dialog_clear();
res = dialog_inputbox(NULL, save_config_text,
11, 55, filename);
switch(res) {
case 0:
if (!dialog_input_result[0])
return;
if (!conf_write(dialog_input_result))
return;
show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60);
break;
case 1:
show_helptext(_("Save Alternate Configuration"), save_config_help);
break;
case KEY_ESC:
return;
}
}
}
static void conf_cleanup(void)
{
tcsetattr(1, TCSAFLUSH, &ios_org);
}
int main(int ac, char **av)
{
struct symbol *sym;
char *mode;
int res;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
conf_parse(av[1] ? av[1] : "");
conf_read(NULL);
sym = sym_lookup("PROJECTVERSION", 0);
sym_calc_value(sym);
sprintf(menu_backtitle, _(PROJECT_NAME" v%s Configuration"),
sym_get_string_value(sym));
mode = getenv("MENUCONFIG_MODE");
if (mode) {
if (!strcasecmp(mode, "single_menu"))
single_menu_mode = 1;
}
tcgetattr(1, &ios_org);
atexit(conf_cleanup);
init_wsize();
reset_dialog();
init_dialog(menu_backtitle);
do {
conf(&rootmenu);
dialog_clear();
res = dialog_yesno(NULL,
_("Do you wish to save your "
"new "PROJECT_NAME" configuration?\n"
"<ESC><ESC> to continue."),
6, 60);
} while (res == KEY_ESC);
end_dialog();
if (res == 0) {
if (conf_write(NULL)) {
fprintf(stderr, _("\n\n"
"Error writing "PROJECT_NAME" configuration.\n"
"Your configuration changes were NOT saved."
"\n\n"));
return 1;
}
printf(_("\n\n"
"*** End of "PROJECT_NAME" configuration.\n"
"*** Execute 'make' to build, or try 'make help'."
"\n\n"));
} else {
fprintf(stderr, _("\n\n"
"Your configuration changes were NOT saved."
"\n\n"));
}
return 0;
}

419
kconfig/menu.c Normal file
View File

@ -0,0 +1,419 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#include <stdlib.h>
#include <string.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
struct menu rootmenu;
static struct menu **last_entry_ptr;
struct file *file_list;
struct file *current_file;
static void menu_warn(struct menu *menu, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
static void prop_warn(struct property *prop, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
void menu_init(void)
{
current_entry = current_menu = &rootmenu;
last_entry_ptr = &rootmenu.list;
}
void menu_add_entry(struct symbol *sym)
{
struct menu *menu;
menu = malloc(sizeof(*menu));
memset(menu, 0, sizeof(*menu));
menu->sym = sym;
menu->parent = current_menu;
menu->file = current_file;
menu->lineno = zconf_lineno();
*last_entry_ptr = menu;
last_entry_ptr = &menu->next;
current_entry = menu;
}
void menu_end_entry(void)
{
}
struct menu *menu_add_menu(void)
{
menu_end_entry();
last_entry_ptr = &current_entry->list;
return current_menu = current_entry;
}
void menu_end_menu(void)
{
last_entry_ptr = &current_menu->next;
current_menu = current_menu->parent;
}
struct expr *menu_check_dep(struct expr *e)
{
if (!e)
return e;
switch (e->type) {
case E_NOT:
e->left.expr = menu_check_dep(e->left.expr);
break;
case E_OR:
case E_AND:
e->left.expr = menu_check_dep(e->left.expr);
e->right.expr = menu_check_dep(e->right.expr);
break;
case E_SYMBOL:
/* change 'm' into 'm' && MODULES */
if (e->left.sym == &symbol_mod)
return expr_alloc_and(e, expr_alloc_symbol(modules_sym));
break;
default:
break;
}
return e;
}
void menu_add_dep(struct expr *dep)
{
current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep));
}
void menu_set_type(int type)
{
struct symbol *sym = current_entry->sym;
if (sym->type == type)
return;
if (sym->type == S_UNKNOWN) {
sym->type = type;
return;
}
menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'",
sym->name ? sym->name : "<choice>",
sym_type_name(sym->type), sym_type_name(type));
}
struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep)
{
struct property *prop = prop_alloc(type, current_entry->sym);
prop->menu = current_entry;
prop->expr = expr;
prop->visible.expr = menu_check_dep(dep);
if (prompt) {
if (isspace(*prompt)) {
prop_warn(prop, "leading whitespace ignored");
while (isspace(*prompt))
prompt++;
}
if (current_entry->prompt)
prop_warn(prop, "prompt redefined");
current_entry->prompt = prop;
}
prop->text = prompt;
return prop;
}
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep)
{
return menu_add_prop(type, prompt, NULL, dep);
}
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
{
menu_add_prop(type, NULL, expr, dep);
}
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
{
menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep);
}
void menu_add_option(int token, char *arg)
{
struct property *prop;
switch (token) {
case T_OPT_MODULES:
prop = prop_alloc(P_DEFAULT, modules_sym);
prop->expr = expr_alloc_symbol(current_entry->sym);
break;
case T_OPT_DEFCONFIG_LIST:
if (!sym_defconfig_list)
sym_defconfig_list = current_entry->sym;
else if (sym_defconfig_list != current_entry->sym)
zconf_error("trying to redefine defconfig symbol");
break;
}
}
static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
{
return sym2->type == S_INT || sym2->type == S_HEX ||
(sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
}
void sym_check_prop(struct symbol *sym)
{
struct property *prop;
struct symbol *sym2;
for (prop = sym->prop; prop; prop = prop->next) {
switch (prop->type) {
case P_DEFAULT:
if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) &&
prop->expr->type != E_SYMBOL)
prop_warn(prop,
"default for config symbol '%'"
" must be a single symbol", sym->name);
break;
case P_SELECT:
sym2 = prop_get_symbol(prop);
if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE)
prop_warn(prop,
"config symbol '%s' uses select, but is "
"not boolean or tristate", sym->name);
else if (sym2->type == S_UNKNOWN)
prop_warn(prop,
"'select' used by config symbol '%s' "
"refer to undefined symbol '%s'",
sym->name, sym2->name);
else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE)
prop_warn(prop,
"'%s' has wrong type. 'select' only "
"accept arguments of boolean and "
"tristate type", sym2->name);
break;
case P_RANGE:
if (sym->type != S_INT && sym->type != S_HEX)
prop_warn(prop, "range is only allowed "
"for int or hex symbols");
if (!menu_range_valid_sym(sym, prop->expr->left.sym) ||
!menu_range_valid_sym(sym, prop->expr->right.sym))
prop_warn(prop, "range is invalid");
break;
default:
;
}
}
}
void menu_finalize(struct menu *parent)
{
struct menu *menu, *last_menu;
struct symbol *sym;
struct property *prop;
struct expr *parentdep, *basedep, *dep, *dep2, **ep;
sym = parent->sym;
if (parent->list) {
if (sym && sym_is_choice(sym)) {
/* find the first choice value and find out choice type */
for (menu = parent->list; menu; menu = menu->next) {
if (menu->sym) {
current_entry = parent;
menu_set_type(menu->sym->type);
current_entry = menu;
menu_set_type(sym->type);
break;
}
}
parentdep = expr_alloc_symbol(sym);
} else if (parent->prompt)
parentdep = parent->prompt->visible.expr;
else
parentdep = parent->dep;
for (menu = parent->list; menu; menu = menu->next) {
basedep = expr_transform(menu->dep);
basedep = expr_alloc_and(expr_copy(parentdep), basedep);
basedep = expr_eliminate_dups(basedep);
menu->dep = basedep;
if (menu->sym)
prop = menu->sym->prop;
else
prop = menu->prompt;
for (; prop; prop = prop->next) {
if (prop->menu != menu)
continue;
dep = expr_transform(prop->visible.expr);
dep = expr_alloc_and(expr_copy(basedep), dep);
dep = expr_eliminate_dups(dep);
if (menu->sym && menu->sym->type != S_TRISTATE)
dep = expr_trans_bool(dep);
prop->visible.expr = dep;
if (prop->type == P_SELECT) {
struct symbol *es = prop_get_symbol(prop);
es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr,
expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
}
}
}
for (menu = parent->list; menu; menu = menu->next)
menu_finalize(menu);
} else if (sym) {
basedep = parent->prompt ? parent->prompt->visible.expr : NULL;
basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
basedep = expr_eliminate_dups(expr_transform(basedep));
last_menu = NULL;
for (menu = parent->next; menu; menu = menu->next) {
dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
if (!expr_contains_symbol(dep, sym))
break;
if (expr_depends_symbol(dep, sym))
goto next;
dep = expr_trans_compare(dep, E_UNEQUAL, &symbol_no);
dep = expr_eliminate_dups(expr_transform(dep));
dep2 = expr_copy(basedep);
expr_eliminate_eq(&dep, &dep2);
expr_free(dep);
if (!expr_is_yes(dep2)) {
expr_free(dep2);
break;
}
expr_free(dep2);
next:
menu_finalize(menu);
menu->parent = parent;
last_menu = menu;
}
if (last_menu) {
parent->list = parent->next;
parent->next = last_menu->next;
last_menu->next = NULL;
}
}
for (menu = parent->list; menu; menu = menu->next) {
if (sym && sym_is_choice(sym) && menu->sym) {
menu->sym->flags |= SYMBOL_CHOICEVAL;
if (!menu->prompt)
menu_warn(menu, "choice value must have a prompt");
for (prop = menu->sym->prop; prop; prop = prop->next) {
if (prop->type == P_PROMPT && prop->menu != menu) {
prop_warn(prop, "choice values "
"currently only support a "
"single prompt");
}
if (prop->type == P_DEFAULT)
prop_warn(prop, "defaults for choice "
"values not supported");
}
current_entry = menu;
menu_set_type(sym->type);
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
;
*ep = expr_alloc_one(E_CHOICE, NULL);
(*ep)->right.sym = menu->sym;
}
if (menu->list && (!menu->prompt || !menu->prompt->text)) {
for (last_menu = menu->list; ; last_menu = last_menu->next) {
last_menu->parent = parent;
if (!last_menu->next)
break;
}
last_menu->next = menu->next;
menu->next = menu->list;
menu->list = NULL;
}
}
if (sym && !(sym->flags & SYMBOL_WARNED)) {
if (sym->type == S_UNKNOWN)
menu_warn(parent, "config symbol defined without type");
if (sym_is_choice(sym) && !parent->prompt)
menu_warn(parent, "choice must have a prompt");
/* Check properties connected to this symbol */
sym_check_prop(sym);
sym->flags |= SYMBOL_WARNED;
}
if (sym && !sym_is_optional(sym) && parent->prompt) {
sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr,
expr_alloc_and(parent->prompt->visible.expr,
expr_alloc_symbol(&symbol_mod)));
}
}
bool menu_is_visible(struct menu *menu)
{
struct menu *child;
struct symbol *sym;
tristate visible;
if (!menu->prompt)
return false;
sym = menu->sym;
if (sym) {
sym_calc_value(sym);
visible = menu->prompt->visible.tri;
} else
visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr);
if (visible != no)
return true;
if (!sym || sym_get_tristate_value(menu->sym) == no)
return false;
for (child = menu->list; child; child = child->next)
if (menu_is_visible(child))
return true;
return false;
}
const char *menu_get_prompt(struct menu *menu)
{
if (menu->prompt)
return _(menu->prompt->text);
else if (menu->sym)
return _(menu->sym->name);
return NULL;
}
struct menu *menu_get_root_menu(struct menu *menu)
{
return &rootmenu;
}
struct menu *menu_get_parent_menu(struct menu *menu)
{
enum prop_type type;
for (; menu != &rootmenu; menu = menu->parent) {
type = menu->prompt ? menu->prompt->type : 0;
if (type == P_MENU)
break;
}
return menu;
}

882
kconfig/symbol.c Normal file
View File

@ -0,0 +1,882 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <regex.h>
#include <sys/utsname.h>
#define LKC_DIRECT_LINK
#include "lkc.h"
struct symbol symbol_yes = {
.name = "y",
.curr = { "y", yes },
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_mod = {
.name = "m",
.curr = { "m", mod },
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_no = {
.name = "n",
.curr = { "n", no },
.flags = SYMBOL_CONST|SYMBOL_VALID,
}, symbol_empty = {
.name = "",
.curr = { "", no },
.flags = SYMBOL_VALID,
};
int sym_change_count;
struct symbol *sym_defconfig_list;
struct symbol *modules_sym;
tristate modules_val;
void sym_add_default(struct symbol *sym, const char *def)
{
struct property *prop = prop_alloc(P_DEFAULT, sym);
prop->expr = expr_alloc_symbol(sym_lookup(def, 1));
}
void sym_init(void)
{
struct symbol *sym;
struct utsname uts;
char *p;
static bool inited = false;
if (inited)
return;
inited = true;
uname(&uts);
sym = sym_lookup("ARCH", 0);
sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO;
p = getenv("ARCH");
if (p)
sym_add_default(sym, p);
sym = sym_lookup("PROJECTVERSION", 0);
sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO;
p = getenv("PROJECTVERSION");
if (p)
sym_add_default(sym, p);
sym = sym_lookup("UNAME_RELEASE", 0);
sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO;
sym_add_default(sym, uts.release);
}
enum symbol_type sym_get_type(struct symbol *sym)
{
enum symbol_type type = sym->type;
if (type == S_TRISTATE) {
if (sym_is_choice_value(sym) && sym->visible == yes)
type = S_BOOLEAN;
else if (modules_val == no)
type = S_BOOLEAN;
}
return type;
}
const char *sym_type_name(enum symbol_type type)
{
switch (type) {
case S_BOOLEAN:
return "boolean";
case S_TRISTATE:
return "tristate";
case S_INT:
return "integer";
case S_HEX:
return "hex";
case S_STRING:
return "string";
case S_UNKNOWN:
return "unknown";
case S_OTHER:
break;
}
return "???";
}
struct property *sym_get_choice_prop(struct symbol *sym)
{
struct property *prop;
for_all_choices(sym, prop)
return prop;
return NULL;
}
struct property *sym_get_default_prop(struct symbol *sym)
{
struct property *prop;
for_all_defaults(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
if (prop->visible.tri != no)
return prop;
}
return NULL;
}
struct property *sym_get_range_prop(struct symbol *sym)
{
struct property *prop;
for_all_properties(sym, prop, P_RANGE) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
if (prop->visible.tri != no)
return prop;
}
return NULL;
}
static int sym_get_range_val(struct symbol *sym, int base)
{
sym_calc_value(sym);
switch (sym->type) {
case S_INT:
base = 10;
break;
case S_HEX:
base = 16;
break;
default:
break;
}
return strtol(sym->curr.val, NULL, base);
}
static void sym_validate_range(struct symbol *sym)
{
struct property *prop;
int base, val, val2;
char str[64];
switch (sym->type) {
case S_INT:
base = 10;
break;
case S_HEX:
base = 16;
break;
default:
return;
}
prop = sym_get_range_prop(sym);
if (!prop)
return;
val = strtol(sym->curr.val, NULL, base);
val2 = sym_get_range_val(prop->expr->left.sym, base);
if (val >= val2) {
val2 = sym_get_range_val(prop->expr->right.sym, base);
if (val <= val2)
return;
}
if (sym->type == S_INT)
sprintf(str, "%d", val2);
else
sprintf(str, "0x%x", val2);
sym->curr.val = strdup(str);
}
static void sym_calc_visibility(struct symbol *sym)
{
struct property *prop;
tristate tri;
/* any prompt visible? */
tri = no;
for_all_prompts(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
tri = E_OR(tri, prop->visible.tri);
}
if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
tri = yes;
if (sym->visible != tri) {
sym->visible = tri;
sym_set_changed(sym);
}
if (sym_is_choice_value(sym))
return;
tri = no;
if (sym->rev_dep.expr)
tri = expr_calc_value(sym->rev_dep.expr);
if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
tri = yes;
if (sym->rev_dep.tri != tri) {
sym->rev_dep.tri = tri;
sym_set_changed(sym);
}
}
static struct symbol *sym_calc_choice(struct symbol *sym)
{
struct symbol *def_sym;
struct property *prop;
struct expr *e;
/* is the user choice visible? */
def_sym = sym->def[S_DEF_USER].val;
if (def_sym) {
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
return def_sym;
}
/* any of the defaults visible? */
for_all_defaults(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
if (prop->visible.tri == no)
continue;
def_sym = prop_get_symbol(prop);
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
return def_sym;
}
/* just get the first visible value */
prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr) {
def_sym = e->right.sym;
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
return def_sym;
}
/* no choice? reset tristate value */
sym->curr.tri = no;
return NULL;
}
void sym_calc_value(struct symbol *sym)
{
struct symbol_value newval, oldval;
struct property *prop;
struct expr *e;
if (!sym)
return;
if (sym->flags & SYMBOL_VALID)
return;
sym->flags |= SYMBOL_VALID;
oldval = sym->curr;
switch (sym->type) {
case S_INT:
case S_HEX:
case S_STRING:
newval = symbol_empty.curr;
break;
case S_BOOLEAN:
case S_TRISTATE:
newval = symbol_no.curr;
break;
default:
sym->curr.val = sym->name;
sym->curr.tri = no;
return;
}
if (!sym_is_choice_value(sym))
sym->flags &= ~SYMBOL_WRITE;
sym_calc_visibility(sym);
/* set default if recursively called */
sym->curr = newval;
switch (sym_get_type(sym)) {
case S_BOOLEAN:
case S_TRISTATE:
if (sym_is_choice_value(sym) && sym->visible == yes) {
prop = sym_get_choice_prop(sym);
newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
} else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym))
newval.tri = sym->def[S_DEF_USER].tri;
else if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym);
if (prop)
newval.tri = expr_calc_value(prop->expr);
}
newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri);
} else if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym);
if (prop) {
sym->flags |= SYMBOL_WRITE;
newval.tri = expr_calc_value(prop->expr);
}
}
if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
newval.tri = yes;
break;
case S_STRING:
case S_HEX:
case S_INT:
if (sym->visible != no) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym)) {
newval.val = sym->def[S_DEF_USER].val;
break;
}
}
prop = sym_get_default_prop(sym);
if (prop) {
struct symbol *ds = prop_get_symbol(prop);
if (ds) {
sym->flags |= SYMBOL_WRITE;
sym_calc_value(ds);
newval.val = ds->curr.val;
}
}
break;
default:
;
}
sym->curr = newval;
if (sym_is_choice(sym) && newval.tri == yes)
sym->curr.val = sym_calc_choice(sym);
sym_validate_range(sym);
if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
sym_set_changed(sym);
if (modules_sym == sym) {
sym_set_all_changed();
modules_val = modules_sym->curr.tri;
}
}
if (sym_is_choice(sym)) {
int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr) {
e->right.sym->flags |= flags;
if (flags & SYMBOL_CHANGED)
sym_set_changed(e->right.sym);
}
}
}
void sym_clear_all_valid(void)
{
struct symbol *sym;
int i;
for_all_symbols(i, sym)
sym->flags &= ~SYMBOL_VALID;
sym_change_count++;
if (modules_sym)
sym_calc_value(modules_sym);
}
void sym_set_changed(struct symbol *sym)
{
struct property *prop;
sym->flags |= SYMBOL_CHANGED;
for (prop = sym->prop; prop; prop = prop->next) {
if (prop->menu)
prop->menu->flags |= MENU_CHANGED;
}
}
void sym_set_all_changed(void)
{
struct symbol *sym;
int i;
for_all_symbols(i, sym)
sym_set_changed(sym);
}
bool sym_tristate_within_range(struct symbol *sym, tristate val)
{
int type = sym_get_type(sym);
if (sym->visible == no)
return false;
if (type != S_BOOLEAN && type != S_TRISTATE)
return false;
if (type == S_BOOLEAN && val == mod)
return false;
if (sym->visible <= sym->rev_dep.tri)
return false;
if (sym_is_choice_value(sym) && sym->visible == yes)
return val == yes;
return val >= sym->rev_dep.tri && val <= sym->visible;
}
bool sym_set_tristate_value(struct symbol *sym, tristate val)
{
tristate oldval = sym_get_tristate_value(sym);
if (oldval != val && !sym_tristate_within_range(sym, val))
return false;
if (!(sym->flags & SYMBOL_DEF_USER)) {
sym->flags |= SYMBOL_DEF_USER;
sym_set_changed(sym);
}
/*
* setting a choice value also resets the new flag of the choice
* symbol and all other choice values.
*/
if (sym_is_choice_value(sym) && val == yes) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
struct property *prop;
struct expr *e;
cs->def[S_DEF_USER].val = sym;
cs->flags |= SYMBOL_DEF_USER;
prop = sym_get_choice_prop(cs);
for (e = prop->expr; e; e = e->left.expr) {
if (e->right.sym->visible != no)
e->right.sym->flags |= SYMBOL_DEF_USER;
}
}
sym->def[S_DEF_USER].tri = val;
if (oldval != val)
sym_clear_all_valid();
return true;
}
tristate sym_toggle_tristate_value(struct symbol *sym)
{
tristate oldval, newval;
oldval = newval = sym_get_tristate_value(sym);
do {
switch (newval) {
case no:
newval = mod;
break;
case mod:
newval = yes;
break;
case yes:
newval = no;
break;
}
if (sym_set_tristate_value(sym, newval))
break;
} while (oldval != newval);
return newval;
}
bool sym_string_valid(struct symbol *sym, const char *str)
{
signed char ch;
switch (sym->type) {
case S_STRING:
return true;
case S_INT:
ch = *str++;
if (ch == '-')
ch = *str++;
if (!isdigit(ch))
return false;
if (ch == '0' && *str != 0)
return false;
while ((ch = *str++)) {
if (!isdigit(ch))
return false;
}
return true;
case S_HEX:
if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
str += 2;
ch = *str++;
do {
if (!isxdigit(ch))
return false;
} while ((ch = *str++));
return true;
case S_BOOLEAN:
case S_TRISTATE:
switch (str[0]) {
case 'y': case 'Y':
case 'm': case 'M':
case 'n': case 'N':
return true;
}
return false;
default:
return false;
}
}
bool sym_string_within_range(struct symbol *sym, const char *str)
{
struct property *prop;
int val;
switch (sym->type) {
case S_STRING:
return sym_string_valid(sym, str);
case S_INT:
if (!sym_string_valid(sym, str))
return false;
prop = sym_get_range_prop(sym);
if (!prop)
return true;
val = strtol(str, NULL, 10);
return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
val <= sym_get_range_val(prop->expr->right.sym, 10);
case S_HEX:
if (!sym_string_valid(sym, str))
return false;
prop = sym_get_range_prop(sym);
if (!prop)
return true;
val = strtol(str, NULL, 16);
return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
val <= sym_get_range_val(prop->expr->right.sym, 16);
case S_BOOLEAN:
case S_TRISTATE:
switch (str[0]) {
case 'y': case 'Y':
return sym_tristate_within_range(sym, yes);
case 'm': case 'M':
return sym_tristate_within_range(sym, mod);
case 'n': case 'N':
return sym_tristate_within_range(sym, no);
}
return false;
default:
return false;
}
}
bool sym_set_string_value(struct symbol *sym, const char *newval)
{
const char *oldval;
char *val;
int size;
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
switch (newval[0]) {
case 'y': case 'Y':
return sym_set_tristate_value(sym, yes);
case 'm': case 'M':
return sym_set_tristate_value(sym, mod);
case 'n': case 'N':
return sym_set_tristate_value(sym, no);
}
return false;
default:
;
}
if (!sym_string_within_range(sym, newval))
return false;
if (!(sym->flags & SYMBOL_DEF_USER)) {
sym->flags |= SYMBOL_DEF_USER;
sym_set_changed(sym);
}
oldval = sym->def[S_DEF_USER].val;
size = strlen(newval) + 1;
if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
size += 2;
sym->def[S_DEF_USER].val = val = malloc(size);
*val++ = '0';
*val++ = 'x';
} else if (!oldval || strcmp(oldval, newval))
sym->def[S_DEF_USER].val = val = malloc(size);
else
return true;
strcpy(val, newval);
free((void *)oldval);
sym_clear_all_valid();
return true;
}
const char *sym_get_string_value(struct symbol *sym)
{
tristate val;
switch (sym->type) {
case S_BOOLEAN:
case S_TRISTATE:
val = sym_get_tristate_value(sym);
switch (val) {
case no:
return "n";
case mod:
return "m";
case yes:
return "y";
}
break;
default:
;
}
return (const char *)sym->curr.val;
}
bool sym_is_changable(struct symbol *sym)
{
return sym->visible > sym->rev_dep.tri;
}
struct symbol *sym_lookup(const char *name, int isconst)
{
struct symbol *symbol;
const char *ptr;
char *new_name;
int hash = 0;
if (name) {
if (name[0] && !name[1]) {
switch (name[0]) {
case 'y': return &symbol_yes;
case 'm': return &symbol_mod;
case 'n': return &symbol_no;
}
}
for (ptr = name; *ptr; ptr++)
hash += *ptr;
hash &= 0xff;
for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
if (!strcmp(symbol->name, name)) {
if ((isconst && symbol->flags & SYMBOL_CONST) ||
(!isconst && !(symbol->flags & SYMBOL_CONST)))
return symbol;
}
}
new_name = strdup(name);
} else {
new_name = NULL;
hash = 256;
}
symbol = malloc(sizeof(*symbol));
memset(symbol, 0, sizeof(*symbol));
symbol->name = new_name;
symbol->type = S_UNKNOWN;
if (isconst)
symbol->flags |= SYMBOL_CONST;
symbol->next = symbol_hash[hash];
symbol_hash[hash] = symbol;
return symbol;
}
struct symbol *sym_find(const char *name)
{
struct symbol *symbol = NULL;
const char *ptr;
int hash = 0;
if (!name)
return NULL;
if (name[0] && !name[1]) {
switch (name[0]) {
case 'y': return &symbol_yes;
case 'm': return &symbol_mod;
case 'n': return &symbol_no;
}
}
for (ptr = name; *ptr; ptr++)
hash += *ptr;
hash &= 0xff;
for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
if (!strcmp(symbol->name, name) &&
!(symbol->flags & SYMBOL_CONST))
break;
}
return symbol;
}
struct symbol **sym_re_search(const char *pattern)
{
struct symbol *sym, **sym_arr = NULL;
int i, cnt, size;
regex_t re;
cnt = size = 0;
/* Skip if empty */
if (strlen(pattern) == 0)
return NULL;
if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE))
return NULL;
for_all_symbols(i, sym) {
if (sym->flags & SYMBOL_CONST || !sym->name)
continue;
if (regexec(&re, sym->name, 0, NULL, 0))
continue;
if (cnt + 1 >= size) {
void *tmp = sym_arr;
size += 16;
sym_arr = realloc(sym_arr, size * sizeof(struct symbol *));
if (!sym_arr) {
free(tmp);
return NULL;
}
}
sym_arr[cnt++] = sym;
}
if (sym_arr)
sym_arr[cnt] = NULL;
regfree(&re);
return sym_arr;
}
struct symbol *sym_check_deps(struct symbol *sym);
static struct symbol *sym_check_expr_deps(struct expr *e)
{
struct symbol *sym;
if (!e)
return NULL;
switch (e->type) {
case E_OR:
case E_AND:
sym = sym_check_expr_deps(e->left.expr);
if (sym)
return sym;
return sym_check_expr_deps(e->right.expr);
case E_NOT:
return sym_check_expr_deps(e->left.expr);
case E_EQUAL:
case E_UNEQUAL:
sym = sym_check_deps(e->left.sym);
if (sym)
return sym;
return sym_check_deps(e->right.sym);
case E_SYMBOL:
return sym_check_deps(e->left.sym);
default:
break;
}
printf("Oops! How to check %d?\n", e->type);
return NULL;
}
struct symbol *sym_check_deps(struct symbol *sym)
{
struct symbol *sym2;
struct property *prop;
if (sym->flags & SYMBOL_CHECK) {
printf("Warning! Found recursive dependency: %s", sym->name);
return sym;
}
if (sym->flags & SYMBOL_CHECKED)
return NULL;
sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
sym2 = sym_check_expr_deps(sym->rev_dep.expr);
if (sym2)
goto out;
for (prop = sym->prop; prop; prop = prop->next) {
if (prop->type == P_CHOICE || prop->type == P_SELECT)
continue;
sym2 = sym_check_expr_deps(prop->visible.expr);
if (sym2)
goto out;
if (prop->type != P_DEFAULT || sym_is_choice(sym))
continue;
sym2 = sym_check_expr_deps(prop->expr);
if (sym2)
goto out;
}
out:
if (sym2) {
printf(" %s", sym->name);
if (sym2 == sym) {
printf("\n");
sym2 = NULL;
}
}
sym->flags &= ~SYMBOL_CHECK;
return sym2;
}
struct property *prop_alloc(enum prop_type type, struct symbol *sym)
{
struct property *prop;
struct property **propp;
prop = malloc(sizeof(*prop));
memset(prop, 0, sizeof(*prop));
prop->type = type;
prop->sym = sym;
prop->file = current_file;
prop->lineno = zconf_lineno();
/* append property to the prop list of symbol */
if (sym) {
for (propp = &sym->prop; *propp; propp = &(*propp)->next)
;
*propp = prop;
}
return prop;
}
struct symbol *prop_get_symbol(struct property *prop)
{
if (prop->expr && (prop->expr->type == E_SYMBOL ||
prop->expr->type == E_CHOICE))
return prop->expr->left.sym;
return NULL;
}
const char *prop_get_type_name(enum prop_type type)
{
switch (type) {
case P_PROMPT:
return "prompt";
case P_COMMENT:
return "comment";
case P_MENU:
return "menu";
case P_DEFAULT:
return "default";
case P_CHOICE:
return "choice";
case P_SELECT:
return "select";
case P_RANGE:
return "range";
case P_UNKNOWN:
break;
}
return "unknown";
}

111
kconfig/util.c Normal file
View File

@ -0,0 +1,111 @@
/*
* Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org>
* Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org>
*
* Released under the terms of the GNU GPL v2.0.
*/
#include <string.h>
#include "lkc.h"
/* file already present in list? If not add it */
struct file *file_lookup(const char *name)
{
struct file *file;
for (file = file_list; file; file = file->next) {
if (!strcmp(name, file->name))
return file;
}
file = malloc(sizeof(*file));
memset(file, 0, sizeof(*file));
file->name = strdup(name);
file->next = file_list;
file_list = file;
return file;
}
/* write a dependency file as used by kbuild to track dependencies */
int file_write_dep(const char *name)
{
struct file *file;
FILE *out;
if (!name)
name = ".kconfig.d";
out = fopen("..config.tmp", "w");
if (!out)
return 1;
fprintf(out, "deps_config := \\\n");
for (file = file_list; file; file = file->next) {
if (file->next)
fprintf(out, "\t%s \\\n", file->name);
else
fprintf(out, "\t%s\n", file->name);
}
fprintf(out, "\ninclude/config/auto.conf: \\\n"
"\t$(deps_config)\n\n"
"$(deps_config): ;\n");
fclose(out);
rename("..config.tmp", name);
return 0;
}
/* Allocate initial growable sting */
struct gstr str_new(void)
{
struct gstr gs;
gs.s = malloc(sizeof(char) * 64);
gs.len = 16;
strcpy(gs.s, "\0");
return gs;
}
/* Allocate and assign growable string */
struct gstr str_assign(const char *s)
{
struct gstr gs;
gs.s = strdup(s);
gs.len = strlen(s) + 1;
return gs;
}
/* Free storage for growable string */
void str_free(struct gstr *gs)
{
if (gs->s)
free(gs->s);
gs->s = NULL;
gs->len = 0;
}
/* Append to growable string */
void str_append(struct gstr *gs, const char *s)
{
size_t l = strlen(gs->s) + strlen(s) + 1;
if (l > gs->len) {
gs->s = realloc(gs->s, l);
gs->len = l;
}
strcat(gs->s, s);
}
/* Append printf formatted string to growable string */
void str_printf(struct gstr *gs, const char *fmt, ...)
{
va_list ap;
char s[10000]; /* big enough... */
va_start(ap, fmt);
vsnprintf(s, sizeof(s), fmt, ap);
str_append(gs, s);
va_end(ap);
}
/* Retrieve value of growable string */
const char *str_get(struct gstr *gs)
{
return gs->s;
}

View File

@ -0,0 +1,242 @@
/* ANSI-C code produced by gperf version 3.0.1 */
/* Command-line: gperf */
/* Computed positions: -k'1,3' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
struct kconf_id;
/* maximum key range = 45, duplicates = 0 */
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
kconf_id_hash (register const char *str, register unsigned int len)
{
static unsigned char asso_values[] =
{
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 25, 30, 15,
0, 15, 0, 47, 5, 15, 47, 47, 30, 20,
5, 0, 25, 15, 0, 0, 10, 35, 47, 47,
5, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47
};
register int hval = len;
switch (hval)
{
default:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval;
}
struct kconf_id_strings_t
{
char kconf_id_strings_str2[sizeof("on")];
char kconf_id_strings_str6[sizeof("string")];
char kconf_id_strings_str7[sizeof("default")];
char kconf_id_strings_str8[sizeof("def_bool")];
char kconf_id_strings_str10[sizeof("range")];
char kconf_id_strings_str11[sizeof("def_boolean")];
char kconf_id_strings_str12[sizeof("def_tristate")];
char kconf_id_strings_str13[sizeof("hex")];
char kconf_id_strings_str14[sizeof("defconfig_list")];
char kconf_id_strings_str16[sizeof("option")];
char kconf_id_strings_str17[sizeof("if")];
char kconf_id_strings_str18[sizeof("optional")];
char kconf_id_strings_str20[sizeof("endif")];
char kconf_id_strings_str21[sizeof("choice")];
char kconf_id_strings_str22[sizeof("endmenu")];
char kconf_id_strings_str23[sizeof("requires")];
char kconf_id_strings_str24[sizeof("endchoice")];
char kconf_id_strings_str26[sizeof("config")];
char kconf_id_strings_str27[sizeof("modules")];
char kconf_id_strings_str28[sizeof("int")];
char kconf_id_strings_str29[sizeof("menu")];
char kconf_id_strings_str31[sizeof("prompt")];
char kconf_id_strings_str32[sizeof("depends")];
char kconf_id_strings_str33[sizeof("tristate")];
char kconf_id_strings_str34[sizeof("bool")];
char kconf_id_strings_str35[sizeof("menuconfig")];
char kconf_id_strings_str36[sizeof("select")];
char kconf_id_strings_str37[sizeof("boolean")];
char kconf_id_strings_str39[sizeof("help")];
char kconf_id_strings_str41[sizeof("source")];
char kconf_id_strings_str42[sizeof("comment")];
char kconf_id_strings_str43[sizeof("mainmenu")];
char kconf_id_strings_str46[sizeof("enable")];
};
static struct kconf_id_strings_t kconf_id_strings_contents =
{
"on",
"string",
"default",
"def_bool",
"range",
"def_boolean",
"def_tristate",
"hex",
"defconfig_list",
"option",
"if",
"optional",
"endif",
"choice",
"endmenu",
"requires",
"endchoice",
"config",
"modules",
"int",
"menu",
"prompt",
"depends",
"tristate",
"bool",
"menuconfig",
"select",
"boolean",
"help",
"source",
"comment",
"mainmenu",
"enable"
};
#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
#ifdef __GNUC__
__inline
#endif
struct kconf_id *
kconf_id_lookup (register const char *str, register unsigned int len)
{
enum
{
TOTAL_KEYWORDS = 33,
MIN_WORD_LENGTH = 2,
MAX_WORD_LENGTH = 14,
MIN_HASH_VALUE = 2,
MAX_HASH_VALUE = 46
};
static struct kconf_id wordlist[] =
{
{-1}, {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM},
{-1}, {-1}, {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_TYPE, TF_COMMAND, S_STRING},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_TRISTATE},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_TYPE, TF_COMMAND, S_HEX},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_OPT_DEFCONFIG_LIST,TF_OPTION},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_OPTION, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_IF, TF_COMMAND|TF_PARAM},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPTIONAL, TF_COMMAND},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20, T_ENDIF, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_CHOICE, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ENDMENU, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_REQUIRES, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str24, T_ENDCHOICE, TF_COMMAND},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_CONFIG, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_INT},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_PROMPT, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_DEPENDS, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_TRISTATE},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34, T_TYPE, TF_COMMAND, S_BOOLEAN},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_SELECT, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_TYPE, TF_COMMAND, S_BOOLEAN},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39, T_HELP, TF_COMMAND},
{-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SOURCE, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_COMMENT, TF_COMMAND},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43, T_MAINMENU, TF_COMMAND},
{-1}, {-1},
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = kconf_id_hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
register int o = wordlist[key].name;
if (o >= 0)
{
register const char *s = o + kconf_id_strings;
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return &wordlist[key];
}
}
}
return 0;
}

2345
kconfig/zconf.tab.c_shipped Normal file

File diff suppressed because it is too large Load Diff

306
licenses/by-sa/deed.en Normal file
View File

@ -0,0 +1,306 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Creative Commons Deed</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="deed_files/deeds.css">
<link rel="alternate" type="application/rdf+xml" href="http://creativecommons.org/licenses/by-sa/2.5/rdf">
<script language="javascript">
function setCookie(name, value, expires, path, domain, secure) {
document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
var expiry = new Date();
expiry.setTime(expiry.getTime()+(5*365*24*60*60*1000));
setCookie('lang','en', expiry, '/');
</script></head><body>
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires
rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF>
-->
<p align="center"><a href="http://creativecommons.org/">Creative Commons</a></p>
<div style="width: 620px; margin-left: auto; margin-right: auto;"><div style="text-align: center;">
This page is available in the following languages:
<br>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.bg" title="български" hreflang="bg" rel="alternate" lang="bg">български</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.ca" title="Català" hreflang="ca" rel="alternate" lang="ca">Català</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.da" title="Dansk" hreflang="da" rel="alternate" lang="da">Dansk</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.de" title="Deutsch" hreflang="de" rel="alternate" lang="de">Deutsch</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.en" title="English" hreflang="en" rel="alternate" lang="en">English</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.en_CA" title="English (CA)" hreflang="en_CA" rel="alternate" lang="en_CA">English (CA)</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.en_GB" title="English (GB)" hreflang="en_GB" rel="alternate" lang="en_GB">English (GB)</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.es" title="Castellano" hreflang="es" rel="alternate" lang="es">Castellano</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.es_AR" title="Spanish (AR)" hreflang="es_AR" rel="alternate" lang="es_AR">Castellano (AR)</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.es_CL" title="Spanish (CL)" hreflang="es_CL" rel="alternate" lang="es_CL">Español (CL)</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.es_MX" title="Spanish (MX)" hreflang="es_MX" rel="alternate" lang="es_MX">Castellano (MX)</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.eu" title="Euskara" hreflang="eu" rel="alternate" lang="eu">Euskara</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.fi" title="Suomeksi" hreflang="fi" rel="alternate" lang="fi">Suomeksi</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.fr" title="français" hreflang="fr" rel="alternate" lang="fr">français</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.fr_CA" title="French (CA)" hreflang="fr_CA" rel="alternate" lang="fr_CA">français (CA)</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.gl" title="Galego" hreflang="gl" rel="alternate" lang="gl">Galego</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.he" title="עברית" hreflang="he" rel="alternate" lang="he">עברית</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.hr" title="hrvatski" hreflang="hr" rel="alternate" lang="hr">hrvatski</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.hu" title="Magyar" hreflang="hu" rel="alternate" lang="hu">Magyar</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.it" title="Italiano" hreflang="it" rel="alternate" lang="it">Italiano</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.ja" title="日本語" hreflang="ja" rel="alternate" lang="ja">日本語</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.ko" title="한국어" hreflang="ko" rel="alternate" lang="ko">한국어</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.ms" title="Melayu" hreflang="ms" rel="alternate" lang="ms">Melayu</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.nl" title="Nederlands" hreflang="nl" rel="alternate" lang="nl">Nederlands</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.pl" title="polski" hreflang="pl" rel="alternate" lang="pl">polski</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.pt" title="Português" hreflang="pt" rel="alternate" lang="pt">Português</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.pt_PT" hreflang="pt_PT" rel="alternate" lang="pt_PT">Português (PT)</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.se" title="svenska" hreflang="se" rel="alternate" lang="se">svenska</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.sl" title="slovenski jezik" hreflang="sl" rel="alternate" lang="sl">slovenski jezik</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.zh" title="简体中文" hreflang="zh" rel="alternate" lang="zh">简体中文</a>
<a href="http://creativecommons.org/licenses/by-sa/2.5/deed.zh_TW" title="Chinese (Taiwan)" hreflang="zh_TW" rel="alternate" lang="zh_TW">華語 (台灣)</a>
</div></div>
<div id="deed">
<div align="center">
<img src="deed_files/logo_deed.gif" alt="Creative Commons Deed" border="0" height="79" vspace="14" width="280">
<p><b>Attribution-ShareAlike 2.5 </b></p>
<div class="text">
<p><strong>You are free:</strong></p>
<ul>
<li>to copy, distribute, display, and perform the work</li>
<li>to make derivative works</li>
<li>to make commercial use of the work</li>
</ul>
<p><strong>Under the following conditions:</strong></p>
<div align="center"><table class="draft" border="0" cellpadding="4" cellspacing="0" width="500">
<tbody>
<tr>
<td>
<img src="deed_files/deed.gif" alt="by" align="left" border="0" hspace="4">
</td>
<td align="left">
<div class="tiny"><strong>Attribution</strong>.
You must attribute the work in the manner specified by the author or licensor.</div>
</td>
</tr>
<tr>
<td>
<img src="deed_files/deed_002.gif" alt="sa" align="left" border="0" hspace="4">
</td>
<td align="left">
<div class="tiny"><strong>Share Alike</strong>.
If you alter, transform, or build upon this work, you may distribute
the resulting work only under a license identical to this one.</div>
</td>
</tr>
</tbody></table></div>
<ul>
<li>For any reuse or distribution, you must make clear to others the license terms of this work.</li>
<li>Any of these conditions can be waived if you get permission from the copyright holder.</li>
</ul>
<p style="margin-top: 40px;" align="center"><strong>Your fair use and other rights are in no way affected by the above.</strong></p>
<p align="center">
This is a human-readable summary of the <a href="http://creativecommons.org/licenses/by-sa/2.5/legalcode" class="fulltext">Legal Code (the full license)</a>.
</p>
<div align="center">
<a href="http://creativecommons.org/licenses/disclaimer-popup?lang=en" onclick="window.open('/licenses/disclaimer-popup?lang=en', 'characteristic_help', 'width=375,height=300,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=yes,menubar=no,status=yes'); return false;">Disclaimer</a>
<a href="http://creativecommons.org/licenses/disclaimer-popup?lang=en" onclick="window.open('/licenses/disclaimer-popup?lang=en', 'characteristic_help', 'width=375,height=300,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=yes,menubar=no,status=yes'); return false;"><img src="deed_files/popup.gif" alt="disclaimer" border="0" height="13" width="15"></a></div>
<p>&nbsp;</p>
</div>
</div>
</div>
<p>
<a href="http://creativecommons.org/about/licenses">Learn how to distribute your work using this license</a>
</p>
</body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

View File

@ -0,0 +1,54 @@
body {
margin: 0px;
padding: 0px;
font-family: verdana, arial, helvetica, sans-serif;
color: black;
background-color: white;
text-align: center;
font-size:11px;
/* part 1 of 2 centering hack */
}
#deed {
width: 620px;
padding: 15px;
margin-top: 20px;
margin-bottom: 20px;
margin-right: auto;
margin-left: auto;
/* opera does not like 'margin:20px auto' */
background: #ffc;
border: 3px groove #333;
text-align:left;
/* part 2 of 2 centering hack */
width: 620px; /* ie5win fudge begins */
voice-family: "\"}\"";
voice-family:inherit;
width: 584px;
}
html>body #content {
width: 584px; /* ie5win fudge ends */
}
.fineprint {
border:1px solid black;
padding:8px;
background:#ffffff;
text-align:justify;
}
.text, li {
font-family:verdana, sans-serif;
font-size:11px;
margin-left:20px;
margin-right:20px;
line-height:140%;
text-align:left;
}
.tiny {
font-family:verdana, sans-serif;
font-size:11px;
margin-bottom:10px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 B

378
licenses/by-sa/legalcode Normal file
View File

@ -0,0 +1,378 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html><head><title>Creative Commons Legal Code</title>
<link rel="stylesheet" type="text/css" href="legalcode_files/deeds.css">
<style type="text/css">
li {
margin-bottom:12px;
}
</style></head><body>
<p align="center"><a href="http://creativecommons.org/">Creative Commons</a></p>
<div id="deed">
<div align="center"><img src="legalcode_files/logo_code.gif" alt="Creative Commons Legal Code" border="0" height="79" vspace="14" width="280"></div>
<p align="center"><b>Attribution-ShareAlike 2.5</b></p>
<div class="text">
<div class="fineprint" style="background: transparent none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL
SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON
AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE
INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
ITS USE.</div>
<p><em>License</em> </p>
<p>THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS
PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK
OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
PROHIBITED. </p>
<p>BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU
THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH
TERMS AND CONDITIONS. </p>
<p><strong>1. Definitions</strong> </p>
<ol type="a">
<li>
<strong>"Collective Work"</strong> means a work, such as a periodical
issue, anthology or encyclopedia, in which the Work in its entirety in
unmodified form, along with a number of other contributions,
constituting separate and independent works in themselves, are
assembled into a collective whole. A work that constitutes a Collective
Work will not be considered a Derivative Work (as defined below) for
the purposes of this License.
</li>
<li>
<strong>"Derivative Work"</strong> means a work based upon the Work or
upon the Work and other pre-existing works, such as a translation,
musical arrangement, dramatization, fictionalization, motion picture
version, sound recording, art reproduction, abridgment, condensation,
or any other form in which the Work may be recast, transformed, or
adapted, except that a work that constitutes a Collective Work will not
be considered a Derivative Work for the purpose of this License. For
the avoidance of doubt, where the Work is a musical composition or
sound recording, the synchronization of the Work in timed-relation with
a moving image ("synching") will be considered a Derivative Work for
the purpose of this License.
</li>
<li>
<strong>"Licensor"</strong> means the individual or entity that offers the Work under the terms of this License.
</li>
<li>
<strong>"Original Author"</strong> means the individual or entity who created the Work.
</li>
<li>
<strong>"Work"</strong> means the copyrightable work of authorship offered under the terms of this License.
</li>
<li>
<strong>"You"</strong> means an individual or entity exercising rights
under this License who has not previously violated the terms of this
License with respect to the Work, or who has received express
permission from the Licensor to exercise rights under this License
despite a previous violation.
</li>
<li><strong>"License Elements"</strong> means the following high-level
license attributes as selected by Licensor and indicated in the title
of this License: Attribution, ShareAlike.</li></ol>
<p><strong>2. Fair Use Rights.</strong> Nothing in this license is
intended to reduce, limit, or restrict any rights arising from fair
use, first sale or other limitations on the exclusive rights of the
copyright owner under copyright law or other applicable laws. </p>
<p><strong>3. License Grant.</strong> Subject to the terms and
conditions of this License, Licensor hereby grants You a worldwide,
royalty-free, non-exclusive, perpetual (for the duration of the
applicable copyright) license to exercise the rights in the Work as
stated below: </p>
<ol type="a">
<li>
to reproduce the Work, to incorporate the Work into one or more
Collective Works, and to reproduce the Work as incorporated in the
Collective Works;
</li>
<li>
to create and reproduce Derivative Works;
</li>
<li>to distribute copies or phonorecords of, display publicly, perform
publicly, and perform publicly by means of a digital audio transmission
the Work including as incorporated in Collective Works;
</li>
<li>to distribute copies or phonorecords of, display publicly, perform
publicly, and perform publicly by means of a digital audio transmission
Derivative Works.
</li>
<li><p>For the avoidance of doubt, where the work is a musical composition:</p>
<ol type="i">
<li><strong>Performance Royalties Under Blanket Licenses</strong>.
Licensor waives the exclusive right to collect, whether individually or
via a performance rights society (e.g. ASCAP, BMI, SESAC), royalties
for the public performance or public digital performance (e.g. webcast)
of the Work.</li>
<li><strong>Mechanical Rights and Statutory Royalties</strong>.
Licensor waives the exclusive right to collect, whether individually or
via a music rights society or designated agent (e.g. Harry Fox Agency),
royalties for any phonorecord You create from the Work ("cover
version") and distribute, subject to the compulsory license created by
17 USC Section 115 of the US Copyright Act (or the equivalent in other
jurisdictions).
</li>
</ol>
</li>
<li><strong>Webcasting Rights and Statutory Royalties</strong>. For the
avoidance of doubt, where the Work is a sound recording, Licensor
waives the exclusive right to collect, whether individually or via a
performance-rights society (e.g. SoundExchange), royalties for the
public digital performance (e.g. webcast) of the Work, subject to the
compulsory license created by 17 USC Section 114 of the US Copyright
Act (or the equivalent in other jurisdictions).</li>
</ol>
<p>The above rights may be exercised in all media and formats whether
now known or hereafter devised. The above rights include the right to
make such modifications as are technically necessary to exercise the
rights in other media and formats. All rights not expressly granted by
Licensor are hereby reserved.</p>
<p><strong>4. Restrictions.</strong>The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: </p>
<ol type="a">
<li>
You may distribute, publicly display, publicly perform, or publicly
digitally perform the Work only under the terms of this License, and
You must include a copy of, or the Uniform Resource Identifier for,
this License with every copy or phonorecord of the Work You distribute,
publicly display, publicly perform, or publicly digitally perform. You
may not offer or impose any terms on the Work that alter or restrict
the terms of this License or the recipients' exercise of the rights
granted hereunder. You may not sublicense the Work. You must keep
intact all notices that refer to this License and to the disclaimer of
warranties. You may not distribute, publicly display, publicly perform,
or publicly digitally perform the Work with any technological measures
that control access or use of the Work in a manner inconsistent with
the terms of this License Agreement. The above applies to the Work as
incorporated in a Collective Work, but this does not require the
Collective Work apart from the Work itself to be made subject to the
terms of this License. If You create a Collective Work, upon notice
from any Licensor You must, to the extent practicable, remove from the
Collective Work any credit as required by clause 4(c), as requested. If
You create a Derivative Work, upon notice from any Licensor You must,
to the extent practicable, remove from the Derivative Work any credit
as required by clause 4(c), as requested.
</li>
<li>You may distribute, publicly display, publicly perform, or publicly
digitally perform a Derivative Work only under the terms of this
License, a later version of this License with the same License Elements
as this License, or a Creative Commons iCommons license that contains
the same License Elements as this License (e.g. Attribution-ShareAlike
2.5 Japan). You must include a copy of, or the Uniform Resource
Identifier for, this License or other license specified in the previous
sentence with every copy or phonorecord of each Derivative Work You
distribute, publicly display, publicly perform, or publicly digitally
perform. You may not offer or impose any terms on the Derivative Works
that alter or restrict the terms of this License or the recipients'
exercise of the rights granted hereunder, and You must keep intact all
notices that refer to this License and to the disclaimer of warranties.
You may not distribute, publicly display, publicly perform, or publicly
digitally perform the Derivative Work with any technological measures
that control access or use of the Work in a manner inconsistent with
the terms of this License Agreement. The above applies to the
Derivative Work as incorporated in a Collective Work, but this does not
require the Collective Work apart from the Derivative Work itself to be
made subject to the terms of this License.
</li>
<li>If you distribute, publicly display, publicly perform, or publicly
digitally perform the Work or any Derivative Works or Collective Works,
You must keep intact all copyright notices for the Work and provide,
reasonable to the medium or means You are utilizing: (i) the name of
the Original Author (or pseudonym, if applicable) if supplied, and/or
(ii) if the Original Author and/or Licensor designate another party or
parties (e.g. a sponsor institute, publishing entity, journal) for
attribution in Licensor's copyright notice, terms of service or by
other reasonable means, the name of such party or parties; the title of
the Work if supplied; to the extent reasonably practicable, the Uniform
Resource Identifier, if any, that Licensor specifies to be associated
with the Work, unless such URI does not refer to the copyright notice
or licensing information for the Work; and in the case of a Derivative
Work, a credit identifying the use of the Work in the Derivative Work
(e.g., "French translation of the Work by Original Author," or
"Screenplay based on original Work by Original Author"). Such credit
may be implemented in any reasonable manner; provided, however, that in
the case of a Derivative Work or Collective Work, at a minimum such
credit will appear where any other comparable authorship credit appears
and in a manner at least as prominent as such other comparable
authorship credit.
</li>
</ol>
<p><strong>5. Representations, Warranties and Disclaimer</strong></p>
<p>UNLESS OTHERWISE AGREED TO BY THE PARTIES IN WRITING, LICENSOR
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
KIND CONCERNING THE MATERIALS, EXPRESS, IMPLIED, STATUTORY OR
OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE,
MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR
THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF
ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO
NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY
NOT APPLY TO YOU.</p>
<p><strong>6. Limitation on Liability.</strong> EXCEPT TO THE EXTENT
REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU
ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL,
PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF
THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES. </p>
<p><strong>7. Termination</strong> </p>
<ol type="a">
<li>
This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Derivative Works or
Collective Works from You under this License, however, will not have
their licenses terminated provided such individuals or entities remain
in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8
will survive any termination of this License.
</li>
<li>Subject to the above terms and conditions, the license granted here
is perpetual (for the duration of the applicable copyright in the
Work). Notwithstanding the above, Licensor reserves the right to
release the Work under different license terms or to stop distributing
the Work at any time; provided, however that any such election will not
serve to withdraw this License (or any other license that has been, or
is required to be, granted under the terms of this License), and this
License will continue in full force and effect unless terminated as
stated above.
</li>
</ol>
<p><strong>8. Miscellaneous</strong> </p>
<ol type="a">
<li>Each time You distribute or publicly digitally perform the Work or
a Collective Work, the Licensor offers to the recipient a license to
the Work on the same terms and conditions as the license granted to You
under this License.
</li>
<li>Each time You distribute or publicly digitally perform a Derivative
Work, Licensor offers to the recipient a license to the original Work
on the same terms and conditions as the license granted to You under
this License.
</li>
<li>If any provision of this License is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this License, and without further action
by the parties to this agreement, such provision shall be reformed to
the minimum extent necessary to make such provision valid and
enforceable.
</li>
<li>No term or provision of this License shall be deemed waived and no
breach consented to unless such waiver or consent shall be in writing
and signed by the party to be charged with such waiver or consent.
</li>
<li>This License constitutes the entire agreement between the parties
with respect to the Work licensed here. There are no understandings,
agreements or representations with respect to the Work not specified
here. Licensor shall not be bound by any additional provisions that may
appear in any communication from You. This License may not be modified
without the mutual written agreement of the Licensor and You.
</li>
</ol>
<!-- BREAKOUT FOR CC NOTICE. NOT A PART OF THE LICENSE -->
<div class="fineprint">
<p>Creative Commons is not a party to this License, and makes no
warranty whatsoever in connection with the Work. Creative Commons will
not be liable to You or any party on any legal theory for any damages
whatsoever, including without limitation any general, special,
incidental or consequential damages arising in connection to this
license. Notwithstanding the foregoing two (2) sentences, if Creative
Commons has expressly identified itself as the Licensor hereunder, it
shall have all rights and obligations of Licensor. </p>
<p>Except for the limited purpose of indicating to the public that the
Work is licensed under the CCPL, neither party will use the trademark
"Creative Commons" or any related trademark or logo of Creative Commons
without the prior written consent of Creative Commons. Any permitted
use will be in compliance with Creative Commons' then-current trademark
usage guidelines, as may be published on its website or otherwise made
available upon request from time to time.</p>
<p>Creative Commons may be contacted at <a href="http://creativecommons.org/">http://creativecommons.org/</a>.</p>
</div>
<!-- END CC NOTICE -->
</div>
<div style="margin-bottom: 10px;" align="right"><a href="http://creativecommons.org/licenses/by-sa/2.5/" class="fulltext">« Back to Commons Deed</a></div>
</div>
</body></html>

View File

@ -0,0 +1,54 @@
body {
margin: 0px;
padding: 0px;
font-family: verdana, arial, helvetica, sans-serif;
color: black;
background-color: white;
text-align: center;
font-size:11px;
/* part 1 of 2 centering hack */
}
#deed {
width: 620px;
padding: 15px;
margin-top: 20px;
margin-bottom: 20px;
margin-right: auto;
margin-left: auto;
/* opera does not like 'margin:20px auto' */
background: #ffc;
border: 3px groove #333;
text-align:left;
/* part 2 of 2 centering hack */
width: 620px; /* ie5win fudge begins */
voice-family: "\"}\"";
voice-family:inherit;
width: 584px;
}
html>body #content {
width: 584px; /* ie5win fudge ends */
}
.fineprint {
border:1px solid black;
padding:8px;
background:#ffffff;
text-align:justify;
}
.text, li {
font-family:verdana, sans-serif;
font-size:11px;
margin-left:20px;
margin-right:20px;
line-height:140%;
text-align:left;
}
.tiny {
font-family:verdana, sans-serif;
font-size:11px;
margin-bottom:10px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

339
licenses/gpl.txt Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

504
licenses/lgpl.txt Normal file
View File

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -0,0 +1,28 @@
See http://gcc.gnu.org/PR3106
Backported from gcc-3.0.x
Fixes error
.../binutils-2.11.2/libiberty/strerror.c:468: error: conflicting types for `sys_nerr'
/usr/include/stdio.h:258: error: previous declaration of `sys_nerr'
make[1]: *** [strerror.o] Error 1
make: *** [all-libiberty] Error 2
on Mac OS X.
--- binutils-2.11.2/libiberty/strerror.c.old 2004-03-24 16:23:19.000000000 -0800
+++ binutils-2.11.2/libiberty/strerror.c 2004-03-24 16:23:48.000000000 -0800
@@ -13,6 +13,7 @@
incompatible with our later declaration, perhaps by using const
attributes. So we hide the declaration in errno.h (if any) using a
macro. */
+#define sys_nerr sys_nerr__
#define sys_errlist sys_errlist__
#endif
@@ -20,6 +21,7 @@
#include <errno.h>
#ifdef HAVE_SYS_ERRLIST
+#undef sys_nerr
#undef sys_errlist
#endif

View File

@ -0,0 +1,6 @@
The files rh62*.patch are from the Red Hat 6.2 file
binutils-2.13.90.0.2-2.src.rpm
I am trusting here that Red Hat's patches are appropriate for all CPU
types. If I'm wrong, just remove the offending patch...
- Dan Kegel

View File

@ -0,0 +1,96 @@
2002-04-20 Jakub Jelinek <jakub@redhat.com>
* elf32-sparc.c (elf32_sparc_relocate_section): Find real output
section with SEC_MERGE.
* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
--- binutils/bfd/elf32-sparc.c.jj Sat Apr 20 22:11:57 2002
+++ binutils/bfd/elf32-sparc.c Sat Apr 20 23:06:33 2002
@@ -1144,7 +1144,7 @@ elf32_sparc_relocate_section (output_bfd
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
- bfd_vma relocation, off;
+ bfd_vma relocation, off, orig_addend = 0;
bfd_reloc_status_type r;
boolean is_plt = false;
boolean unresolved_reloc;
@@ -1192,6 +1192,7 @@ elf32_sparc_relocate_section (output_bfd
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
+ orig_addend = rel->r_addend;
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
}
else
@@ -1527,6 +1528,25 @@ elf32_sparc_relocate_section (output_bfd
asection *osec;
osec = sec->output_section;
+ /* FIXME: As soon as making sections zero size
+ is possible, this if can go away. */
+ if (bfd_is_abs_section (osec)
+ && h == NULL
+ && (sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && (elf_section_data (sec)->sec_info_type
+ == ELF_INFO_TYPE_MERGE))
+ {
+ asection *msec;
+
+ msec = sec;
+ _bfd_merged_section_offset (output_bfd, &msec,
+ elf_section_data (sec)->sec_info,
+ sym->st_value + orig_addend,
+ (bfd_vma) 0);
+ osec = msec->output_section;
+ }
+
indx = elf_section_data (osec)->dynindx;
/* FIXME: we really should be able to link non-pic
--- binutils/bfd/elf64-sparc.c.jj Sat Apr 20 22:11:57 2002
+++ binutils/bfd/elf64-sparc.c Sat Apr 20 23:12:18 2002
@@ -1939,7 +1939,7 @@ sparc64_elf_relocate_section (output_bfd
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
- bfd_vma relocation, off;
+ bfd_vma relocation, off, orig_addend = 0;
bfd_reloc_status_type r;
boolean is_plt = false;
boolean unresolved_reloc;
@@ -1982,6 +1982,7 @@ sparc64_elf_relocate_section (output_bfd
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
+ orig_addend = rel->r_addend;
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
}
else
@@ -2211,6 +2212,25 @@ sparc64_elf_relocate_section (output_bfd
asection *osec;
osec = sec->output_section;
+ /* FIXME: As soon as making sections zero size
+ is possible, this if can go away. */
+ if (bfd_is_abs_section (osec)
+ && h == NULL
+ && (sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && (elf_section_data (sec)->sec_info_type
+ == ELF_INFO_TYPE_MERGE))
+ {
+ asection *msec;
+
+ msec = sec;
+ _bfd_merged_section_offset (output_bfd, &msec,
+ elf_section_data (sec)->sec_info,
+ sym->st_value + orig_addend,
+ (bfd_vma) 0);
+ osec = msec->output_section;
+ }
+
indx = elf_section_data (osec)->dynindx;
/* FIXME: we really should be able to link non-pic

View File

@ -0,0 +1,58 @@
--- binutils/ld/emulparams/elf_i386_glibc21.sh.jj Sat Aug 3 17:04:41 2002
+++ binutils/ld/emulparams/elf_i386_glibc21.sh Sat Aug 3 17:04:41 2002
@@ -0,0 +1,11 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-i386"
+TEXT_START_ADDR=0x08048000
+MAXPAGESIZE=0x1000
+NONPAGED_TEXT_START_ADDR=0x08048000
+ARCH=i386
+MACHINE=
+NOP=0x9090
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+LIB_PATH=/usr/i386-glibc21-linux/lib:/usr/local/lib
--- binutils/ld/configure.tgt.jj Thu Aug 1 20:49:32 2002
+++ binutils/ld/configure.tgt Sat Aug 3 17:06:18 2002
@@ -143,7 +143,8 @@ i[3456]86-*-linux*aout*) targ_emul=i386l
;;
i[3456]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
i[3456]86-*-linux-gnu*) targ_emul=elf_i386
- targ_extra_emuls=i386linux
+ targ_extra_emuls="i386linux elf_i386_glibc21"
+ targ_extra_libpath=elf_i386_glibc21
if test x${want64} = xtrue; then
targ_extra_emuls="$targ_extra_emuls elf_x86_64"
fi
--- binutils/ld/Makefile.am.jj Thu Aug 1 20:49:32 2002
+++ binutils/ld/Makefile.am Sat Aug 3 17:04:41 2002
@@ -181,6 +181,7 @@ ALL_EMULATIONS = \
eelf_i386.o \
eelf_i386_be.o \
eelf_i386_chaos.o \
+ eelf_i386_glibc21.o \
eelf_i386_fbsd.o \
eelf_i386_ldso.o \
eelf_s390.o \
@@ -718,6 +719,9 @@ eelf_i386_be.c: $(srcdir)/emulparams/elf
eelf_i386_chaos.c: $(srcdir)/emulparams/elf_i386_chaos.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf_chaos.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_chaos "$(tdir_elf_i386_chaos)"
+eelf_i386_glibc21.c: $(srcdir)/emulparams/elf_i386_glibc21.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_glibc21 "$(tdir_elf_i386_glibc21)"
eelf_i386_fbsd.c: $(srcdir)/emulparams/elf_i386_fbsd.sh \
$(srcdir)/emulparams/elf_i386.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
--- binutils/ld/Makefile.in.jj Thu Aug 1 20:49:32 2002
+++ binutils/ld/Makefile.in Sat Aug 3 17:07:34 2002
@@ -1197,6 +1197,9 @@ eelf_i386_be.c: $(srcdir)/emulparams/elf
eelf_i386_chaos.c: $(srcdir)/emulparams/elf_i386_chaos.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf_chaos.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_chaos "$(tdir_elf_i386_chaos)"
+eelf_i386_glibc21.c: $(srcdir)/emulparams/elf_i386_glibc21.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_glibc21 "$(tdir_elf_i386_glibc21)"
eelf_i386_fbsd.c: $(srcdir)/emulparams/elf_i386_fbsd.sh \
$(srcdir)/emulparams/elf_i386.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}

View File

@ -0,0 +1,372 @@
2002-08-03 Jakub Jelinek <jakub@redhat.com>
* config/tc-i386.c (output_insn): Save frag_now and frag_now_fix ()
at start of insn, pass it to output_disp and output_imm.
(output_disp): Added arguments. If _GLOBAL_OFFSET_TABLE_ is seen
in displacement for R_386_32 reloc, use R_386_GOTPC and compute
properly addend.
(output_imm): Added arguments. Compute properly addend for
R_386_GOTPC.
(md_apply_fix3): Remove R_386_GOTPC handling.
* testsuite/gas/i386/gotpc.s: New.
* testsuite/gas/i386/gotpc.d: New.
* testsuite/gas/i386/i386.exp: Add gotpc test.
--- binutils/gas/config/tc-i386.c.jj 2002-07-18 11:35:39.000000000 +0200
+++ binutils/gas/config/tc-i386.c 2002-08-02 21:13:18.000000000 +0200
@@ -104,8 +104,10 @@ static void output_insn PARAMS ((void));
static void output_branch PARAMS ((void));
static void output_jump PARAMS ((void));
static void output_interseg_jump PARAMS ((void));
-static void output_imm PARAMS ((void));
-static void output_disp PARAMS ((void));
+static void output_imm PARAMS ((fragS *insn_start_frag,
+ offsetT insn_start_off));
+static void output_disp PARAMS ((fragS *insn_start_frag,
+ offsetT insn_start_off));
#ifndef I386COFF
static void s_bss PARAMS ((int));
#endif
@@ -3101,14 +3103,21 @@ output_interseg_jump ()
md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2);
}
+
static void
output_insn ()
{
+ fragS *insn_start_frag;
+ offsetT insn_start_off;
+
/* Tie dwarf2 debug info to the address at the start of the insn.
We can't do this after the insn has been output as the current
frag may have been closed off. eg. by frag_var. */
dwarf2_emit_insn (0);
+ insn_start_frag = frag_now;
+ insn_start_off = frag_now_fix ();
+
/* Output jumps. */
if (i.tm.opcode_modifier & Jump)
output_branch ();
@@ -3179,10 +3188,10 @@ output_insn ()
}
if (i.disp_operands)
- output_disp ();
+ output_disp (insn_start_frag, insn_start_off);
if (i.imm_operands)
- output_imm ();
+ output_imm (insn_start_frag, insn_start_off);
}
#ifdef DEBUG386
@@ -3194,7 +3203,9 @@ output_insn ()
}
static void
-output_disp ()
+output_disp (insn_start_frag, insn_start_off)
+ fragS *insn_start_frag;
+ offsetT insn_start_off;
{
char *p;
unsigned int n;
@@ -3224,6 +3235,7 @@ output_disp ()
}
else
{
+ RELOC_ENUM reloc_type;
int size = 4;
int sign = 0;
int pcrel = (i.flags[n] & Operand_PCrel) != 0;
@@ -3266,16 +3278,50 @@ output_disp ()
}
p = frag_more (size);
+ reloc_type = reloc (size, pcrel, sign, i.reloc[n]);
+#ifdef BFD_ASSEMBLER
+ if (reloc_type == BFD_RELOC_32
+ && GOT_symbol
+ && GOT_symbol == i.op[n].disps->X_add_symbol
+ && (i.op[n].disps->X_op == O_symbol
+ || (i.op[n].disps->X_op == O_add
+ && ((symbol_get_value_expression
+ (i.op[n].disps->X_op_symbol)->X_op)
+ == O_subtract))))
+ {
+ offsetT add;
+
+ if (insn_start_frag == frag_now)
+ add = (p - frag_now->fr_literal) - insn_start_off;
+ else
+ {
+ fragS *fr;
+
+ add = insn_start_frag->fr_fix - insn_start_off;
+ for (fr = insn_start_frag->fr_next;
+ fr && fr != frag_now; fr = fr->fr_next)
+ add += fr->fr_fix;
+ add += p - frag_now->fr_literal;
+ }
+
+ /* We don't support dynamic linking on x86-64 yet. */
+ if (flag_code == CODE_64BIT)
+ abort ();
+ reloc_type = BFD_RELOC_386_GOTPC;
+ i.op[n].disps->X_add_number += add;
+ }
+#endif
fix_new_exp (frag_now, p - frag_now->fr_literal, size,
- i.op[n].disps, pcrel,
- reloc (size, pcrel, sign, i.reloc[n]));
+ i.op[n].disps, pcrel, reloc_type);
}
}
}
}
static void
-output_imm ()
+output_imm (insn_start_frag, insn_start_off)
+ fragS *insn_start_frag;
+ offsetT insn_start_off;
{
char *p;
unsigned int n;
@@ -3328,6 +3374,48 @@ output_imm ()
p = frag_more (size);
reloc_type = reloc (size, 0, sign, i.reloc[n]);
#ifdef BFD_ASSEMBLER
+ /* This is tough to explain. We end up with this one if we
+ * have operands that look like
+ * "_GLOBAL_OFFSET_TABLE_+[.-.L284]". The goal here is to
+ * obtain the absolute address of the GOT, and it is strongly
+ * preferable from a performance point of view to avoid using
+ * a runtime relocation for this. The actual sequence of
+ * instructions often look something like:
+ *
+ * call .L66
+ * .L66:
+ * popl %ebx
+ * addl $_GLOBAL_OFFSET_TABLE_+[.-.L66],%ebx
+ *
+ * The call and pop essentially return the absolute address
+ * of the label .L66 and store it in %ebx. The linker itself
+ * will ultimately change the first operand of the addl so
+ * that %ebx points to the GOT, but to keep things simple, the
+ * .o file must have this operand set so that it generates not
+ * the absolute address of .L66, but the absolute address of
+ * itself. This allows the linker itself simply treat a GOTPC
+ * relocation as asking for a pcrel offset to the GOT to be
+ * added in, and the addend of the relocation is stored in the
+ * operand field for the instruction itself.
+ *
+ * Our job here is to fix the operand so that it would add
+ * the correct offset so that %ebx would point to itself. The
+ * thing that is tricky is that .-.L66 will point to the
+ * beginning of the instruction, so we need to further modify
+ * the operand so that it will point to itself. There are
+ * other cases where you have something like:
+ *
+ * .long $_GLOBAL_OFFSET_TABLE_+[.-.L66]
+ *
+ * and here no correction would be required. Internally in
+ * the assembler we treat operands of this form as not being
+ * pcrel since the '.' is explicitly mentioned, and I wonder
+ * whether it would simplify matters to do it this way. Who
+ * knows. In earlier versions of the PIC patches, the
+ * pcrel_adjust field was used to store the correction, but
+ * since the expression is not pcrel, I felt it would be
+ * confusing to do it this way. */
+
if (reloc_type == BFD_RELOC_32
&& GOT_symbol
&& GOT_symbol == i.op[n].imms->X_add_symbol
@@ -3337,11 +3425,26 @@ output_imm ()
(i.op[n].imms->X_op_symbol)->X_op)
== O_subtract))))
{
+ offsetT add;
+
+ if (insn_start_frag == frag_now)
+ add = (p - frag_now->fr_literal) - insn_start_off;
+ else
+ {
+ fragS *fr;
+
+ add = insn_start_frag->fr_fix - insn_start_off;
+ for (fr = insn_start_frag->fr_next;
+ fr && fr != frag_now; fr = fr->fr_next)
+ add += fr->fr_fix;
+ add += p - frag_now->fr_literal;
+ }
+
/* We don't support dynamic linking on x86-64 yet. */
if (flag_code == CODE_64BIT)
abort ();
reloc_type = BFD_RELOC_386_GOTPC;
- i.op[n].imms->X_add_number += 3;
+ i.op[n].imms->X_add_number += add;
}
#endif
fix_new_exp (frag_now, p - frag_now->fr_literal, size,
@@ -4542,48 +4645,6 @@ md_apply_fix3 (fixP, valP, seg)
runtime we merely add the offset to the actual PLT entry. */
value = -4;
break;
- case BFD_RELOC_386_GOTPC:
-
-/* This is tough to explain. We end up with this one if we have
- * operands that look like "_GLOBAL_OFFSET_TABLE_+[.-.L284]". The goal
- * here is to obtain the absolute address of the GOT, and it is strongly
- * preferable from a performance point of view to avoid using a runtime
- * relocation for this. The actual sequence of instructions often look
- * something like:
- *
- * call .L66
- * .L66:
- * popl %ebx
- * addl $_GLOBAL_OFFSET_TABLE_+[.-.L66],%ebx
- *
- * The call and pop essentially return the absolute address of
- * the label .L66 and store it in %ebx. The linker itself will
- * ultimately change the first operand of the addl so that %ebx points to
- * the GOT, but to keep things simple, the .o file must have this operand
- * set so that it generates not the absolute address of .L66, but the
- * absolute address of itself. This allows the linker itself simply
- * treat a GOTPC relocation as asking for a pcrel offset to the GOT to be
- * added in, and the addend of the relocation is stored in the operand
- * field for the instruction itself.
- *
- * Our job here is to fix the operand so that it would add the correct
- * offset so that %ebx would point to itself. The thing that is tricky is
- * that .-.L66 will point to the beginning of the instruction, so we need
- * to further modify the operand so that it will point to itself.
- * There are other cases where you have something like:
- *
- * .long $_GLOBAL_OFFSET_TABLE_+[.-.L66]
- *
- * and here no correction would be required. Internally in the assembler
- * we treat operands of this form as not being pcrel since the '.' is
- * explicitly mentioned, and I wonder whether it would simplify matters
- * to do it this way. Who knows. In earlier versions of the PIC patches,
- * the pcrel_adjust field was used to store the correction, but since the
- * expression is not pcrel, I felt it would be confusing to do it this
- * way. */
-
- value -= 1;
- break;
case BFD_RELOC_386_GOT32:
case BFD_RELOC_386_TLS_GD:
case BFD_RELOC_386_TLS_LDM:
--- binutils/gas/testsuite/gas/i386/gotpc.s.jj 2002-08-02 21:17:57.000000000 +0200
+++ binutils/gas/testsuite/gas/i386/gotpc.s 2002-08-03 22:55:47.000000000 +0200
@@ -0,0 +1,40 @@
+ .text
+test:
+ addl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
+ addl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
+ addl $_GLOBAL_OFFSET_TABLE_, %eax
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ leal _GLOBAL_OFFSET_TABLE+[.-test](%eax), %ebx
+ leal _GLOBAL_OFFSET_TABLE+[.-test](%ebx), %eax
+ leal _GLOBAL_OFFSET_TABLE+[.-test](%eax), %eax
+ leal _GLOBAL_OFFSET_TABLE+[.-test](%ebx), %ebx
+ subl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
+ subl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
+ subl $_GLOBAL_OFFSET_TABLE_, %eax
+ subl $_GLOBAL_OFFSET_TABLE_, %ebx
+ orl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
+ orl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
+ orl $_GLOBAL_OFFSET_TABLE_, %eax
+ orl $_GLOBAL_OFFSET_TABLE_, %ebx
+ movl $_GLOBAL_OFFSET_TABLE_+[.-test], %eax
+ movl $_GLOBAL_OFFSET_TABLE_+[.-test], %ebx
+ movl $_GLOBAL_OFFSET_TABLE_, %eax
+ movl $_GLOBAL_OFFSET_TABLE_, %ebx
+ movl $_GLOBAL_OFFSET_TABLE_+[.-test], foo
+ movl $_GLOBAL_OFFSET_TABLE_+[.-test], %gs:foo
+ gs; movl $_GLOBAL_OFFSET_TABLE_+[.-test], foo
+ movl $_GLOBAL_OFFSET_TABLE_+[.-test], _GLOBAL_OFFSET_TABLE_
+ movl _GLOBAL_OFFSET_TABLE_+[.-test], %eax
+ movl _GLOBAL_OFFSET_TABLE_+[.-test], %ebx
+ movl %eax, _GLOBAL_OFFSET_TABLE_+[.-test]
+ movl %ebx, _GLOBAL_OFFSET_TABLE_+[.-test]
+ movl %eax, %gs:_GLOBAL_OFFSET_TABLE_+[.-test]
+ movl %ebx, %gs:_GLOBAL_OFFSET_TABLE_+[.-test]
+ gs; movl %eax, _GLOBAL_OFFSET_TABLE_+[.-test]
+ gs; movl %ebx, _GLOBAL_OFFSET_TABLE_+[.-test]
+ leal _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %eax
+ leal _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %ebx
+ movl _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %eax
+ movl _GLOBAL_OFFSET_TABLE_@GOTOFF(%ebx), %ebx
+ .long _GLOBAL_OFFSET_TABLE_+[.-test]
+ .long _GLOBAL_OFFSET_TABLE_@GOTOFF
--- binutils/gas/testsuite/gas/i386/gotpc.d.jj 2002-08-02 21:18:43.000000000 +0200
+++ binutils/gas/testsuite/gas/i386/gotpc.d 2002-08-03 23:05:43.000000000 +0200
@@ -0,0 +1,52 @@
+#objdump: -drw
+#name: i386 gotpc
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+000 <test>:
+ 0: 05 01 00 00 00 [ ]*add \$0x1,%eax 1: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 5: 81 c3 07 00 00 00 [ ]*add \$0x7,%ebx 7: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ b: 05 01 00 00 00 [ ]*add \$0x1,%eax c: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 10: 81 c3 02 00 00 00 [ ]*add \$0x2,%ebx 12: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 16: 8d 98 16 00 00 00 [ ]*lea 0x16\(%eax\),%ebx 18: (R_386_)?(dir)?32 _GLOBAL_OFFSET_TABLE
+ 1c: 8d 83 1c 00 00 00 [ ]*lea 0x1c\(%ebx\),%eax 1e: (R_386_)?(dir)?32 _GLOBAL_OFFSET_TABLE
+ 22: 8d 80 22 00 00 00 [ ]*lea 0x22\(%eax\),%eax 24: (R_386_)?(dir)?32 _GLOBAL_OFFSET_TABLE
+ 28: 8d 9b 28 00 00 00 [ ]*lea 0x28\(%ebx\),%ebx 2a: (R_386_)?(dir)?32 _GLOBAL_OFFSET_TABLE
+ 2e: 2d 2f 00 00 00 [ ]*sub \$0x2f,%eax 2f: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 33: 81 eb 35 00 00 00 [ ]*sub \$0x35,%ebx 35: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 39: 2d 01 00 00 00 [ ]*sub \$0x1,%eax 3a: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 3e: 81 eb 02 00 00 00 [ ]*sub \$0x2,%ebx 40: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 44: 0d 45 00 00 00 [ ]*or \$0x45,%eax 45: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 49: 81 cb 4b 00 00 00 [ ]*or \$0x4b,%ebx 4b: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 4f: 0d 01 00 00 00 [ ]*or \$0x1,%eax 50: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 54: 81 cb 02 00 00 00 [ ]*or \$0x2,%ebx 56: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 5a: b8 5b 00 00 00 [ ]*mov \$0x5b,%eax 5b: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 5f: bb 60 00 00 00 [ ]*mov \$0x60,%ebx 60: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 64: b8 01 00 00 00 [ ]*mov \$0x1,%eax 65: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 69: bb 01 00 00 00 [ ]*mov \$0x1,%ebx 6a: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 6e: c7 05 00 00 00 00 74 00 00 00 [ ]*movl \$0x74,0x0 70: (R_386_)?(dir)?32 foo
+[ ]*74: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 78: 65 c7 05 00 00 00 00 7f 00 00 00 [ ]*movl \$0x7f,%gs:0x0 7b: (R_386_)?(dir)?32 foo
+[ ]*7f: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 83: 65 c7 05 00 00 00 00 8a 00 00 00 [ ]*movl \$0x8a,%gs:0x0 86: (R_386_)?(dir)?32 foo
+[ ]*8a: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 8e: c7 05 02 00 00 00 94 00 00 00 [ ]*movl \$0x94,0x2 90: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+[ ]*94: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 98: a1 99 00 00 00 [ ]*mov 0x99,%eax 99: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ 9d: 8b 1d 9f 00 00 00 [ ]*mov 0x9f,%ebx 9f: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ a3: a3 a4 00 00 00 [ ]*mov %eax,0xa4 a4: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ a8: 89 1d aa 00 00 00 [ ]*mov %ebx,0xaa aa: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ ae: 65 a3 b0 00 00 00 [ ]*mov %eax,%gs:0xb0 b0: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ b4: 65 89 1d b7 00 00 00 [ ]*mov %ebx,%gs:0xb7 b7: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ bb: 65 a3 bd 00 00 00 [ ]*mov %eax,%gs:0xbd bd: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ c1: 65 89 1d c4 00 00 00 [ ]*mov %ebx,%gs:0xc4 c4: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ c8: 8d 83 00 00 00 00 [ ]*lea 0x0\(%ebx\),%eax ca: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
+ ce: 8d 9b 00 00 00 00 [ ]*lea 0x0\(%ebx\),%ebx d0: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
+ d4: 8b 83 00 00 00 00 [ ]*mov 0x0\(%ebx\),%eax d6: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
+ da: 8b 9b 00 00 00 00 [ ]*mov 0x0\(%ebx\),%ebx dc: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
+ e0: e0 00 [ ]*loopne e2 <test\+0xe2> e0: (R_386_)?GOTPC _GLOBAL_OFFSET_TABLE_
+ e2: 00 00 [ ]*add %al,\(%eax\)
+ e4: 00 00 [ ]*add %al,\(%eax\) e4: (R_386_)?GOTOFF _GLOBAL_OFFSET_TABLE_
+ ...
--- binutils/gas/testsuite/gas/i386/i386.exp.jj 2002-07-18 11:35:39.000000000 +0200
+++ binutils/gas/testsuite/gas/i386/i386.exp 2002-08-02 21:57:46.000000000 +0200
@@ -53,6 +53,7 @@ if [expr ([istarget "i*86-*-*"] || [ist
run_dump_test "jump"
run_dump_test "ssemmx2"
run_dump_test "sse2"
+ run_dump_test "gotpc"
# PIC is only supported on ELF targets.
if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"] )

View File

@ -0,0 +1,27 @@
2002-08-07 Jakub Jelinek <jakub@redhat.com>
* elf32-i386.c (elf_i386_relocate_section): Fill in proper addend
for R_386_TLS_TPOFF32 relocs against symndx 0.
--- binutils/bfd/elf32-i386.c.jj 2002-07-30 16:14:55.000000000 +0200
+++ binutils/bfd/elf32-i386.c 2002-08-07 23:41:48.000000000 +0200
@@ -2561,13 +2567,17 @@ elf_i386_relocate_section (output_bfd, i
outrel.r_offset = (htab->sgot->output_section->vma
+ htab->sgot->output_offset + off);
- bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + off);
indx = h && h->dynindx != -1 ? h->dynindx : 0;
if (r_type == R_386_TLS_GD)
dr_type = R_386_TLS_DTPMOD32;
else
dr_type = R_386_TLS_TPOFF32;
+ if (dr_type == R_386_TLS_TPOFF32 && indx == 0)
+ bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
+ htab->sgot->contents + off);
+ else
+ bfd_put_32 (output_bfd, 0,
+ htab->sgot->contents + off);
outrel.r_info = ELF32_R_INFO (indx, dr_type);
loc = (Elf32_External_Rel *) htab->srelgot->contents;
loc += htab->srelgot->reloc_count++;

View File

@ -0,0 +1,11 @@
--- orig/Makefile.in 2004-05-12 18:22:30.000000000 -0700
+++ binutils-2.14.90.0.5/Makefile.in 2004-05-12 18:26:19.000000000 -0700
@@ -24384,6 +24384,8 @@
# Demangler depends on libiberty.
configure-demangler: maybe-configure-libiberty
all-demangler: maybe-all-libiberty
+configure-build-demangler: maybe-configure-build-libiberty
+all-build-demangler: maybe-all-build-libiberty
# The new demangler, which is included in libiberty, is written in C++.
# A working C++ compiler is required. For the target demangler, it may

View File

@ -0,0 +1,38 @@
Message-Id: <200307311239.h6VCdNe27056@r-rr.iij4u.or.jp>
To: dank@kegel.com
Cc: kkojima@rr.iij4u.or.jp
Subject: Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails
with "libc.so: text relocations used" in glibc-2.3.2 for sh4)
In-Reply-To: Your message of "Wed, 30 Jul 2003 21:55:54 -0700"
<3F28A15A.5010400@kegel.com>
References: <3F28A15A.5010400@kegel.com>
Date: Thu, 31 Jul 2003 21:47:38 +0900
From: kaz Kojima <kkojima@rr.iij4u.or.jp>
Dan Kegel <dank@kegel.com> wrote:
>> I'll give binutils-2.14.90.0.5 a shot, then.
>
> No joy - same problem. Guess I'll take this up on binutils and/or libc-alpha.
Please try the patch below, though it's a diff against the current
binutils CVS.
Regards,
kaz
--
diff -u3p ORIG/src/bfd/elf32-sh.c LOCAL/src/bfd/elf32-sh.c
--- src/bfd/elf32-sh.c.old Fri Jul 25 14:46:58 2003
+++ src/bfd/elf32-sh.c Thu Jul 31 21:09:38 2003
@@ -6497,8 +6497,10 @@ sh_elf_check_relocs (bfd *abfd, struct b
sreloc, 2))
return FALSE;
}
+#if 0
if (sec->flags & SEC_READONLY)
info->flags |= DF_TEXTREL;
+#endif
elf_section_data (sec)->sreloc = sreloc;
}

View File

@ -0,0 +1,11 @@
--- orig/Makefile.in 2004-05-12 18:22:30.000000000 -0700
+++ binutils-2.14.90.0.5/Makefile.in 2004-05-12 18:26:19.000000000 -0700
@@ -24384,6 +24384,8 @@
# Demangler depends on libiberty.
configure-demangler: maybe-configure-libiberty
all-demangler: maybe-all-libiberty
+configure-build-demangler: maybe-configure-build-libiberty
+all-build-demangler: maybe-all-build-libiberty
# The new demangler, which is included in libiberty, is written in C++.
# A working C++ compiler is required. For the target demangler, it may

View File

@ -0,0 +1,101 @@
Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
Fixes
localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
Paths adjusted to match crosstool's patcher.
Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
From: Andreas Schwab <schwab at suse dot de>
To: Nathan Sidwell <nathan at codesourcery dot com>
Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
Date: Fri, 23 Apr 2004 22:27:19 +0200
Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
Nathan Sidwell <nathan@codesourcery.com> writes:
> Index: read.c
> ===================================================================
> RCS file: /cvs/src/src/gas/read.c,v
> retrieving revision 1.76
> diff -c -3 -p -r1.76 read.c
> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
> --- read.c 18 Mar 2004 09:56:05 -0000
> *************** read_a_source_file (char *name)
> *** 1053,1059 ****
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! ignore_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
> --- 1053,1059 ----
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! demand_empty_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
This means that the unknown character is no longer ignored, despite the
comment. As a side effect a line starting with a line comment character
not followed by APP in NO_APP mode now triggers an error instead of just a
warning, breaking builds of glibc on m68k-linux. Earlier in
read_a_source_file where #APP is handled there is another comment that
claims that unknown comments are ignored, when in fact they aren't (only
the initial line comment character is skipped).
Note that the presence of #APP will mess up the line counters, but
that appears to be difficult to fix.
Andreas.
2004-04-23 Andreas Schwab <schwab@suse.de>
* read.c (read_a_source_file): Ignore unknown text after line
comment character. Fix misleading comment.
--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
@@ -1,6 +1,6 @@
/* read.c - read a source file -
Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -950,10 +950,14 @@ read_a_source_file (char *name)
unsigned int new_length;
char *tmp_buf = 0;
- bump_line_counters ();
s = input_line_pointer;
if (strncmp (s, "APP\n", 4))
- continue; /* We ignore it */
+ {
+ /* We ignore it */
+ ignore_rest_of_line ();
+ continue;
+ }
+ bump_line_counters ();
s += 4;
sb_new (&sbuf);
@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
continue;
#endif
input_line_pointer--;
- /* Report unknown char as ignored. */
+ /* Report unknown char as error. */
demand_empty_rest_of_line ();
}
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

View File

@ -0,0 +1,192 @@
See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15247
Fixes spurious error
/tmp/ccvNi4ou.s: Assembler messages:
/tmp/ccvNi4ou.s:2310: Error: Illegal operands: There are only 32 single precision f registers; [0-31]
make[2]: *** [/home/dank/wk/crosstool-0.28-rc10/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/math/dosincos.o] Error 1
when compiling glibc's dosincos.c with gcc-3.4.0
===================================================================
RCS file: /cvs/src/src/opcodes/sparc-opc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- src/opcodes/sparc-opc.c 2004/01/18 23:46:32 1.9
+++ src/opcodes/sparc-opc.c 2004/04/20 10:23:51 1.10
@@ -1273,110 +1273,72 @@
#define FM_DF 2 /* v9 */
#define FM_QF 3 /* v9 */
-#define fmovicc(opcode, fpsize, cond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags, v9 }
-
-#define fmovfcc(opcode, fpsize, fcond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags, v9 }
+#define fmoviccx(opcode, fpsize, args, cond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags, v9 }
+
+#define fmovfccx(opcode, fpsize, args, fcond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags, v9 }
/* FIXME: use fmovicc/fmovfcc? */ /* v9 */
-#define fmovcc(opcode, fpsize, cond, fcond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags | F_FLOAT, v9 }
-
-/* v9 */ fmovcc ("fmovda", FM_DF, CONDA, FCONDA, 0),
-/* v9 */ fmovcc ("fmovqa", FM_QF, CONDA, FCONDA, 0),
-/* v9 */ fmovcc ("fmovsa", FM_SF, CONDA, FCONDA, 0),
-/* v9 */ fmovicc ("fmovdcc", FM_DF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovqcc", FM_QF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovscc", FM_SF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovdcs", FM_DF, CONDCS, 0),
-/* v9 */ fmovicc ("fmovqcs", FM_QF, CONDCS, 0),
-/* v9 */ fmovicc ("fmovscs", FM_SF, CONDCS, 0),
-/* v9 */ fmovcc ("fmovde", FM_DF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovqe", FM_QF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovse", FM_SF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovdg", FM_DF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovqg", FM_QF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovsg", FM_SF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovdge", FM_DF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovcc ("fmovqge", FM_QF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovcc ("fmovsge", FM_SF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovicc ("fmovdgeu", FM_DF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovqgeu", FM_QF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovsgeu", FM_SF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovdgu", FM_DF, CONDGU, 0),
-/* v9 */ fmovicc ("fmovqgu", FM_QF, CONDGU, 0),
-/* v9 */ fmovicc ("fmovsgu", FM_SF, CONDGU, 0),
-/* v9 */ fmovcc ("fmovdl", FM_DF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovql", FM_QF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovsl", FM_SF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovdle", FM_DF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovcc ("fmovqle", FM_QF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovcc ("fmovsle", FM_SF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovicc ("fmovdleu", FM_DF, CONDLEU, 0),
-/* v9 */ fmovicc ("fmovqleu", FM_QF, CONDLEU, 0),
-/* v9 */ fmovicc ("fmovsleu", FM_SF, CONDLEU, 0),
-/* v9 */ fmovfcc ("fmovdlg", FM_DF, FCONDLG, 0),
-/* v9 */ fmovfcc ("fmovqlg", FM_QF, FCONDLG, 0),
-/* v9 */ fmovfcc ("fmovslg", FM_SF, FCONDLG, 0),
-/* v9 */ fmovicc ("fmovdlu", FM_DF, CONDLU, F_ALIAS),
-/* v9 */ fmovicc ("fmovqlu", FM_QF, CONDLU, F_ALIAS),
-/* v9 */ fmovicc ("fmovslu", FM_SF, CONDLU, F_ALIAS),
-/* v9 */ fmovcc ("fmovdn", FM_DF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovqn", FM_QF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovsn", FM_SF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovdne", FM_DF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovcc ("fmovqne", FM_QF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovcc ("fmovsne", FM_SF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovicc ("fmovdneg", FM_DF, CONDNEG, 0),
-/* v9 */ fmovicc ("fmovqneg", FM_QF, CONDNEG, 0),
-/* v9 */ fmovicc ("fmovsneg", FM_SF, CONDNEG, 0),
-/* v9 */ fmovcc ("fmovdnz", FM_DF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovqnz", FM_QF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovsnz", FM_SF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovfcc ("fmovdo", FM_DF, FCONDO, 0),
-/* v9 */ fmovfcc ("fmovqo", FM_QF, FCONDO, 0),
-/* v9 */ fmovfcc ("fmovso", FM_SF, FCONDO, 0),
-/* v9 */ fmovicc ("fmovdpos", FM_DF, CONDPOS, 0),
-/* v9 */ fmovicc ("fmovqpos", FM_QF, CONDPOS, 0),
-/* v9 */ fmovicc ("fmovspos", FM_SF, CONDPOS, 0),
-/* v9 */ fmovfcc ("fmovdu", FM_DF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovqu", FM_QF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovsu", FM_SF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovdue", FM_DF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovque", FM_QF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovsue", FM_SF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovdug", FM_DF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovqug", FM_QF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovsug", FM_SF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovduge", FM_DF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovquge", FM_QF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovsuge", FM_SF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovdul", FM_DF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovqul", FM_QF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovsul", FM_SF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovdule", FM_DF, FCONDULE, 0),
-/* v9 */ fmovfcc ("fmovqule", FM_QF, FCONDULE, 0),
-/* v9 */ fmovfcc ("fmovsule", FM_SF, FCONDULE, 0),
-/* v9 */ fmovicc ("fmovdvc", FM_DF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovqvc", FM_QF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovsvc", FM_SF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovdvs", FM_DF, CONDVS, 0),
-/* v9 */ fmovicc ("fmovqvs", FM_QF, CONDVS, 0),
-/* v9 */ fmovicc ("fmovsvs", FM_SF, CONDVS, 0),
-/* v9 */ fmovcc ("fmovdz", FM_DF, CONDZ, FCONDZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovqz", FM_QF, CONDZ, FCONDZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovsz", FM_SF, CONDZ, FCONDZ, F_ALIAS),
-
+#define fmovccx(opcode, fpsize, args, cond, fcond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags | F_FLOAT, v9 }
+
+#define fmovicc(suffix, cond, flags) /* v9 */ \
+fmoviccx("fmovd" suffix, FM_DF, "B,H", cond, flags), \
+fmoviccx("fmovq" suffix, FM_QF, "R,J", cond, flags), \
+fmoviccx("fmovs" suffix, FM_SF, "f,g", cond, flags)
+
+#define fmovfcc(suffix, fcond, flags) /* v9 */ \
+fmovfccx("fmovd" suffix, FM_DF, "B,H", fcond, flags), \
+fmovfccx("fmovq" suffix, FM_QF, "R,J", fcond, flags), \
+fmovfccx("fmovs" suffix, FM_SF, "f,g", fcond, flags)
+
+#define fmovcc(suffix, cond, fcond, flags) /* v9 */ \
+fmovccx("fmovd" suffix, FM_DF, "B,H", cond, fcond, flags), \
+fmovccx("fmovq" suffix, FM_QF, "R,J", cond, fcond, flags), \
+fmovccx("fmovs" suffix, FM_SF, "f,g", cond, fcond, flags)
+
+/* v9 */ fmovcc ("a", CONDA, FCONDA, 0),
+/* v9 */ fmovicc ("cc", CONDCC, 0),
+/* v9 */ fmovicc ("cs", CONDCS, 0),
+/* v9 */ fmovcc ("e", CONDE, FCONDE, 0),
+/* v9 */ fmovcc ("g", CONDG, FCONDG, 0),
+/* v9 */ fmovcc ("ge", CONDGE, FCONDGE, 0),
+/* v9 */ fmovicc ("geu", CONDGEU, F_ALIAS),
+/* v9 */ fmovicc ("gu", CONDGU, 0),
+/* v9 */ fmovcc ("l", CONDL, FCONDL, 0),
+/* v9 */ fmovcc ("le", CONDLE, FCONDLE, 0),
+/* v9 */ fmovicc ("leu", CONDLEU, 0),
+/* v9 */ fmovfcc ("lg", FCONDLG, 0),
+/* v9 */ fmovicc ("lu", CONDLU, F_ALIAS),
+/* v9 */ fmovcc ("n", CONDN, FCONDN, 0),
+/* v9 */ fmovcc ("ne", CONDNE, FCONDNE, 0),
+/* v9 */ fmovicc ("neg", CONDNEG, 0),
+/* v9 */ fmovcc ("nz", CONDNZ, FCONDNZ, F_ALIAS),
+/* v9 */ fmovfcc ("o", FCONDO, 0),
+/* v9 */ fmovicc ("pos", CONDPOS, 0),
+/* v9 */ fmovfcc ("u", FCONDU, 0),
+/* v9 */ fmovfcc ("ue", FCONDUE, 0),
+/* v9 */ fmovfcc ("ug", FCONDUG, 0),
+/* v9 */ fmovfcc ("uge", FCONDUGE, 0),
+/* v9 */ fmovfcc ("ul", FCONDUL, 0),
+/* v9 */ fmovfcc ("ule", FCONDULE, 0),
+/* v9 */ fmovicc ("vc", CONDVC, 0),
+/* v9 */ fmovicc ("vs", CONDVS, 0),
+/* v9 */ fmovcc ("z", CONDZ, FCONDZ, F_ALIAS),
+
+#undef fmoviccx /* v9 */
+#undef fmovfccx /* v9 */
+#undef fmovccx /* v9 */
#undef fmovicc /* v9 */
#undef fmovfcc /* v9 */
#undef fmovcc /* v9 */

View File

@ -0,0 +1,38 @@
Message-Id: <200307311239.h6VCdNe27056@r-rr.iij4u.or.jp>
To: dank@kegel.com
Cc: kkojima@rr.iij4u.or.jp
Subject: Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails
with "libc.so: text relocations used" in glibc-2.3.2 for sh4)
In-Reply-To: Your message of "Wed, 30 Jul 2003 21:55:54 -0700"
<3F28A15A.5010400@kegel.com>
References: <3F28A15A.5010400@kegel.com>
Date: Thu, 31 Jul 2003 21:47:38 +0900
From: kaz Kojima <kkojima@rr.iij4u.or.jp>
Dan Kegel <dank@kegel.com> wrote:
>> I'll give binutils-2.14.90.0.5 a shot, then.
>
> No joy - same problem. Guess I'll take this up on binutils and/or libc-alpha.
Please try the patch below, though it's a diff against the current
binutils CVS.
Regards,
kaz
--
diff -u3p ORIG/src/bfd/elf32-sh.c LOCAL/src/bfd/elf32-sh.c
--- src/bfd/elf32-sh.c.old Fri Jul 25 14:46:58 2003
+++ src/bfd/elf32-sh.c Thu Jul 31 21:09:38 2003
@@ -6497,8 +6497,10 @@ sh_elf_check_relocs (bfd *abfd, struct b
sreloc, 2))
return FALSE;
}
+#if 0
if (sec->flags & SEC_READONLY)
info->flags |= DF_TEXTREL;
+#endif
elf_section_data (sec)->sreloc = sreloc;
}

View File

@ -0,0 +1,118 @@
From http://sources.redhat.com/ml/binutils/2004-08/msg00190.html
Date: Tue, 17 Aug 2004 12:04:29 +0200
From: Jakub Jelinek <jakub at redhat dot com>
To: binutils at sources dot redhat dot com
Subject: [PATCH] Fix `defined in discarded section' errors when building ia64 gcc
Message-ID: <20040817100429.GL30497@sunsite.ms.mff.cuni.cz>
Reply-To: Jakub Jelinek <jakub at redhat dot com>
References: <20040817090201.GK30497@sunsite.ms.mff.cuni.cz>
In-Reply-To: <20040817090201 dot GK30497 at sunsite dot ms dot mff dot cuni dot cz>
On Tue, Aug 17, 2004 at 11:02:01AM +0200, Jakub Jelinek wrote:
> Current gcc 3.4.x (at least gcc-3_4-rhl-branch) doesn't build with CVS
> binutils (nor 2.15.91.0.2).
> The problem is that libstdc++.so linking fails with:
> `.gnu.linkonce.t._ZNSdD2Ev' referenced in section `.gnu.linkonce.ia64unw._ZNSdD2Ev' of .libs/sstream-inst.o: defined in discarded section `.gnu.linkonce.t._ZNSdD2Ev' of .libs/sstream-inst.o
> The problem is that both io-inst.s and sstream-inst.s have
> .gnu.linkonce.t._ZNSdD2Ev definition, but because io-inst.cc
> also instantiates some templates sstream-inst.cc doesn't instantiate,
> the inliner can do a better job in io-inst.cc.
> The result is that _ZNSdD2Ev in io-inst.cc is a leaf routine, while
> it is not in sstream-inst.cc (in assembly,
> _ZNSdD2Ev in io-inst.s starts with .prologue and no .save directives,
> while _ZNSdD2Ev] in sstream-inst.s has .prologue 12, 35 and some
> .save directives.
> IA-64 ABI allows leaf routines to have no unwind section at all,
> which means .gnu.linkonce.ia64unw._ZNSdD2Ev is not created in
> io-inst.o at all and as .gnu.linkonce.t._ZNSdD2Ev comes first
> and wins, .gnu.linkonce.ia64unw._ZNSdD2Ev in sstream.o suddenly
> references a discarded section.
>
> Not sure what should be done here, but certainly the compiler
> isn't at fault here, it is a binutils problem.
> One fix could be to create empty .gnu.linkonce.ia64unw.* section
> in assembler, another special case ia64 unwind sections in the linker.
Here is a patch for the first possibility.
It certainly makes libstdc++.so to link and even the unwind info looks
good on brief skimming.
2004-08-17 Jakub Jelinek <jakub@redhat.com>
* config/tc-ia64.c (start_unwind_section): Add linkonce_empty
argument, don't do anything if current section is not
.gnu.linkonce.t.* and linkonce_empty is set.
(generate_unwind_image, dot_endp): Adjust callers, call
start_unwind_section (*, 1) if nothing will be put into the
section.
--- binutils/gas/config/tc-ia64.c.jj 2004-07-30 11:42:24.000000000 +0200
+++ binutils/gas/config/tc-ia64.c 2004-08-17 13:45:04.288173205 +0200
@@ -1,5 +1,6 @@
/* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of GAS, the GNU Assembler.
@@ -3297,7 +3298,7 @@ static char *special_linkonce_name[] =
};
static void
-start_unwind_section (const segT text_seg, int sec_index)
+start_unwind_section (const segT text_seg, int sec_index, int linkonce_empty)
{
/*
Use a slightly ugly scheme to derive the unwind section names from
@@ -3359,6 +3360,8 @@ start_unwind_section (const segT text_se
prefix = special_linkonce_name [sec_index - SPECIAL_SECTION_UNWIND];
suffix += sizeof (".gnu.linkonce.t.") - 1;
}
+ else if (linkonce_empty)
+ return;
prefix_len = strlen (prefix);
suffix_len = strlen (suffix);
@@ -3444,7 +3447,7 @@ generate_unwind_image (const segT text_s
expressionS exp;
bfd_reloc_code_real_type reloc;
- start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO);
+ start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO, 0);
/* Make sure the section has 4 byte alignment for ILP32 and
8 byte alignment for LP64. */
@@ -3485,6 +3488,8 @@ generate_unwind_image (const segT text_s
unwind.personality_routine = 0;
}
}
+ else
+ start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO, 1);
free_saved_prologue_counts ();
unwind.list = unwind.tail = unwind.current_entry = NULL;
@@ -4164,7 +4169,7 @@ dot_endp (dummy)
subseg_set (md.last_text_seg, 0);
unwind.proc_end = expr_build_dot ();
- start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND);
+ start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND, 0);
/* Make sure that section has 4 byte alignment for ILP32 and
8 byte alignment for LP64. */
@@ -4204,6 +4209,9 @@ dot_endp (dummy)
bytes_per_address);
}
+ else
+ start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND, 1);
+
subseg_set (saved_seg, saved_subseg);
/* Parse names of main and alternate entry points and set symbol sizes. */
Jakub

View File

@ -0,0 +1,74 @@
See http://sources.redhat.com/ml/binutils/2004-08/msg00256.html
Date: Fri, 20 Aug 2004 21:13:43 -0400
From: Daniel Jacobowitz <drow at false dot org>
To: binutils at sources dot redhat dot com
Subject: Re: Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
Message-ID: <20040821011342.GA30319@nevyn.them.org>
Mail-Followup-To: binutils at sources dot redhat dot com
References: <20040818145518.GA9774@nevyn.them.org> <20040819055040.GA11820@lucon.org> <20040819080034.GE21716@bubble.modra.org> <20040820173240.GA17678@nevyn.them.org> <20040821003737.GB16016@bubble.modra.org>
In-Reply-To: <20040821003737 dot GB16016 at bubble dot modra dot org>
On Sat, Aug 21, 2004 at 10:07:38AM +0930, Alan Modra wrote:
> On Fri, Aug 20, 2004 at 01:32:40PM -0400, Daniel Jacobowitz wrote:
> > Thanks. How's this?
>
> As you might have guessed from my rather slack review of your previous
> patch, I trust you enough to give the OK without proper review. But
> since you asked... :)
Checked in as so.
--
Daniel Jacobowitz
2004-08-20 Daniel Jacobowitz <dan@debian.org>
* elflink.c (_bfd_elf_section_already_linked): Handle
SEC_LINK_DUPLICATES_SAME_CONTENTS.
Index: elflink.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/bfd/elflink.c,v
retrieving revision 1.97
diff -u -p -r1.97 elflink.c
--- binutils/bfd/elflink.c 18 Aug 2004 02:45:42 -0000 1.97
+++ binutils/bfd/elflink.c 21 Aug 2004 00:59:08 -0000
@@ -9366,6 +9366,36 @@ _bfd_elf_section_already_linked (bfd *ab
(_("%B: duplicate section `%A' has different size\n"),
abfd, sec);
break;
+
+ case SEC_LINK_DUPLICATES_SAME_CONTENTS:
+ if (sec->size != l->sec->size)
+ (*_bfd_error_handler)
+ (_("%B: duplicate section `%A' has different size\n"),
+ abfd, sec);
+ else if (sec->size != 0)
+ {
+ bfd_byte *sec_contents, *l_sec_contents;
+
+ if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
+ (*_bfd_error_handler)
+ (_("%B: warning: could not read contents of section `%A'\n"),
+ abfd, sec);
+ else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec,
+ &l_sec_contents))
+ (*_bfd_error_handler)
+ (_("%B: warning: could not read contents of section `%A'\n"),
+ l->sec->owner, l->sec);
+ else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0)
+ (*_bfd_error_handler)
+ (_("%B: warning: duplicate section `%A' has different contents\n"),
+ abfd, sec);
+
+ if (sec_contents)
+ free (sec_contents);
+ if (l_sec_contents)
+ free (l_sec_contents);
+ }
+ break;
}
/* Set the output_section field so that lang_add_section

View File

@ -0,0 +1,101 @@
Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
Fixes
localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
Paths adjusted to match crosstool's patcher.
Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
From: Andreas Schwab <schwab at suse dot de>
To: Nathan Sidwell <nathan at codesourcery dot com>
Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
Date: Fri, 23 Apr 2004 22:27:19 +0200
Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
Nathan Sidwell <nathan@codesourcery.com> writes:
> Index: read.c
> ===================================================================
> RCS file: /cvs/src/src/gas/read.c,v
> retrieving revision 1.76
> diff -c -3 -p -r1.76 read.c
> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
> --- read.c 18 Mar 2004 09:56:05 -0000
> *************** read_a_source_file (char *name)
> *** 1053,1059 ****
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! ignore_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
> --- 1053,1059 ----
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! demand_empty_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
This means that the unknown character is no longer ignored, despite the
comment. As a side effect a line starting with a line comment character
not followed by APP in NO_APP mode now triggers an error instead of just a
warning, breaking builds of glibc on m68k-linux. Earlier in
read_a_source_file where #APP is handled there is another comment that
claims that unknown comments are ignored, when in fact they aren't (only
the initial line comment character is skipped).
Note that the presence of #APP will mess up the line counters, but
that appears to be difficult to fix.
Andreas.
2004-04-23 Andreas Schwab <schwab@suse.de>
* read.c (read_a_source_file): Ignore unknown text after line
comment character. Fix misleading comment.
--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
@@ -1,6 +1,6 @@
/* read.c - read a source file -
Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -950,10 +950,14 @@ read_a_source_file (char *name)
unsigned int new_length;
char *tmp_buf = 0;
- bump_line_counters ();
s = input_line_pointer;
if (strncmp (s, "APP\n", 4))
- continue; /* We ignore it */
+ {
+ /* We ignore it */
+ ignore_rest_of_line ();
+ continue;
+ }
+ bump_line_counters ();
s += 4;
sb_new (&sbuf);
@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
continue;
#endif
input_line_pointer--;
- /* Report unknown char as ignored. */
+ /* Report unknown char as error. */
demand_empty_rest_of_line ();
}
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

View File

@ -0,0 +1,192 @@
See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15247
Fixes spurious error
/tmp/ccvNi4ou.s: Assembler messages:
/tmp/ccvNi4ou.s:2310: Error: Illegal operands: There are only 32 single precision f registers; [0-31]
make[2]: *** [/home/dank/wk/crosstool-0.28-rc10/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/math/dosincos.o] Error 1
when compiling glibc's dosincos.c with gcc-3.4.0
===================================================================
RCS file: /cvs/src/src/opcodes/sparc-opc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- src/opcodes/sparc-opc.c 2004/01/18 23:46:32 1.9
+++ src/opcodes/sparc-opc.c 2004/04/20 10:23:51 1.10
@@ -1273,110 +1273,72 @@
#define FM_DF 2 /* v9 */
#define FM_QF 3 /* v9 */
-#define fmovicc(opcode, fpsize, cond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags, v9 }
-
-#define fmovfcc(opcode, fpsize, fcond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags, v9 }
+#define fmoviccx(opcode, fpsize, args, cond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags, v9 }
+
+#define fmovfccx(opcode, fpsize, args, fcond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags, v9 }
/* FIXME: use fmovicc/fmovfcc? */ /* v9 */
-#define fmovcc(opcode, fpsize, cond, fcond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags | F_FLOAT, v9 }
-
-/* v9 */ fmovcc ("fmovda", FM_DF, CONDA, FCONDA, 0),
-/* v9 */ fmovcc ("fmovqa", FM_QF, CONDA, FCONDA, 0),
-/* v9 */ fmovcc ("fmovsa", FM_SF, CONDA, FCONDA, 0),
-/* v9 */ fmovicc ("fmovdcc", FM_DF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovqcc", FM_QF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovscc", FM_SF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovdcs", FM_DF, CONDCS, 0),
-/* v9 */ fmovicc ("fmovqcs", FM_QF, CONDCS, 0),
-/* v9 */ fmovicc ("fmovscs", FM_SF, CONDCS, 0),
-/* v9 */ fmovcc ("fmovde", FM_DF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovqe", FM_QF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovse", FM_SF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovdg", FM_DF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovqg", FM_QF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovsg", FM_SF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovdge", FM_DF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovcc ("fmovqge", FM_QF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovcc ("fmovsge", FM_SF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovicc ("fmovdgeu", FM_DF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovqgeu", FM_QF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovsgeu", FM_SF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovdgu", FM_DF, CONDGU, 0),
-/* v9 */ fmovicc ("fmovqgu", FM_QF, CONDGU, 0),
-/* v9 */ fmovicc ("fmovsgu", FM_SF, CONDGU, 0),
-/* v9 */ fmovcc ("fmovdl", FM_DF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovql", FM_QF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovsl", FM_SF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovdle", FM_DF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovcc ("fmovqle", FM_QF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovcc ("fmovsle", FM_SF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovicc ("fmovdleu", FM_DF, CONDLEU, 0),
-/* v9 */ fmovicc ("fmovqleu", FM_QF, CONDLEU, 0),
-/* v9 */ fmovicc ("fmovsleu", FM_SF, CONDLEU, 0),
-/* v9 */ fmovfcc ("fmovdlg", FM_DF, FCONDLG, 0),
-/* v9 */ fmovfcc ("fmovqlg", FM_QF, FCONDLG, 0),
-/* v9 */ fmovfcc ("fmovslg", FM_SF, FCONDLG, 0),
-/* v9 */ fmovicc ("fmovdlu", FM_DF, CONDLU, F_ALIAS),
-/* v9 */ fmovicc ("fmovqlu", FM_QF, CONDLU, F_ALIAS),
-/* v9 */ fmovicc ("fmovslu", FM_SF, CONDLU, F_ALIAS),
-/* v9 */ fmovcc ("fmovdn", FM_DF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovqn", FM_QF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovsn", FM_SF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovdne", FM_DF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovcc ("fmovqne", FM_QF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovcc ("fmovsne", FM_SF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovicc ("fmovdneg", FM_DF, CONDNEG, 0),
-/* v9 */ fmovicc ("fmovqneg", FM_QF, CONDNEG, 0),
-/* v9 */ fmovicc ("fmovsneg", FM_SF, CONDNEG, 0),
-/* v9 */ fmovcc ("fmovdnz", FM_DF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovqnz", FM_QF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovsnz", FM_SF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovfcc ("fmovdo", FM_DF, FCONDO, 0),
-/* v9 */ fmovfcc ("fmovqo", FM_QF, FCONDO, 0),
-/* v9 */ fmovfcc ("fmovso", FM_SF, FCONDO, 0),
-/* v9 */ fmovicc ("fmovdpos", FM_DF, CONDPOS, 0),
-/* v9 */ fmovicc ("fmovqpos", FM_QF, CONDPOS, 0),
-/* v9 */ fmovicc ("fmovspos", FM_SF, CONDPOS, 0),
-/* v9 */ fmovfcc ("fmovdu", FM_DF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovqu", FM_QF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovsu", FM_SF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovdue", FM_DF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovque", FM_QF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovsue", FM_SF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovdug", FM_DF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovqug", FM_QF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovsug", FM_SF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovduge", FM_DF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovquge", FM_QF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovsuge", FM_SF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovdul", FM_DF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovqul", FM_QF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovsul", FM_SF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovdule", FM_DF, FCONDULE, 0),
-/* v9 */ fmovfcc ("fmovqule", FM_QF, FCONDULE, 0),
-/* v9 */ fmovfcc ("fmovsule", FM_SF, FCONDULE, 0),
-/* v9 */ fmovicc ("fmovdvc", FM_DF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovqvc", FM_QF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovsvc", FM_SF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovdvs", FM_DF, CONDVS, 0),
-/* v9 */ fmovicc ("fmovqvs", FM_QF, CONDVS, 0),
-/* v9 */ fmovicc ("fmovsvs", FM_SF, CONDVS, 0),
-/* v9 */ fmovcc ("fmovdz", FM_DF, CONDZ, FCONDZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovqz", FM_QF, CONDZ, FCONDZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovsz", FM_SF, CONDZ, FCONDZ, F_ALIAS),
-
+#define fmovccx(opcode, fpsize, args, cond, fcond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags | F_FLOAT, v9 }
+
+#define fmovicc(suffix, cond, flags) /* v9 */ \
+fmoviccx("fmovd" suffix, FM_DF, "B,H", cond, flags), \
+fmoviccx("fmovq" suffix, FM_QF, "R,J", cond, flags), \
+fmoviccx("fmovs" suffix, FM_SF, "f,g", cond, flags)
+
+#define fmovfcc(suffix, fcond, flags) /* v9 */ \
+fmovfccx("fmovd" suffix, FM_DF, "B,H", fcond, flags), \
+fmovfccx("fmovq" suffix, FM_QF, "R,J", fcond, flags), \
+fmovfccx("fmovs" suffix, FM_SF, "f,g", fcond, flags)
+
+#define fmovcc(suffix, cond, fcond, flags) /* v9 */ \
+fmovccx("fmovd" suffix, FM_DF, "B,H", cond, fcond, flags), \
+fmovccx("fmovq" suffix, FM_QF, "R,J", cond, fcond, flags), \
+fmovccx("fmovs" suffix, FM_SF, "f,g", cond, fcond, flags)
+
+/* v9 */ fmovcc ("a", CONDA, FCONDA, 0),
+/* v9 */ fmovicc ("cc", CONDCC, 0),
+/* v9 */ fmovicc ("cs", CONDCS, 0),
+/* v9 */ fmovcc ("e", CONDE, FCONDE, 0),
+/* v9 */ fmovcc ("g", CONDG, FCONDG, 0),
+/* v9 */ fmovcc ("ge", CONDGE, FCONDGE, 0),
+/* v9 */ fmovicc ("geu", CONDGEU, F_ALIAS),
+/* v9 */ fmovicc ("gu", CONDGU, 0),
+/* v9 */ fmovcc ("l", CONDL, FCONDL, 0),
+/* v9 */ fmovcc ("le", CONDLE, FCONDLE, 0),
+/* v9 */ fmovicc ("leu", CONDLEU, 0),
+/* v9 */ fmovfcc ("lg", FCONDLG, 0),
+/* v9 */ fmovicc ("lu", CONDLU, F_ALIAS),
+/* v9 */ fmovcc ("n", CONDN, FCONDN, 0),
+/* v9 */ fmovcc ("ne", CONDNE, FCONDNE, 0),
+/* v9 */ fmovicc ("neg", CONDNEG, 0),
+/* v9 */ fmovcc ("nz", CONDNZ, FCONDNZ, F_ALIAS),
+/* v9 */ fmovfcc ("o", FCONDO, 0),
+/* v9 */ fmovicc ("pos", CONDPOS, 0),
+/* v9 */ fmovfcc ("u", FCONDU, 0),
+/* v9 */ fmovfcc ("ue", FCONDUE, 0),
+/* v9 */ fmovfcc ("ug", FCONDUG, 0),
+/* v9 */ fmovfcc ("uge", FCONDUGE, 0),
+/* v9 */ fmovfcc ("ul", FCONDUL, 0),
+/* v9 */ fmovfcc ("ule", FCONDULE, 0),
+/* v9 */ fmovicc ("vc", CONDVC, 0),
+/* v9 */ fmovicc ("vs", CONDVS, 0),
+/* v9 */ fmovcc ("z", CONDZ, FCONDZ, F_ALIAS),
+
+#undef fmoviccx /* v9 */
+#undef fmovfccx /* v9 */
+#undef fmovccx /* v9 */
#undef fmovicc /* v9 */
#undef fmovfcc /* v9 */
#undef fmovcc /* v9 */

View File

@ -0,0 +1,118 @@
From http://sources.redhat.com/ml/binutils/2004-08/msg00190.html
Date: Tue, 17 Aug 2004 12:04:29 +0200
From: Jakub Jelinek <jakub at redhat dot com>
To: binutils at sources dot redhat dot com
Subject: [PATCH] Fix `defined in discarded section' errors when building ia64 gcc
Message-ID: <20040817100429.GL30497@sunsite.ms.mff.cuni.cz>
Reply-To: Jakub Jelinek <jakub at redhat dot com>
References: <20040817090201.GK30497@sunsite.ms.mff.cuni.cz>
In-Reply-To: <20040817090201 dot GK30497 at sunsite dot ms dot mff dot cuni dot cz>
On Tue, Aug 17, 2004 at 11:02:01AM +0200, Jakub Jelinek wrote:
> Current gcc 3.4.x (at least gcc-3_4-rhl-branch) doesn't build with CVS
> binutils (nor 2.15.91.0.2).
> The problem is that libstdc++.so linking fails with:
> `.gnu.linkonce.t._ZNSdD2Ev' referenced in section `.gnu.linkonce.ia64unw._ZNSdD2Ev' of .libs/sstream-inst.o: defined in discarded section `.gnu.linkonce.t._ZNSdD2Ev' of .libs/sstream-inst.o
> The problem is that both io-inst.s and sstream-inst.s have
> .gnu.linkonce.t._ZNSdD2Ev definition, but because io-inst.cc
> also instantiates some templates sstream-inst.cc doesn't instantiate,
> the inliner can do a better job in io-inst.cc.
> The result is that _ZNSdD2Ev in io-inst.cc is a leaf routine, while
> it is not in sstream-inst.cc (in assembly,
> _ZNSdD2Ev in io-inst.s starts with .prologue and no .save directives,
> while _ZNSdD2Ev] in sstream-inst.s has .prologue 12, 35 and some
> .save directives.
> IA-64 ABI allows leaf routines to have no unwind section at all,
> which means .gnu.linkonce.ia64unw._ZNSdD2Ev is not created in
> io-inst.o at all and as .gnu.linkonce.t._ZNSdD2Ev comes first
> and wins, .gnu.linkonce.ia64unw._ZNSdD2Ev in sstream.o suddenly
> references a discarded section.
>
> Not sure what should be done here, but certainly the compiler
> isn't at fault here, it is a binutils problem.
> One fix could be to create empty .gnu.linkonce.ia64unw.* section
> in assembler, another special case ia64 unwind sections in the linker.
Here is a patch for the first possibility.
It certainly makes libstdc++.so to link and even the unwind info looks
good on brief skimming.
2004-08-17 Jakub Jelinek <jakub@redhat.com>
* config/tc-ia64.c (start_unwind_section): Add linkonce_empty
argument, don't do anything if current section is not
.gnu.linkonce.t.* and linkonce_empty is set.
(generate_unwind_image, dot_endp): Adjust callers, call
start_unwind_section (*, 1) if nothing will be put into the
section.
--- binutils/gas/config/tc-ia64.c.jj 2004-07-30 11:42:24.000000000 +0200
+++ binutils/gas/config/tc-ia64.c 2004-08-17 13:45:04.288173205 +0200
@@ -1,5 +1,6 @@
/* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of GAS, the GNU Assembler.
@@ -3297,7 +3298,7 @@ static char *special_linkonce_name[] =
};
static void
-start_unwind_section (const segT text_seg, int sec_index)
+start_unwind_section (const segT text_seg, int sec_index, int linkonce_empty)
{
/*
Use a slightly ugly scheme to derive the unwind section names from
@@ -3359,6 +3360,8 @@ start_unwind_section (const segT text_se
prefix = special_linkonce_name [sec_index - SPECIAL_SECTION_UNWIND];
suffix += sizeof (".gnu.linkonce.t.") - 1;
}
+ else if (linkonce_empty)
+ return;
prefix_len = strlen (prefix);
suffix_len = strlen (suffix);
@@ -3444,7 +3447,7 @@ generate_unwind_image (const segT text_s
expressionS exp;
bfd_reloc_code_real_type reloc;
- start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO);
+ start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO, 0);
/* Make sure the section has 4 byte alignment for ILP32 and
8 byte alignment for LP64. */
@@ -3485,6 +3488,8 @@ generate_unwind_image (const segT text_s
unwind.personality_routine = 0;
}
}
+ else
+ start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO, 1);
free_saved_prologue_counts ();
unwind.list = unwind.tail = unwind.current_entry = NULL;
@@ -4164,7 +4169,7 @@ dot_endp (dummy)
subseg_set (md.last_text_seg, 0);
unwind.proc_end = expr_build_dot ();
- start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND);
+ start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND, 0);
/* Make sure that section has 4 byte alignment for ILP32 and
8 byte alignment for LP64. */
@@ -4204,6 +4209,9 @@ dot_endp (dummy)
bytes_per_address);
}
+ else
+ start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND, 1);
+
subseg_set (saved_seg, saved_subseg);
/* Parse names of main and alternate entry points and set symbol sizes. */
Jakub

View File

@ -0,0 +1,68 @@
See http://sources.redhat.com/ml/binutils/2004-08/msg00256.html
Date: Fri, 20 Aug 2004 21:13:43 -0400
From: Daniel Jacobowitz <drow at false dot org>
To: binutils at sources dot redhat dot com
Subject: Re: Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
Message-ID: <20040821011342.GA30319@nevyn.them.org>
Mail-Followup-To: binutils at sources dot redhat dot com
References: <20040818145518.GA9774@nevyn.them.org> <20040819055040.GA11820@lucon.org> <20040819080034.GE21716@bubble.modra.org> <20040820173240.GA17678@nevyn.them.org> <20040821003737.GB16016@bubble.modra.org>
In-Reply-To: <20040821003737 dot GB16016 at bubble dot modra dot org>
On Sat, Aug 21, 2004 at 10:07:38AM +0930, Alan Modra wrote:
> On Fri, Aug 20, 2004 at 01:32:40PM -0400, Daniel Jacobowitz wrote:
> > Thanks. How's this?
>
> As you might have guessed from my rather slack review of your previous
> patch, I trust you enough to give the OK without proper review. But
> since you asked... :)
Checked in as so.
--
Daniel Jacobowitz
[ rediffed against binutils-2.15.91.0.2, with some elbow grease ]
2004-08-20 Daniel Jacobowitz <dan@debian.org>
* elflink.c (_bfd_elf_section_already_linked): Handle
SEC_LINK_DUPLICATES_SAME_CONTENTS.
--- binutils-2.15.91.0.2/bfd/elflink.c.old 2004-07-27 21:36:08.000000000 -0700
+++ binutils-2.15.91.0.2/bfd/elflink.c 2004-08-26 06:38:07.000000000 -0700
@@ -9359,6 +9359,35 @@
(_("%s: %s: warning: duplicate section `%s' has different size\n"),
bfd_archive_filename (abfd), name);
break;
+ case SEC_LINK_DUPLICATES_SAME_CONTENTS:
+ if (sec->size != l->sec->size)
+ (*_bfd_error_handler)
+ (_("%B: duplicate section `%A' has different size\n"),
+ bfd_archive_filename (abfd), sec);
+ else if (sec->size != 0)
+ {
+ bfd_byte *sec_contents, *l_sec_contents;
+
+ if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
+ (*_bfd_error_handler)
+ (_("%B: warning: could not read contents of section `%A'\n"),
+ bfd_archive_filename (abfd), sec);
+ else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec,
+ &l_sec_contents))
+ (*_bfd_error_handler)
+ (_("%B: warning: could not read contents of section `%A'\n"),
+ bfd_archive_filename(l->sec->owner), l->sec);
+ else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0)
+ (*_bfd_error_handler)
+ (_("%B: warning: duplicate section `%A' has different contents\n"),
+ bfd_archive_filename (abfd), sec);
+
+ if (sec_contents)
+ free (sec_contents);
+ if (l_sec_contents)
+ free (l_sec_contents);
+ }
+ break;
}
/* Set the output_section field so that lang_add_section

View File

@ -0,0 +1,101 @@
Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
Fixes
localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
Paths adjusted to match crosstool's patcher.
Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
From: Andreas Schwab <schwab at suse dot de>
To: Nathan Sidwell <nathan at codesourcery dot com>
Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
Date: Fri, 23 Apr 2004 22:27:19 +0200
Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
Nathan Sidwell <nathan@codesourcery.com> writes:
> Index: read.c
> ===================================================================
> RCS file: /cvs/src/src/gas/read.c,v
> retrieving revision 1.76
> diff -c -3 -p -r1.76 read.c
> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
> --- read.c 18 Mar 2004 09:56:05 -0000
> *************** read_a_source_file (char *name)
> *** 1053,1059 ****
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! ignore_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
> --- 1053,1059 ----
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! demand_empty_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
This means that the unknown character is no longer ignored, despite the
comment. As a side effect a line starting with a line comment character
not followed by APP in NO_APP mode now triggers an error instead of just a
warning, breaking builds of glibc on m68k-linux. Earlier in
read_a_source_file where #APP is handled there is another comment that
claims that unknown comments are ignored, when in fact they aren't (only
the initial line comment character is skipped).
Note that the presence of #APP will mess up the line counters, but
that appears to be difficult to fix.
Andreas.
2004-04-23 Andreas Schwab <schwab@suse.de>
* read.c (read_a_source_file): Ignore unknown text after line
comment character. Fix misleading comment.
--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
@@ -1,6 +1,6 @@
/* read.c - read a source file -
Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -950,10 +950,14 @@ read_a_source_file (char *name)
unsigned int new_length;
char *tmp_buf = 0;
- bump_line_counters ();
s = input_line_pointer;
if (strncmp (s, "APP\n", 4))
- continue; /* We ignore it */
+ {
+ /* We ignore it */
+ ignore_rest_of_line ();
+ continue;
+ }
+ bump_line_counters ();
s += 4;
sb_new (&sbuf);
@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
continue;
#endif
input_line_pointer--;
- /* Report unknown char as ignored. */
+ /* Report unknown char as error. */
demand_empty_rest_of_line ();
}
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

View File

@ -0,0 +1,144 @@
diff -uNr binutils-2.15-pristine/bfd/configure binutils-2.15/bfd/configure
--- binutils-2.15-pristine/bfd/configure 2004-05-17 12:35:57.000000000 -0700
+++ binutils-2.15/bfd/configure 2004-07-19 16:36:19.000000000 -0700
@@ -1009,7 +1009,7 @@
bfd_version_string="\"${VERSION}\""
if test x${is_release} = x; then
bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h`
- bfd_version_string="\"${VERSION} ${bfd_version_date}\""
+ bfd_version_string="\"${VERSION} ${bfd_version_date} uClibc\""
fi
diff -uNr binutils-2.15-pristine/bfd/elf32-arm.h binutils-2.15/bfd/elf32-arm.h
--- binutils-2.15-pristine/bfd/elf32-arm.h 2004-05-17 12:35:58.000000000 -0700
+++ binutils-2.15/bfd/elf32-arm.h 2004-07-19 16:37:06.000000000 -0700
@@ -124,7 +124,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
#ifdef FOUR_WORD_PLT
diff -uNr binutils-2.15-pristine/bfd/elf32-cris.c binutils-2.15/bfd/elf32-cris.c
--- binutils-2.15-pristine/bfd/elf32-cris.c 2004-05-17 12:35:58.000000000 -0700
+++ binutils-2.15/bfd/elf32-cris.c 2004-07-19 16:49:59.000000000 -0700
@@ -536,7 +536,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
/* The size in bytes of an entry in the procedure linkage table. */
diff -uNr binutils-2.15-pristine/bfd/elf32-frv.c binutils-2.15/bfd/elf32-frv.c
--- binutils-2.15-pristine/bfd/elf32-frv.c 2004-05-17 12:35:58.000000000 -0700
+++ binutils-2.15/bfd/elf32-frv.c 2004-07-19 16:49:59.000000000 -0700
@@ -2913,7 +2913,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
#define DEFAULT_STACK_SIZE 0x20000
diff -uNr binutils-2.15-pristine/bfd/elf32-hppa.c binutils-2.15/bfd/elf32-hppa.c
--- binutils-2.15-pristine/bfd/elf32-hppa.c 2004-05-17 12:35:58.000000000 -0700
+++ binutils-2.15/bfd/elf32-hppa.c 2004-07-19 16:49:59.000000000 -0700
@@ -115,7 +115,7 @@
#define PLT_ENTRY_SIZE 8
#define GOT_ENTRY_SIZE 4
-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
static const bfd_byte plt_stub[] =
{
diff -uNr binutils-2.15-pristine/bfd/elf32-ppc.c binutils-2.15/bfd/elf32-ppc.c
--- binutils-2.15-pristine/bfd/elf32-ppc.c 2004-05-17 12:35:59.000000000 -0700
+++ binutils-2.15/bfd/elf32-ppc.c 2004-07-19 16:49:59.000000000 -0700
@@ -49,7 +49,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
/* The size in bytes of an entry in the procedure linkage table. */
#define PLT_ENTRY_SIZE 12
diff -uNr binutils-2.15-pristine/bfd/elf32-s390.c binutils-2.15/bfd/elf32-s390.c
--- binutils-2.15-pristine/bfd/elf32-s390.c 2004-05-17 12:35:59.000000000 -0700
+++ binutils-2.15/bfd/elf32-s390.c 2004-07-19 16:49:59.000000000 -0700
@@ -452,7 +452,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
copying dynamic variables from a shared lib into an app's dynbss
diff -uNr binutils-2.15-pristine/bfd/elf32-sparc.c binutils-2.15/bfd/elf32-sparc.c
--- binutils-2.15-pristine/bfd/elf32-sparc.c 2004-05-17 12:36:00.000000000 -0700
+++ binutils-2.15/bfd/elf32-sparc.c 2004-07-19 16:49:59.000000000 -0700
@@ -536,7 +536,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
/* The nop opcode we use. */
diff -uNr binutils-2.15-pristine/bfd/elf64-ppc.c binutils-2.15/bfd/elf64-ppc.c
--- binutils-2.15-pristine/bfd/elf64-ppc.c 2004-05-17 12:36:01.000000000 -0700
+++ binutils-2.15/bfd/elf64-ppc.c 2004-07-19 16:49:59.000000000 -0700
@@ -99,7 +99,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
/* The size in bytes of an entry in the procedure linkage table. */
#define PLT_ENTRY_SIZE 24
diff -uNr binutils-2.15-pristine/bfd/elf64-s390.c binutils-2.15/bfd/elf64-s390.c
--- binutils-2.15-pristine/bfd/elf64-s390.c 2004-05-17 12:36:01.000000000 -0700
+++ binutils-2.15/bfd/elf64-s390.c 2004-07-19 16:49:59.000000000 -0700
@@ -473,7 +473,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
copying dynamic variables from a shared lib into an app's dynbss
diff -uNr binutils-2.15-pristine/bfd/elf-m10300.c binutils-2.15/bfd/elf-m10300.c
--- binutils-2.15-pristine/bfd/elf-m10300.c 2004-05-17 12:35:57.000000000 -0700
+++ binutils-2.15/bfd/elf-m10300.c 2004-07-19 16:49:59.000000000 -0700
@@ -4026,7 +4026,7 @@
/* The name of the dynamic interpreter. This is put in the .interp
section. */
-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
/* Create dynamic sections when linking against a dynamic object. */
diff -uNr binutils-2.15-pristine/bfd/elfxx-ia64.c binutils-2.15/bfd/elfxx-ia64.c
--- binutils-2.15-pristine/bfd/elfxx-ia64.c 2004-05-17 12:36:02.000000000 -0700
+++ binutils-2.15/bfd/elfxx-ia64.c 2004-07-19 16:49:59.000000000 -0700
@@ -643,7 +643,7 @@
0x60, 0x00, 0x80, 0x00 /* br.few b6;; */
};
-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0"
static const bfd_byte oor_brl[16] =
{

View File

@ -0,0 +1,692 @@
diff -urN binutils-2.15-dist/bfd/config.bfd binutils-2.15/bfd/config.bfd
--- binutils-2.15-dist/bfd/config.bfd 2004-05-17 14:35:56.000000000 -0500
+++ binutils-2.15/bfd/config.bfd 2004-08-04 12:01:44.000000000 -0500
@@ -126,7 +126,7 @@
targ_defvec=ecoffalpha_little_vec
targ_selvecs=bfd_elf64_alpha_vec
;;
- alpha*-*-linux-gnu* | alpha*-*-elf*)
+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*)
targ_defvec=bfd_elf64_alpha_vec
targ_selvecs=ecoffalpha_little_vec
;;
@@ -136,7 +136,7 @@
alpha*-*-*)
targ_defvec=ecoffalpha_little_vec
;;
- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
+ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-linux-uclibc* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_ia64_little_vec
targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
;;
@@ -213,7 +213,7 @@
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
- armeb-*-elf | arm*b-*-linux-gnu*)
+ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*)
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
@@ -221,7 +221,7 @@
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
+ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \
arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
@@ -360,7 +360,7 @@
;;
#ifdef BFD64
- hppa*64*-*-linux-gnu*)
+ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*)
targ_defvec=bfd_elf64_hppa_linux_vec
targ_selvecs=bfd_elf64_hppa_vec
;;
@@ -371,7 +371,7 @@
;;
#endif
- hppa*-*-linux-gnu* | hppa*-*-netbsd*)
+ hppa*-*-linux-gnu* | hppa*-*-linux-uclibc* | hppa*-*-netbsd*)
targ_defvec=bfd_elf32_hppa_linux_vec
targ_selvecs=bfd_elf32_hppa_vec
;;
@@ -494,7 +494,7 @@
targ_selvecs=bfd_elf32_i386_vec
targ_underscore=yes
;;
- i[3-7]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
targ64_selvecs=bfd_elf64_x86_64_vec
@@ -508,7 +508,7 @@
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
;;
- x86_64-*-linux-gnu*)
+ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
;;
@@ -683,7 +683,7 @@
targ_selvecs=bfd_elf32_m68k_vec
targ_underscore=yes
;;
- m68*-*-linux-gnu*)
+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
targ_defvec=bfd_elf32_m68k_vec
targ_selvecs=m68klinux_vec
;;
@@ -955,7 +955,8 @@
;;
#endif
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
+ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | \
+ powerpc-*-rtems* | \
powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
@@ -987,8 +988,8 @@
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
;;
powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
- powerpcle-*-rtems*)
+ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* |\
+ powerpcle-*-vxworks* | powerpcle-*-rtems*)
targ_defvec=bfd_elf32_powerpcle_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
@@ -1149,7 +1150,7 @@
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
targ_underscore=yes
;;
- sparc-*-linux-gnu*)
+ sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
targ_defvec=bfd_elf32_sparc_vec
targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
;;
@@ -1196,7 +1197,7 @@
targ_defvec=sunos_big_vec
targ_underscore=yes
;;
- sparc64-*-linux-gnu*)
+ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
;;
@@ -1265,7 +1266,7 @@
targ_underscore=yes
;;
- vax-*-linux-gnu*)
+ vax-*-linux-gnu* | vax-*-linux-uclibc*)
targ_defvec=bfd_elf32_vax_vec
;;
diff -urN binutils-2.15-dist/bfd/configure binutils-2.15/bfd/configure
--- binutils-2.15-dist/bfd/configure 2004-05-17 14:35:57.000000000 -0500
+++ binutils-2.15/bfd/configure 2004-08-04 12:01:44.000000000 -0500
@@ -1699,6 +1699,11 @@
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
+linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
+ ;;
+
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
@@ -5278,7 +5283,7 @@
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
COREFILE=''
;;
- alpha*-*-linux-gnu*)
+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
@@ -5338,7 +5343,7 @@
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386mach3.h"'
;;
- i[3-7]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
;;
@@ -5376,7 +5381,7 @@
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/hp300bsd.h"'
;;
- m68*-*-linux-gnu*)
+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m68klinux.h"'
;;
@@ -5477,7 +5482,7 @@
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
;;
- vax-*-linux-gnu*)
+ vax-*-linux-gnu* | vax-*-linux-uclibc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxlinux.h"'
;;
diff -urN binutils-2.15-dist/bfd/configure.in binutils-2.15/bfd/configure.in
--- binutils-2.15-dist/bfd/configure.in 2004-05-17 14:35:57.000000000 -0500
+++ binutils-2.15/bfd/configure.in 2004-08-04 12:01:44.000000000 -0500
@@ -178,7 +178,7 @@
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
COREFILE=''
;;
- alpha*-*-linux-gnu*)
+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/alphalinux.h"'
;;
@@ -259,7 +259,7 @@
TRAD_HEADER='"hosts/i386mach3.h"'
;;
changequote(,)dnl
- i[3-7]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
@@ -300,7 +300,7 @@
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/hp300bsd.h"'
;;
- m68*-*-linux-gnu*)
+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/m68klinux.h"'
;;
@@ -385,7 +385,7 @@
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxult2.h"'
;;
- vax-*-linux-gnu*)
+ vax-*-linux-gnu* | vax-*-linux-uclibc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxlinux.h"'
;;
diff -urN binutils-2.15-dist/binutils/configure binutils-2.15/binutils/configure
--- binutils-2.15-dist/binutils/configure 2004-01-02 11:08:04.000000000 -0600
+++ binutils-2.15/binutils/configure 2004-08-04 12:01:44.000000000 -0500
@@ -1585,6 +1585,11 @@
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
+linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
+ ;;
+
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff -urN binutils-2.15-dist/configure binutils-2.15/configure
--- binutils-2.15-dist/configure 2004-05-17 14:36:20.000000000 -0500
+++ binutils-2.15/configure 2004-08-04 12:01:44.000000000 -0500
@@ -1288,6 +1288,18 @@
i[3456789]86-*-freebsd* | i[3456789]86-*-kfreebsd*-gnu)
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;;
+ i[3456789]86-*-linux-uclibc*)
+ # This section makes it possible to build newlib natively on linux.
+ # If we are using a cross compiler then don't configure newlib.
+ if test x${is_cross_compiler} != xno ; then
+ noconfigdirs="$noconfigdirs target-newlib"
+ fi
+ noconfigdirs="$noconfigdirs target-libgloss"
+ # If we are not using a cross compiler, do configure newlib.
+ # Note however, that newlib will only be configured in this situation
+ # if the --with-newlib option has been given, because otherwise
+ # 'target-newlib' will appear in skipdirs.
+ ;;
i[3456789]86-*-linux*)
# The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
# not build java stuff by default.
diff -urN binutils-2.15-dist/configure.in binutils-2.15/configure.in
--- binutils-2.15-dist/configure.in 2004-05-17 14:40:54.000000000 -0500
+++ binutils-2.15/configure.in 2004-08-04 12:01:44.000000000 -0500
@@ -521,6 +521,18 @@
i[[3456789]]86-*-freebsd* | i[[3456789]]86-*-kfreebsd*-gnu)
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;;
+ i[[3456789]]86-*-linux-uclibc*)
+ # This section makes it possible to build newlib natively on linux.
+ # If we are using a cross compiler then don't configure newlib.
+ if test x${is_cross_compiler} != xno ; then
+ noconfigdirs="$noconfigdirs target-newlib"
+ fi
+ noconfigdirs="$noconfigdirs target-libgloss"
+ # If we are not using a cross compiler, do configure newlib.
+ # Note however, that newlib will only be configured in this situation
+ # if the --with-newlib option has been given, because otherwise
+ # 'target-newlib' will appear in skipdirs.
+ ;;
i[[3456789]]86-*-linux*)
# The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
# not build java stuff by default.
diff -urN binutils-2.15-dist/gas/configure binutils-2.15/gas/configure
--- binutils-2.15-dist/gas/configure 2004-05-17 14:36:07.000000000 -0500
+++ binutils-2.15/gas/configure 2004-08-04 12:07:50.000000000 -0500
@@ -3400,6 +3400,11 @@
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
+linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
+ ;;
+
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
@@ -4224,6 +4229,7 @@
alpha*-*-osf*) fmt=ecoff ;;
alpha*-*-linuxecoff*) fmt=ecoff ;;
alpha*-*-linux-gnu*) fmt=elf em=linux ;;
+ alpha*-*-linux-uclibc*) fmt=elf em=linux ;;
alpha*-*-netbsd*) fmt=elf em=nbsd ;;
alpha*-*-openbsd*) fmt=elf em=obsd ;;
@@ -4240,6 +4246,7 @@
arm*-*-conix*) fmt=elf ;;
arm-*-linux*aout*) fmt=aout em=linux ;;
arm*-*-linux-gnu*) fmt=elf em=linux ;;
+ arm*-*-linux-uclibc*) fmt=elf em=linux ;;
arm*-*-uclinux*) fmt=elf em=linux ;;
arm-*-netbsdelf*) fmt=elf em=nbsd ;;
arm-*-*n*bsd*) fmt=aout em=nbsd ;;
@@ -4253,6 +4260,7 @@
avr-*-*) fmt=elf ;;
cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;;
+ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;;
cris-*-*) fmt=multi bfd_gas=yes ;;
d10v-*-*) fmt=elf ;;
@@ -4310,7 +4318,9 @@
i386-*-linux*oldld) fmt=aout em=linux ;;
i386-*-linux*coff*) fmt=coff em=linux ;;
i386-*-linux-gnu*) fmt=elf em=linux ;;
+ i386-*-linux-uclibc*) fmt=elf em=linux ;;
x86_64-*-linux-gnu*) fmt=elf em=linux ;;
+ x86_64-*-linux-uclibc*) fmt=elf em=linux ;;
i386-*-lynxos*) fmt=coff em=lynx ;;
i386-*-sysv[45]*) fmt=elf ;;
i386-*-solaris*) fmt=elf ;;
@@ -4370,6 +4380,7 @@
ia64-*-elf*) fmt=elf ;;
ia64-*-aix*) fmt=elf em=ia64aix ;;
ia64-*-linux-gnu*) fmt=elf em=linux ;;
+ ia64-*-linux-uclibc*) fmt=elf em=linux ;;
ia64-*-hpux*) fmt=elf em=hpux ;;
ia64-*-netbsd*) fmt=elf em=nbsd ;;
@@ -4397,6 +4408,7 @@
m68k-*-hpux*) fmt=hp300 em=hp300 ;;
m68k-*-linux*aout*) fmt=aout em=linux ;;
m68k-*-linux-gnu*) fmt=elf em=linux ;;
+ m68k-*-linux-uclibc*) fmt=elf em=linux ;;
m68k-*-uclinux*) fmt=elf ;;
m68k-*-gnu*) fmt=elf ;;
m68k-*-lynxos*) fmt=coff em=lynx ;;
@@ -4459,6 +4471,7 @@
ppc-*-beos*) fmt=coff ;;
ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;;
ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;;
+ ppc-*-linux-uclibc* | \
ppc-*-linux-gnu*) fmt=elf em=linux
case "$endian" in
big) ;;
@@ -4486,7 +4499,9 @@
ppc-*-kaos*) fmt=elf ;;
s390x-*-linux-gnu*) fmt=elf em=linux ;;
+ s390x-*-linux-uclibc*) fmt=elf em=linux ;;
s390-*-linux-gnu*) fmt=elf em=linux ;;
+ s390-*-linux-uclibc*) fmt=elf em=linux ;;
sh*-*-linux*) fmt=elf em=linux
case ${cpu} in
@@ -4519,6 +4534,7 @@
sparc-*-coff) fmt=coff ;;
sparc-*-linux*aout*) fmt=aout em=linux ;;
sparc-*-linux-gnu*) fmt=elf em=linux ;;
+ sparc-*-linux-uclibc*) fmt=elf em=linux ;;
sparc-*-lynxos*) fmt=coff em=lynx ;;
sparc-fujitsu-none) fmt=aout ;;
sparc-*-elf) fmt=elf ;;
diff -urN binutils-2.15-dist/gas/configure.in binutils-2.15/gas/configure.in
--- binutils-2.15-dist/gas/configure.in 2004-05-17 14:36:07.000000000 -0500
+++ binutils-2.15/gas/configure.in 2004-08-04 12:07:21.000000000 -0500
@@ -194,6 +194,7 @@
alpha*-*-osf*) fmt=ecoff ;;
alpha*-*-linuxecoff*) fmt=ecoff ;;
alpha*-*-linux-gnu*) fmt=elf em=linux ;;
+ alpha*-*-linux-uclibc*) fmt=elf em=linux ;;
alpha*-*-netbsd*) fmt=elf em=nbsd ;;
alpha*-*-openbsd*) fmt=elf em=obsd ;;
@@ -210,6 +211,7 @@
arm*-*-conix*) fmt=elf ;;
arm-*-linux*aout*) fmt=aout em=linux ;;
arm*-*-linux-gnu*) fmt=elf em=linux ;;
+ arm*-*-linux-uclibc*) fmt=elf em=linux ;;
arm*-*-uclinux*) fmt=elf em=linux ;;
arm-*-netbsdelf*) fmt=elf em=nbsd ;;
arm-*-*n*bsd*) fmt=aout em=nbsd ;;
@@ -223,6 +225,7 @@
avr-*-*) fmt=elf ;;
cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;;
+ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;;
cris-*-*) fmt=multi bfd_gas=yes ;;
d10v-*-*) fmt=elf ;;
@@ -280,7 +283,9 @@
i386-*-linux*oldld) fmt=aout em=linux ;;
i386-*-linux*coff*) fmt=coff em=linux ;;
i386-*-linux-gnu*) fmt=elf em=linux ;;
+ i386-*-linux-uclibc*) fmt=elf em=linux ;;
x86_64-*-linux-gnu*) fmt=elf em=linux ;;
+ x86_64-*-linux-uclibc*) fmt=elf em=linux ;;
i386-*-lynxos*) fmt=coff em=lynx ;;
changequote(,)dnl
i386-*-sysv[45]*) fmt=elf ;;
@@ -333,6 +338,7 @@
ia64-*-elf*) fmt=elf ;;
ia64-*-aix*) fmt=elf em=ia64aix ;;
ia64-*-linux-gnu*) fmt=elf em=linux ;;
+ ia64-*-linux-uclibc*) fmt=elf em=linux ;;
ia64-*-hpux*) fmt=elf em=hpux ;;
ia64-*-netbsd*) fmt=elf em=nbsd ;;
@@ -360,6 +366,7 @@
m68k-*-hpux*) fmt=hp300 em=hp300 ;;
m68k-*-linux*aout*) fmt=aout em=linux ;;
m68k-*-linux-gnu*) fmt=elf em=linux ;;
+ m68k-*-linux-uclibc*) fmt=elf em=linux ;;
m68k-*-uclinux*) fmt=elf ;;
m68k-*-gnu*) fmt=elf ;;
m68k-*-lynxos*) fmt=coff em=lynx ;;
@@ -419,6 +426,7 @@
ppc-*-beos*) fmt=coff ;;
ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;;
ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;;
+ ppc-*-linux-uclibc* | \
ppc-*-linux-gnu*) fmt=elf em=linux
case "$endian" in
big) ;;
@@ -439,7 +447,9 @@
ppc-*-kaos*) fmt=elf ;;
s390x-*-linux-gnu*) fmt=elf em=linux ;;
+ s390x-*-linux-uclibc*) fmt=elf em=linux ;;
s390-*-linux-gnu*) fmt=elf em=linux ;;
+ s390-*-linux-uclibc*) fmt=elf em=linux ;;
sh*-*-linux*) fmt=elf em=linux
case ${cpu} in
@@ -472,6 +482,7 @@
sparc-*-coff) fmt=coff ;;
sparc-*-linux*aout*) fmt=aout em=linux ;;
sparc-*-linux-gnu*) fmt=elf em=linux ;;
+ sparc-*-linux-uclibc*) fmt=elf em=linux ;;
sparc-*-lynxos*) fmt=coff em=lynx ;;
sparc-fujitsu-none) fmt=aout ;;
sparc-*-elf) fmt=elf ;;
diff -urN binutils-2.15-dist/gprof/configure binutils-2.15/gprof/configure
--- binutils-2.15-dist/gprof/configure 2003-08-26 12:19:19.000000000 -0500
+++ binutils-2.15/gprof/configure 2004-08-04 12:01:45.000000000 -0500
@@ -1581,6 +1581,11 @@
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
+linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
+ ;;
+
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff -urN binutils-2.15-dist/ld/configure binutils-2.15/ld/configure
--- binutils-2.15-dist/ld/configure 2003-04-24 07:36:07.000000000 -0500
+++ binutils-2.15/ld/configure 2004-08-04 12:01:45.000000000 -0500
@@ -1589,6 +1589,11 @@
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
+linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
+ ;;
+
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff -urN binutils-2.15-dist/ld/configure.tgt binutils-2.15/ld/configure.tgt
--- binutils-2.15-dist/ld/configure.tgt 2004-05-17 14:36:15.000000000 -0500
+++ binutils-2.15/ld/configure.tgt 2004-08-04 12:01:45.000000000 -0500
@@ -30,6 +30,7 @@
targ_extra_emuls="criself crislinux"
targ_extra_libpath=$targ_extra_emuls ;;
cris-*-linux-gnu*) targ_emul=crislinux ;;
+cris-*-linux-uclibc*) targ_emul=crislinux ;;
cris-*-*) targ_emul=criself
targ_extra_emuls="crisaout crislinux"
targ_extra_libpath=$targ_extra_emuls ;;
@@ -59,14 +60,16 @@
tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'`
tdir_sun4=sparc-sun-sunos4
;;
-sparc64-*-linux-gnu*) targ_emul=elf64_sparc
+sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) \
+ targ_emul=elf64_sparc
targ_extra_emuls="elf32_sparc sparclinux sun4"
targ_extra_libpath=elf32_sparc
tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
tdir_sparclinux=${tdir_elf32_sparc}aout
tdir_sun4=sparc-sun-sunos4
;;
-sparc*-*-linux-gnu*) targ_emul=elf32_sparc
+sparc*-*-linux-gnu* | sparc*-*-linux-uclibc*) \
+ targ_emul=elf32_sparc
targ_extra_emuls="sparclinux elf64_sparc sun4"
targ_extra_libpath=elf64_sparc
tdir_sparclinux=${targ_alias}aout
@@ -118,7 +121,9 @@
m32r*le-*-elf*) targ_emul=m32rlelf ;;
m32r*-*-elf*) targ_emul=m32relf ;;
m32r*le-*-linux-gnu*) targ_emul=m32rlelf_linux ;;
+m32r*le-*-linux-uclibc*) targ_emul=m32rlelf_linux ;;
m32r*-*-linux-gnu*) targ_emul=m32relf_linux ;;
+m32r*-*-linux-uclibc*) targ_emul=m32relf_linux ;;
m68hc11-*-*|m6811-*-*) targ_emul=m68hc11elf
targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb" ;;
m68hc12-*-*|m6812-*-*) targ_emul=m68hc12elf
@@ -128,7 +133,7 @@
m68*-ericsson-ose) targ_emul=sun3 ;;
m68*-apple-aux*) targ_emul=m68kaux ;;
*-tandem-none) targ_emul=st2000 ;;
-i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;;
+i370-*-elf* | i370-*-linux-gnu* | i370-*-linux-uclibc*) targ_emul=elf32i370 ;;
i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;;
i[3-7]86-*-vsta) targ_emul=vsta ;;
i[3-7]86-go32-rtems*) targ_emul=i386go32 ;;
@@ -152,14 +157,16 @@
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'`
;;
i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
-i[3-7]86-*-linux-gnu*) targ_emul=elf_i386
+i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) \
+ targ_emul=elf_i386
targ_extra_emuls=i386linux
if test x${want64} = xtrue; then
targ_extra_emuls="$targ_extra_emuls elf_x86_64"
fi
tdir_i386linux=${targ_alias}aout
;;
-x86_64-*-linux-gnu*) targ_emul=elf_x86_64
+x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) \
+ targ_emul=elf_x86_64
targ_extra_emuls="elf_i386 i386linux"
targ_extra_libpath=elf_i386
tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
@@ -259,10 +266,13 @@
arm9e-*-elf) targ_emul=armelf ;;
arm-*-oabi) targ_emul=armelf_oabi ;;
arm*b-*-linux-gnu*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;;
+arm*b-*-linux-uclibc*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;;
arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
+arm*-*-linux-uclibc*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
arm*-*-conix*) targ_emul=armelf ;;
-thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
+thumb-*-linux-gnu* | thumb-*-linux-uclibc* | thumb-*-uclinux*) \
+ targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
strongarm-*-coff) targ_emul=armcoff ;;
strongarm-*-elf) targ_emul=armelf ;;
strongarm-*-kaos*) targ_emul=armelf ;;
@@ -364,7 +374,8 @@
targ_extra_emuls=m68kelf
tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'`
;;
-m68k-*-linux-gnu*) targ_emul=m68kelf
+m68k-*-linux-gnu* | m68k-*-linux-uclibc*) \
+ targ_emul=m68kelf
targ_extra_emuls=m68klinux
tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'`
;;
@@ -381,9 +392,9 @@
m68*-*-psos*) targ_emul=m68kpsos ;;
m68*-*-rtemscoff*) targ_emul=m68kcoff ;;
m68*-*-rtems*) targ_emul=m68kelf ;;
-hppa*64*-*-linux-gnu*) targ_emul=hppa64linux ;;
+hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) targ_emul=hppa64linux ;;
hppa*64*-*) targ_emul=elf64hppa ;;
-hppa*-*-linux-gnu*) targ_emul=hppalinux ;;
+hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) targ_emul=hppalinux ;;
hppa*-*-*elf*) targ_emul=hppaelf ;;
hppa*-*-lites*) targ_emul=hppaelf ;;
hppa*-*-netbsd*) targ_emul=hppanbsd ;;
@@ -396,6 +407,7 @@
targ_emul=vaxnbsd
targ_extra_emuls=elf32vax ;;
vax-*-linux-gnu*) targ_emul=elf32vax ;;
+vax-*-linux-uclibc*) targ_emul=elf32vax ;;
mips*-*-pe) targ_emul=mipspe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
mips*-dec-ultrix*) targ_emul=mipslit ;;
@@ -429,16 +441,16 @@
mips*-*-vxworks*) targ_emul=elf32ebmip
targ_extra_emuls="elf32elmip" ;;
mips*-*-windiss) targ_emul=elf32mipswindiss ;;
-mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32
+mips64*el-*-linux-gnu* | mips64*el-*-linux-uclibc*) targ_emul=elf32ltsmipn32
targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
;;
-mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32
+mips64*-*-linux-gnu* | mips64*-*-linux-uclibc*) targ_emul=elf32btsmipn32
targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
;;
-mips*el-*-linux-gnu*) targ_emul=elf32ltsmip
+mips*el-*-linux-gnu* | mips*el-*-linux-uclibc*) targ_emul=elf32ltsmip
targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
;;
-mips*-*-linux-gnu*) targ_emul=elf32btsmip
+mips*-*-linux-gnu* | mips*-*-linux-uclibc*) targ_emul=elf32btsmip
targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
;;
mips*-*-lnews*) targ_emul=mipslnews ;;
@@ -461,6 +473,10 @@
alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha
tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'`
;;
+alpha*-*-linux-uclibc*) targ_emul=elf64alpha targ_extra_emuls=alpha
+ # The following needs to be checked...
+ tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'`
+ ;;
alpha*-*-osf*) targ_emul=alpha ;;
alpha*-*-gnu*) targ_emul=elf64alpha ;;
alpha*-*-netware*) targ_emul=alpha ;;
diff -urN binutils-2.15-dist/libtool.m4 binutils-2.15/libtool.m4
--- binutils-2.15-dist/libtool.m4 2003-04-10 22:58:39.000000000 -0500
+++ binutils-2.15/libtool.m4 2004-08-04 12:01:45.000000000 -0500
@@ -645,6 +645,11 @@
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
+linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
+ ;;
+
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
[lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
diff -urN binutils-2.15-dist/ltconfig binutils-2.15/ltconfig
--- binutils-2.15-dist/ltconfig 2003-10-03 23:54:47.000000000 -0500
+++ binutils-2.15/ltconfig 2004-08-04 12:01:45.000000000 -0500
@@ -603,6 +603,7 @@
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case $host_os in
linux-gnu*) ;;
+linux-uclibc*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
@@ -1259,6 +1260,24 @@
dynamic_linker='GNU/Linux ld.so'
;;
+linux-uclibc*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ # Note: copied from linux-gnu, and may not be appropriate.
+ hardcode_into_libs=yes
+ # Assume using the uClibc dynamic linker.
+ dynamic_linker="uClibc ld.so"
+ ;;
+
netbsd*)
need_lib_prefix=no
need_version=no
diff -urN binutils-2.15-dist/opcodes/configure binutils-2.15/opcodes/configure
--- binutils-2.15-dist/opcodes/configure 2003-08-05 04:39:31.000000000 -0500
+++ binutils-2.15/opcodes/configure 2004-08-04 12:01:45.000000000 -0500
@@ -1700,6 +1700,11 @@
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
+linux-uclibc*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
+ ;;
+
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'

View File

@ -0,0 +1,32 @@
diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.am binutils-2.14.90.0.6.new/bfd/doc/Makefile.am
--- binutils-2.14.90.0.6/bfd/doc/Makefile.am 2003-07-23 10:08:09.000000000 -0500
+++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.am 2004-03-01 16:05:16.000000000 -0600
@@ -55,10 +55,10 @@
MKDOC = chew$(EXEEXT_FOR_BUILD)
$(MKDOC): chew.o
- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
+ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS)
chew.o: chew.c
- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
+ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c
protos: libbfd.h libcoff.h bfd.h
diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.in binutils-2.14.90.0.6.new/bfd/doc/Makefile.in
--- binutils-2.14.90.0.6/bfd/doc/Makefile.in 2003-07-23 10:08:09.000000000 -0500
+++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.in 2004-03-01 16:05:03.000000000 -0600
@@ -469,10 +469,10 @@
$(MKDOC): chew.o
- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS)
+ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS)
chew.o: chew.c
- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
+ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c
protos: libbfd.h libcoff.h bfd.h

View File

@ -0,0 +1,26 @@
--- binutils/bfd/elf32-mips.c~
+++ binutils/bfd/elf32-mips.c
@@ -1611,7 +1611,9 @@
/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
page sizes of up to that limit, so we need to respect it. */
-#define ELF_MAXPAGESIZE 0x10000
+/*#define ELF_MAXPAGESIZE 0x10000*/
+/* Use 4K to shrink the elf header. NOT for general use! */
+#define ELF_MAXPAGESIZE 0x1000
#define elf32_bed elf32_tradbed
/* Include the target file again for this target. */
--- binutils/bfd/elfn32-mips.c~
+++ binutils/bfd/elfn32-mips.c
@@ -1976,7 +1976,9 @@
/* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses
page sizes of up to that limit, so we need to respect it. */
-#define ELF_MAXPAGESIZE 0x10000
+/*#define ELF_MAXPAGESIZE 0x10000*/
+/* Use 4K to shrink the elf header. NOT for general use! */
+#define ELF_MAXPAGESIZE 0x1000
#define elf32_bed elf32_tradbed
/* Include the target file again for this target. */

View File

@ -0,0 +1,63 @@
http://sources.redhat.com/ml/binutils/2004-06/msg00010.html
--- binutils-2.15.90.0.3-old/bfd/elf32-arm.h 2004-04-12 14:56:33.000000000 -0500
+++ binutils-2.15.90.0.3/bfd/elf32-arm.h 2004-09-03 06:56:40.000000000 -0500
@@ -87,6 +87,8 @@
#endif
static bfd_boolean allocate_dynrelocs
PARAMS ((struct elf_link_hash_entry *h, PTR inf));
+static bfd_boolean elf32_arm_readonly_dynrelocs
+ PARAMS ((struct elf_link_hash_entry *, PTR));
static bfd_boolean create_got_section
PARAMS ((bfd * dynobj, struct bfd_link_info * info));
static bfd_boolean elf32_arm_create_dynamic_sections
@@ -3531,6 +3533,37 @@
return TRUE;
}
+/* Find any dynamic relocs that apply to read-only sections. */
+
+static bfd_boolean
+elf32_arm_readonly_dynrelocs (h, inf)
+ struct elf_link_hash_entry *h;
+ PTR inf;
+{
+ struct elf32_arm_link_hash_entry *eh;
+ struct elf32_arm_relocs_copied *p;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ eh = (struct elf32_arm_link_hash_entry *) h;
+ for (p = eh->relocs_copied; p != NULL; p = p->next)
+ {
+ asection *s = p->section;
+
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ {
+ struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+ info->flags |= DF_TEXTREL;
+
+ /* Not an error, just cut short the traversal. */
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
/* Set the sizes of the dynamic sections. */
static bfd_boolean
@@ -3740,6 +3773,12 @@
return FALSE;
}
+ /* If any dynamic relocs apply to a read-only section,
+ then we need a DT_TEXTREL entry. */
+ if ((info->flags & DF_TEXTREL) == 0)
+ elf_link_hash_traverse (&htab->root, elf32_arm_readonly_dynrelocs,
+ (PTR) info);
+
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))

View File

@ -0,0 +1,24 @@
Signed-off-by: dank@kegel.com
Raising the size of the hash table is a noticable win when linking
at least one large app.
There was a patch,
http://sources.redhat.com/ml/binutils/2004-06/msg00165.html
to do this dynamically. No idea why that didn't make it in.
So this tiny change to raise the default size is just
a stopgap for now.
--- binutils-2.15/bfd/hash.c.old 2003-12-01 01:33:01.000000000 -0500
+++ binutils-2.15/bfd/hash.c 2006-03-01 16:26:26.701991000 -0500
@@ -295,7 +295,7 @@
*/
/* The default number of entries to use when creating a hash table. */
-#define DEFAULT_SIZE (4051)
+#define DEFAULT_SIZE (32749)
/* Create a new hash table, given a number of entries. */

View File

@ -0,0 +1,75 @@
Fix found here: http://www.freelists.org/archives/openbeos/11-2005/msg00090.html
Fixes:
In file included from ./targ-cpu.h:1,
from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/obj-elf.h:42,
from ./obj-format.h:1,
from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/te-linux.h:4,
from ./targ-env.h:1,
from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/as.h:626,
from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/app.c:30:
/home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/tc-i386.h:451: error: array type has incomplete element type
make[3]: *** [app.o] Error 1
make[3]: Leaving directory `/home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/build-binutils/gas'
when building binutils-2.15 with gcc-4.0
diff -ur binutils-2.15.old/gas/as.h binutils-2.15/gas/as.h
--- binutils-2.15.old/gas/as.h 2003-11-22 18:14:21.000000000 -0800
+++ binutils-2.15/gas/as.h 2006-02-14 22:05:35.000000000 -0800
@@ -605,7 +605,26 @@
struct expressionS;
struct fix;
typedef struct symbol symbolS;
-struct relax_type;
+
+/* JF moved this here from as.h under the theory that nobody except MACHINE.c
+ and write.c care about it anyway. */
+/* [zooey]: the above no longer holds with gcc4, as it keeps bugging about
+ incomplete element types in arrays, if relax_type isn't defined
+ here. So I moved the definition back from tc.h to here. */
+struct relax_type
+{
+ /* Forward reach. Signed number. > 0. */
+ long rlx_forward;
+ /* Backward reach. Signed number. < 0. */
+ long rlx_backward;
+
+ /* Bytes length of this address. */
+ unsigned char rlx_length;
+
+ /* Next longer relax-state. 0 means there is no 'next' relax-state. */
+ relax_substateT rlx_more;
+};
+
typedef struct frag fragS;
#ifdef BFD_ASSEMBLER
diff -ur binutils-2.15.old/gas/tc.h binutils-2.15/gas/tc.h
--- binutils-2.15.old/gas/tc.h 2003-12-03 15:39:38.000000000 -0800
+++ binutils-2.15/gas/tc.h 2006-02-14 22:03:35.000000000 -0800
@@ -24,23 +24,6 @@
extern const pseudo_typeS md_pseudo_table[];
-/* JF moved this here from as.h under the theory that nobody except MACHINE.c
- and write.c care about it anyway. */
-
-struct relax_type
-{
- /* Forward reach. Signed number. > 0. */
- long rlx_forward;
- /* Backward reach. Signed number. < 0. */
- long rlx_backward;
-
- /* Bytes length of this address. */
- unsigned char rlx_length;
-
- /* Next longer relax-state. 0 means there is no 'next' relax-state. */
- relax_substateT rlx_more;
-};
-
typedef struct relax_type relax_typeS;
extern const int md_reloc_size; /* Size of a relocation record */

View File

@ -0,0 +1,40 @@
Make psignal prototype in libiberty match that in glibc.
Fixes:
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal':
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype
/usr/include/signal.h:131: prototype declaration
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype
/usr/include/signal.h:131: prototype declaration
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned
mprotect... make[1]: *** [strsignal.o] Error 1
make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty'
make: *** [all-libiberty] Error 2
when building on red hat 7.1
though it's a bit of a mystery why libiberty's psignal is being compiled at
all, since red hat 7.1's glibc supports psignal (hence the error message)
--- binutils-2.15/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700
+++ binutils-2.15/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700
@@ -544,7 +544,7 @@
/*
-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
+@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message})
Print @var{message} to the standard error, followed by a colon,
followed by the description of the signal specified by @var{signo},
@@ -557,9 +557,7 @@
#ifndef HAVE_PSIGNAL
void
-psignal (signo, message)
- unsigned signo;
- char *message;
+psignal (int signo, const char *message)
{
if (signal_names == NULL)
{

View File

@ -0,0 +1,22 @@
See http://sources.redhat.com/ml/binutils/2004-06/msg00114.html
--- src/bfd/elflink.c.org 2004-07-05 09:11:42.920597000 -0400
+++ src/bfd/elflink.c 2004-07-05 09:12:59.240847000 -0400
@@ -2700,7 +2700,7 @@
return vdiff > 0 ? 1 : -1;
else
{
- long sdiff = h1->root.u.def.section - h2->root.u.def.section;
+ long sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id;
if (sdiff != 0)
return sdiff > 0 ? 1 : -1;
}
@@ -3954,7 +3954,7 @@
i = idx + 1;
else
{
- long sdiff = slook - h->root.u.def.section;
+ long sdiff = slook->id - h->root.u.def.section->id;
if (sdiff < 0)
j = idx;
else if (sdiff > 0)

View File

@ -0,0 +1,45 @@
Grabbed with
wget 'http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/opcodes/ppc-opc.c.diff?r1=1.70&r2=1.71&cvsroot=src'
See
http://mail.gnu.org/archive/html/bug-binutils/2004-05/msg00071.html
and
http://sources.redhat.com/ml/binutils-cvs/2004-05/msg00111.html
This fixes problems like
{standard input}: Assembler messages:
{standard input}:1: Error: Unrecognized opcode: `dssall'
which show up in binutils-2.15 when building the Linux kernel,
or possibly failed compilations when building setjmp/longjmp in glibc.
An alternative fix would be to pass -many to the assembler.
A patch to do that for glibc is at
wget 'http://sources.redhat.com/cgi-bin/get-raw-msg?listname=libc-alpha&date=2004-05&msgid=40B36E8C.9030609%40us.ibm.com'
Yet another, better, fix would be for gcc to generate assembly
that told the assembler which processor type to use.
Presumably the Linux kernel sources would need a fix, too.
Probably better to just fix binutils to accept sources that it used to.
===================================================================
RCS file: /cvs/src/src/opcodes/ppc-opc.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- src/opcodes/ppc-opc.c 2004/05/05 13:43:36 1.70
+++ src/opcodes/ppc-opc.c 2004/05/19 05:11:48 1.71
@@ -1004,8 +1004,13 @@
/* If only one bit of the FXM field is set, we can use the new form
of the instruction, which is faster. Unlike the Power4 branch hint
- encoding, this is not backward compatible. */
- else if ((dialect & PPC_OPCODE_POWER4) != 0 && (value & -value) == value)
+ encoding, this is not backward compatible. Do not generate the
+ new form unless -mpower4 has been given, or -many and the two
+ operand form of mfcr was used. */
+ else if ((value & -value) == value
+ && ((dialect & PPC_OPCODE_POWER4) != 0
+ || ((dialect & PPC_OPCODE_ANY) != 0
+ && (insn & (0x3ff << 1)) == 19 << 1)))
insn |= 1 << 20;
/* Any other value on mfcr is an error. */

View File

@ -0,0 +1,51 @@
From http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?r1=1.168&r2=1.169&cvsroot=src
See also http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-July/023128.html,
"[CRITICAL PATCH] 2.6: fix silent build error]"
Revision 1.169, Fri Jul 2 11:12:29 2004 UTC (19 hours, 4 minutes ago) by nickc
Branch: MAIN
CVS Tags: binutils_latest_snapshot, HEAD
Changes since 1.168: +14 -1 lines
(md_apply_fix3:BFD_RELOC_ARM_IMMEDIATE): Do not allow values which have come
from undefined symbols.
Always consider this fixup to have been processed as a reloc cannot be
generated for it.
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -r1.168 -r1.169
--- src/gas/config/tc-arm.c 2004/04/30 10:51:12 1.168
+++ src/gas/config/tc-arm.c 2004/07/02 11:12:29 1.169
@@ -12186,6 +12186,20 @@
switch (fixP->fx_r_type)
{
case BFD_RELOC_ARM_IMMEDIATE:
+ /* We claim that this fixup has been processed here,
+ even if in fact we generate an error because we do
+ not have a reloc for it, so tc_gen_reloc will reject it. */
+ fixP->fx_done = 1;
+
+ if (fixP->fx_addsy
+ && ! S_IS_DEFINED (fixP->fx_addsy))
+ {
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("undefined symbol %s used as an immediate value"),
+ S_GET_NAME (fixP->fx_addsy));
+ break;
+ }
+
newimm = validate_immediate (value);
temp = md_chars_to_number (buf, INSN_SIZE);
@@ -12202,7 +12216,6 @@
newimm |= (temp & 0xfffff000);
md_number_to_chars (buf, (valueT) newimm, INSN_SIZE);
- fixP->fx_done = 1;
break;
case BFD_RELOC_ARM_ADRL_IMMEDIATE:

View File

@ -0,0 +1,101 @@
Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
Fixes
localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
Paths adjusted to match crosstool's patcher.
Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
From: Andreas Schwab <schwab at suse dot de>
To: Nathan Sidwell <nathan at codesourcery dot com>
Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
Date: Fri, 23 Apr 2004 22:27:19 +0200
Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
Nathan Sidwell <nathan@codesourcery.com> writes:
> Index: read.c
> ===================================================================
> RCS file: /cvs/src/src/gas/read.c,v
> retrieving revision 1.76
> diff -c -3 -p -r1.76 read.c
> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
> --- read.c 18 Mar 2004 09:56:05 -0000
> *************** read_a_source_file (char *name)
> *** 1053,1059 ****
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! ignore_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
> --- 1053,1059 ----
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! demand_empty_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
This means that the unknown character is no longer ignored, despite the
comment. As a side effect a line starting with a line comment character
not followed by APP in NO_APP mode now triggers an error instead of just a
warning, breaking builds of glibc on m68k-linux. Earlier in
read_a_source_file where #APP is handled there is another comment that
claims that unknown comments are ignored, when in fact they aren't (only
the initial line comment character is skipped).
Note that the presence of #APP will mess up the line counters, but
that appears to be difficult to fix.
Andreas.
2004-04-23 Andreas Schwab <schwab@suse.de>
* read.c (read_a_source_file): Ignore unknown text after line
comment character. Fix misleading comment.
--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
@@ -1,6 +1,6 @@
/* read.c - read a source file -
Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -950,10 +950,14 @@ read_a_source_file (char *name)
unsigned int new_length;
char *tmp_buf = 0;
- bump_line_counters ();
s = input_line_pointer;
if (strncmp (s, "APP\n", 4))
- continue; /* We ignore it */
+ {
+ /* We ignore it */
+ ignore_rest_of_line ();
+ continue;
+ }
+ bump_line_counters ();
s += 4;
sb_new (&sbuf);
@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
continue;
#endif
input_line_pointer--;
- /* Report unknown char as ignored. */
+ /* Report unknown char as error. */
demand_empty_rest_of_line ();
}
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

View File

@ -0,0 +1,22 @@
--- binutils-2.15/configure.old 2004-07-21 21:36:47.000000000 -0700
+++ binutils-2.15/configure 2004-07-21 21:37:08.000000000 -0700
@@ -999,7 +999,7 @@
# Some tools are only suitable for building in a "native" situation.
# Remove these if host!=target.
-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
# Similarly, some are only suitable for cross toolchains.
# Remove these if host=target.
--- binutils-2.15/configure.in.old 2004-07-21 21:37:19.000000000 -0700
+++ binutils-2.15/configure.in 2004-07-21 21:37:34.000000000 -0700
@@ -236,7 +236,7 @@
# Some tools are only suitable for building in a "native" situation.
# Remove these if host!=target.
-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
# Similarly, some are only suitable for cross toolchains.
# Remove these if host=target.

View File

@ -0,0 +1,192 @@
See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15247
Fixes spurious error
/tmp/ccvNi4ou.s: Assembler messages:
/tmp/ccvNi4ou.s:2310: Error: Illegal operands: There are only 32 single precision f registers; [0-31]
make[2]: *** [/home/dank/wk/crosstool-0.28-rc10/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/math/dosincos.o] Error 1
when compiling glibc's dosincos.c with gcc-3.4.0
===================================================================
RCS file: /cvs/src/src/opcodes/sparc-opc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- src/opcodes/sparc-opc.c 2004/01/18 23:46:32 1.9
+++ src/opcodes/sparc-opc.c 2004/04/20 10:23:51 1.10
@@ -1273,110 +1273,72 @@
#define FM_DF 2 /* v9 */
#define FM_QF 3 /* v9 */
-#define fmovicc(opcode, fpsize, cond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags, v9 }
-
-#define fmovfcc(opcode, fpsize, fcond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags, v9 }, \
-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags, v9 }
+#define fmoviccx(opcode, fpsize, args, cond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags, v9 }
+
+#define fmovfccx(opcode, fpsize, args, fcond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags, v9 }, \
+{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags, v9 }
/* FIXME: use fmovicc/fmovfcc? */ /* v9 */
-#define fmovcc(opcode, fpsize, cond, fcond, flags) /* v9 */ \
-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags | F_FLOAT, v9 }, \
-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags | F_FLOAT, v9 }
-
-/* v9 */ fmovcc ("fmovda", FM_DF, CONDA, FCONDA, 0),
-/* v9 */ fmovcc ("fmovqa", FM_QF, CONDA, FCONDA, 0),
-/* v9 */ fmovcc ("fmovsa", FM_SF, CONDA, FCONDA, 0),
-/* v9 */ fmovicc ("fmovdcc", FM_DF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovqcc", FM_QF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovscc", FM_SF, CONDCC, 0),
-/* v9 */ fmovicc ("fmovdcs", FM_DF, CONDCS, 0),
-/* v9 */ fmovicc ("fmovqcs", FM_QF, CONDCS, 0),
-/* v9 */ fmovicc ("fmovscs", FM_SF, CONDCS, 0),
-/* v9 */ fmovcc ("fmovde", FM_DF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovqe", FM_QF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovse", FM_SF, CONDE, FCONDE, 0),
-/* v9 */ fmovcc ("fmovdg", FM_DF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovqg", FM_QF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovsg", FM_SF, CONDG, FCONDG, 0),
-/* v9 */ fmovcc ("fmovdge", FM_DF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovcc ("fmovqge", FM_QF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovcc ("fmovsge", FM_SF, CONDGE, FCONDGE, 0),
-/* v9 */ fmovicc ("fmovdgeu", FM_DF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovqgeu", FM_QF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovsgeu", FM_SF, CONDGEU, F_ALIAS),
-/* v9 */ fmovicc ("fmovdgu", FM_DF, CONDGU, 0),
-/* v9 */ fmovicc ("fmovqgu", FM_QF, CONDGU, 0),
-/* v9 */ fmovicc ("fmovsgu", FM_SF, CONDGU, 0),
-/* v9 */ fmovcc ("fmovdl", FM_DF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovql", FM_QF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovsl", FM_SF, CONDL, FCONDL, 0),
-/* v9 */ fmovcc ("fmovdle", FM_DF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovcc ("fmovqle", FM_QF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovcc ("fmovsle", FM_SF, CONDLE, FCONDLE, 0),
-/* v9 */ fmovicc ("fmovdleu", FM_DF, CONDLEU, 0),
-/* v9 */ fmovicc ("fmovqleu", FM_QF, CONDLEU, 0),
-/* v9 */ fmovicc ("fmovsleu", FM_SF, CONDLEU, 0),
-/* v9 */ fmovfcc ("fmovdlg", FM_DF, FCONDLG, 0),
-/* v9 */ fmovfcc ("fmovqlg", FM_QF, FCONDLG, 0),
-/* v9 */ fmovfcc ("fmovslg", FM_SF, FCONDLG, 0),
-/* v9 */ fmovicc ("fmovdlu", FM_DF, CONDLU, F_ALIAS),
-/* v9 */ fmovicc ("fmovqlu", FM_QF, CONDLU, F_ALIAS),
-/* v9 */ fmovicc ("fmovslu", FM_SF, CONDLU, F_ALIAS),
-/* v9 */ fmovcc ("fmovdn", FM_DF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovqn", FM_QF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovsn", FM_SF, CONDN, FCONDN, 0),
-/* v9 */ fmovcc ("fmovdne", FM_DF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovcc ("fmovqne", FM_QF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovcc ("fmovsne", FM_SF, CONDNE, FCONDNE, 0),
-/* v9 */ fmovicc ("fmovdneg", FM_DF, CONDNEG, 0),
-/* v9 */ fmovicc ("fmovqneg", FM_QF, CONDNEG, 0),
-/* v9 */ fmovicc ("fmovsneg", FM_SF, CONDNEG, 0),
-/* v9 */ fmovcc ("fmovdnz", FM_DF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovqnz", FM_QF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovsnz", FM_SF, CONDNZ, FCONDNZ, F_ALIAS),
-/* v9 */ fmovfcc ("fmovdo", FM_DF, FCONDO, 0),
-/* v9 */ fmovfcc ("fmovqo", FM_QF, FCONDO, 0),
-/* v9 */ fmovfcc ("fmovso", FM_SF, FCONDO, 0),
-/* v9 */ fmovicc ("fmovdpos", FM_DF, CONDPOS, 0),
-/* v9 */ fmovicc ("fmovqpos", FM_QF, CONDPOS, 0),
-/* v9 */ fmovicc ("fmovspos", FM_SF, CONDPOS, 0),
-/* v9 */ fmovfcc ("fmovdu", FM_DF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovqu", FM_QF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovsu", FM_SF, FCONDU, 0),
-/* v9 */ fmovfcc ("fmovdue", FM_DF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovque", FM_QF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovsue", FM_SF, FCONDUE, 0),
-/* v9 */ fmovfcc ("fmovdug", FM_DF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovqug", FM_QF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovsug", FM_SF, FCONDUG, 0),
-/* v9 */ fmovfcc ("fmovduge", FM_DF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovquge", FM_QF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovsuge", FM_SF, FCONDUGE, 0),
-/* v9 */ fmovfcc ("fmovdul", FM_DF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovqul", FM_QF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovsul", FM_SF, FCONDUL, 0),
-/* v9 */ fmovfcc ("fmovdule", FM_DF, FCONDULE, 0),
-/* v9 */ fmovfcc ("fmovqule", FM_QF, FCONDULE, 0),
-/* v9 */ fmovfcc ("fmovsule", FM_SF, FCONDULE, 0),
-/* v9 */ fmovicc ("fmovdvc", FM_DF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovqvc", FM_QF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovsvc", FM_SF, CONDVC, 0),
-/* v9 */ fmovicc ("fmovdvs", FM_DF, CONDVS, 0),
-/* v9 */ fmovicc ("fmovqvs", FM_QF, CONDVS, 0),
-/* v9 */ fmovicc ("fmovsvs", FM_SF, CONDVS, 0),
-/* v9 */ fmovcc ("fmovdz", FM_DF, CONDZ, FCONDZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovqz", FM_QF, CONDZ, FCONDZ, F_ALIAS),
-/* v9 */ fmovcc ("fmovsz", FM_SF, CONDZ, FCONDZ, F_ALIAS),
-
+#define fmovccx(opcode, fpsize, args, cond, fcond, flags) /* v9 */ \
+{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags | F_FLOAT, v9 }, \
+{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags | F_FLOAT, v9 }
+
+#define fmovicc(suffix, cond, flags) /* v9 */ \
+fmoviccx("fmovd" suffix, FM_DF, "B,H", cond, flags), \
+fmoviccx("fmovq" suffix, FM_QF, "R,J", cond, flags), \
+fmoviccx("fmovs" suffix, FM_SF, "f,g", cond, flags)
+
+#define fmovfcc(suffix, fcond, flags) /* v9 */ \
+fmovfccx("fmovd" suffix, FM_DF, "B,H", fcond, flags), \
+fmovfccx("fmovq" suffix, FM_QF, "R,J", fcond, flags), \
+fmovfccx("fmovs" suffix, FM_SF, "f,g", fcond, flags)
+
+#define fmovcc(suffix, cond, fcond, flags) /* v9 */ \
+fmovccx("fmovd" suffix, FM_DF, "B,H", cond, fcond, flags), \
+fmovccx("fmovq" suffix, FM_QF, "R,J", cond, fcond, flags), \
+fmovccx("fmovs" suffix, FM_SF, "f,g", cond, fcond, flags)
+
+/* v9 */ fmovcc ("a", CONDA, FCONDA, 0),
+/* v9 */ fmovicc ("cc", CONDCC, 0),
+/* v9 */ fmovicc ("cs", CONDCS, 0),
+/* v9 */ fmovcc ("e", CONDE, FCONDE, 0),
+/* v9 */ fmovcc ("g", CONDG, FCONDG, 0),
+/* v9 */ fmovcc ("ge", CONDGE, FCONDGE, 0),
+/* v9 */ fmovicc ("geu", CONDGEU, F_ALIAS),
+/* v9 */ fmovicc ("gu", CONDGU, 0),
+/* v9 */ fmovcc ("l", CONDL, FCONDL, 0),
+/* v9 */ fmovcc ("le", CONDLE, FCONDLE, 0),
+/* v9 */ fmovicc ("leu", CONDLEU, 0),
+/* v9 */ fmovfcc ("lg", FCONDLG, 0),
+/* v9 */ fmovicc ("lu", CONDLU, F_ALIAS),
+/* v9 */ fmovcc ("n", CONDN, FCONDN, 0),
+/* v9 */ fmovcc ("ne", CONDNE, FCONDNE, 0),
+/* v9 */ fmovicc ("neg", CONDNEG, 0),
+/* v9 */ fmovcc ("nz", CONDNZ, FCONDNZ, F_ALIAS),
+/* v9 */ fmovfcc ("o", FCONDO, 0),
+/* v9 */ fmovicc ("pos", CONDPOS, 0),
+/* v9 */ fmovfcc ("u", FCONDU, 0),
+/* v9 */ fmovfcc ("ue", FCONDUE, 0),
+/* v9 */ fmovfcc ("ug", FCONDUG, 0),
+/* v9 */ fmovfcc ("uge", FCONDUGE, 0),
+/* v9 */ fmovfcc ("ul", FCONDUL, 0),
+/* v9 */ fmovfcc ("ule", FCONDULE, 0),
+/* v9 */ fmovicc ("vc", CONDVC, 0),
+/* v9 */ fmovicc ("vs", CONDVS, 0),
+/* v9 */ fmovcc ("z", CONDZ, FCONDZ, F_ALIAS),
+
+#undef fmoviccx /* v9 */
+#undef fmovfccx /* v9 */
+#undef fmovccx /* v9 */
#undef fmovicc /* v9 */
#undef fmovfcc /* v9 */
#undef fmovcc /* v9 */

View File

@ -0,0 +1,677 @@
Signed-off-by: dank@kegel.com
Fixes ld speed issue.
See http://weblogs.mozillazine.org/roc/archives/2005/02/optimizing_gnu.html
See thread "Re: optimizations for 3x speedup in ld",
http://sources.redhat.com/ml/binutils/2005-03/msg00847.html
Wildcard section matching enhancement, backported from the binutils CVS tree.
Here's the CVS log comment from the original change to ldlang.c:
revision 1.177
date: 2005/04/06 15:33:02; author: jakub; state: Exp; lines: +438 -51
2005-04-06 Jakub Jelinek <jakub@redhat.com>
* ldlang.c: Formatting.
(walk_wild_consider_section): Remember return value from wildcardp.
(is_simple_wild): Use strcspn instead of 2 strpbrk calls and strlen.
(wild_spec_can_overlap): Use strcspn instead of strpbrk and strlen.
2005-04-06 Robert O'Callahan <rocallahan@novell.com>
* ld.h (lean_section_userdata_type): Remove.
(fat_section_userdata_type): Remove file field.
(SECTION_USERDATA_SIZE): Remove.
* ldlang.c (init_os): Eliminate initialization of unused
lean_section_userdata_type.
* ldlang.h (callback_t, walk_wild_section_handler_t): New
typedefs.
(struct lang_wild_statement_struct): Add walk_wild_section_handler
and handler_data fields.
* ldlang.c (callback_t): Removed.
(walk_wild_consider_section, walk_wild_section_general,
section_iterator_callback, find_section, is_simple_wild,
match_simple_wild, walk_wild_section_specs1_wild0,
walk_wild_section_specs1_wild1, walk_wild_section_specs2_wild1,
walk_wild_section_specs3_wild2, walk_wild_section_specs4_wild2,
wild_spec_can_overlap, analyze_walk_wild_section_handler): New
functions.
(lang_add_wild): Call analyze_walk_wild_section_handler.
(walk_wild_section): Renamed to walk_wild_section_general and
created a wrapper function.
(section_iterator_callback_data): New typedef.
Note that bfd_get_section_by_name_if didn't exist in 2.15, so it was backported
as well.
--- binutils-2.15/bfd/bfd-in2.h.old 2004-05-17 15:35:56.000000000 -0400
+++ binutils-2.15/bfd/bfd-in2.h 2006-02-09 11:54:45.989940000 -0500
@@ -1425,6 +1425,10 @@
asection *bfd_get_section_by_name (bfd *abfd, const char *name);
+asection *bfd_get_section_by_name_if (bfd *abfd, const char *name,
+ bfd_boolean (*operation) (bfd *, asection *, void *),
+ void *user_storage);
+
char *bfd_get_unique_section_name
(bfd *abfd, const char *templat, int *count);
--- binutils-2.15/bfd/section.c.old 2003-12-01 01:33:01.000000000 -0500
+++ binutils-2.15/bfd/section.c 2006-01-23 14:16:54.768993000 -0500
@@ -801,6 +801,57 @@
/*
FUNCTION
+ bfd_get_section_by_name_if
+
+SYNOPSIS
+ asection *bfd_get_section_by_name_if
+ (bfd *abfd,
+ const char *name,
+ bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
+ void *obj);
+
+DESCRIPTION
+ Call the provided function @var{func} for each section
+ attached to the BFD @var{abfd} whose name matches @var{name},
+ passing @var{obj} as an argument. The function will be called
+ as if by
+
+| func (abfd, the_section, obj);
+
+ It returns the first section for which @var{func} returns true,
+ otherwise <<NULL>>.
+
+*/
+
+asection *
+bfd_get_section_by_name_if (bfd *abfd, const char *name,
+ bfd_boolean (*operation) (bfd *,
+ asection *,
+ void *),
+ void *user_storage)
+{
+ struct section_hash_entry *sh;
+ unsigned long hash;
+
+ sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
+ if (sh == NULL)
+ return NULL;
+
+ hash = sh->root.hash;
+ do
+ {
+ if ((*operation) (abfd, &sh->section, user_storage))
+ return &sh->section;
+ sh = (struct section_hash_entry *) sh->root.next;
+ }
+ while (sh != NULL && sh->root.hash == hash
+ && strcmp (sh->root.string, name) == 0);
+
+ return NULL;
+}
+
+/*
+FUNCTION
bfd_get_unique_section_name
SYNOPSIS
--- binutils-2.15/ld/ldlang.c.old 2004-05-17 15:36:16.000000000 -0400
+++ binutils-2.15/ld/ldlang.c 2006-01-23 13:40:12.745499000 -0500
@@ -81,9 +81,6 @@
static void lang_record_phdrs (void);
static void lang_do_version_exports_section (void);
-typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
- asection *, lang_input_statement_type *, void *);
-
/* Exported variables. */
lang_output_section_statement_type *abs_output_section;
lang_statement_list_type lang_output_section_statement;
@@ -138,21 +135,71 @@
/* Generic traversal routines for finding matching sections. */
+/* Try processing a section against a wildcard. This just calls
+ the callback unless the filename exclusion list is present
+ and excludes the file. It's hardly ever present so this
+ function is very fast. */
+
+static void
+walk_wild_consider_section (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ asection *s,
+ struct wildcard_list *sec,
+ callback_t callback,
+ void *data)
+{
+ bfd_boolean skip = FALSE;
+ struct name_list *list_tmp;
+
+ /* Don't process sections from files which were
+ excluded. */
+ for (list_tmp = sec->spec.exclude_name_list;
+ list_tmp;
+ list_tmp = list_tmp->next)
+ {
+ bfd_boolean is_wildcard = wildcardp (list_tmp->name);
+ if (is_wildcard)
+ skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
+ else
+ skip = strcmp (list_tmp->name, file->filename) == 0;
+
+ /* If this file is part of an archive, and the archive is
+ excluded, exclude this file. */
+ if (! skip && file->the_bfd != NULL
+ && file->the_bfd->my_archive != NULL
+ && file->the_bfd->my_archive->filename != NULL)
+ {
+ if (is_wildcard)
+ skip = fnmatch (list_tmp->name,
+ file->the_bfd->my_archive->filename,
+ 0) == 0;
+ else
+ skip = strcmp (list_tmp->name,
+ file->the_bfd->my_archive->filename) == 0;
+ }
+
+ if (skip)
+ break;
+ }
+
+ if (!skip)
+ (*callback) (ptr, sec, s, file, data);
+}
+
+/* Lowest common denominator routine that can handle everything correctly,
+ but slowly. */
+
static void
-walk_wild_section (lang_wild_statement_type *ptr,
- lang_input_statement_type *file,
- callback_t callback,
- void *data)
+walk_wild_section_general (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
{
asection *s;
-
- if (file->just_syms_flag)
- return;
+ struct wildcard_list *sec;
for (s = file->the_bfd->sections; s != NULL; s = s->next)
{
- struct wildcard_list *sec;
-
sec = ptr->section_list;
if (sec == NULL)
(*callback) (ptr, sec, s, file, data);
@@ -160,39 +207,8 @@
while (sec != NULL)
{
bfd_boolean skip = FALSE;
- struct name_list *list_tmp;
-
- /* Don't process sections from files which were
- excluded. */
- for (list_tmp = sec->spec.exclude_name_list;
- list_tmp;
- list_tmp = list_tmp->next)
- {
- if (wildcardp (list_tmp->name))
- skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
- else
- skip = strcmp (list_tmp->name, file->filename) == 0;
-
- /* If this file is part of an archive, and the archive is
- excluded, exclude this file. */
- if (! skip && file->the_bfd != NULL
- && file->the_bfd->my_archive != NULL
- && file->the_bfd->my_archive->filename != NULL)
- {
- if (wildcardp (list_tmp->name))
- skip = fnmatch (list_tmp->name,
- file->the_bfd->my_archive->filename,
- 0) == 0;
- else
- skip = strcmp (list_tmp->name,
- file->the_bfd->my_archive->filename) == 0;
- }
-
- if (skip)
- break;
- }
- if (!skip && sec->spec.name != NULL)
+ if (sec->spec.name != NULL)
{
const char *sname = bfd_get_section_name (file->the_bfd, s);
@@ -203,13 +219,381 @@
}
if (!skip)
- (*callback) (ptr, sec, s, file, data);
+ walk_wild_consider_section (ptr, file, s, sec, callback, data);
sec = sec->next;
}
}
}
+/* Routines to find a single section given its name. If there's more
+ than one section with that name, we report that. */
+
+typedef struct
+{
+ asection *found_section;
+ bfd_boolean multiple_sections_found;
+} section_iterator_callback_data;
+
+static bfd_boolean
+section_iterator_callback (bfd *bfd ATTRIBUTE_UNUSED, asection *s, void *data)
+{
+ section_iterator_callback_data *d = data;
+
+ if (d->found_section != NULL)
+ {
+ d->multiple_sections_found = TRUE;
+ return TRUE;
+ }
+
+ d->found_section = s;
+ return FALSE;
+}
+
+static asection *
+find_section (lang_input_statement_type *file,
+ struct wildcard_list *sec,
+ bfd_boolean *multiple_sections_found)
+{
+ section_iterator_callback_data cb_data = { NULL, FALSE };
+
+ bfd_get_section_by_name_if (file->the_bfd, sec->spec.name,
+ section_iterator_callback, &cb_data);
+ *multiple_sections_found = cb_data.multiple_sections_found;
+ return cb_data.found_section;
+}
+
+/* Code for handling simple wildcards without going through fnmatch,
+ which can be expensive because of charset translations etc. */
+
+/* A simple wild is a literal string followed by a single '*',
+ where the literal part is at least 4 characters long. */
+
+static bfd_boolean
+is_simple_wild (const char *name)
+{
+ size_t len = strcspn (name, "*?[");
+ return len >= 4 && name[len] == '*' && name[len + 1] == '\0';
+}
+
+static bfd_boolean
+match_simple_wild (const char *pattern, const char *name)
+{
+ /* The first four characters of the pattern are guaranteed valid
+ non-wildcard characters. So we can go faster. */
+ if (pattern[0] != name[0] || pattern[1] != name[1]
+ || pattern[2] != name[2] || pattern[3] != name[3])
+ return FALSE;
+
+ pattern += 4;
+ name += 4;
+ while (*pattern != '*')
+ if (*name++ != *pattern++)
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Specialized, optimized routines for handling different kinds of
+ wildcards */
+
+static void
+walk_wild_section_specs1_wild0 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ /* We can just do a hash lookup for the section with the right name.
+ But if that lookup discovers more than one section with the name
+ (should be rare), we fall back to the general algorithm because
+ we would otherwise have to sort the sections to make sure they
+ get processed in the bfd's order. */
+ bfd_boolean multiple_sections_found;
+ struct wildcard_list *sec0 = ptr->handler_data[0];
+ asection *s0 = find_section (file, sec0, &multiple_sections_found);
+
+ if (multiple_sections_found)
+ walk_wild_section_general (ptr, file, callback, data);
+ else if (s0)
+ walk_wild_consider_section (ptr, file, s0, sec0, callback, data);
+}
+
+static void
+walk_wild_section_specs1_wild1 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ asection *s;
+ struct wildcard_list *wildsec0 = ptr->handler_data[0];
+
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+ bfd_boolean skip = !match_simple_wild (wildsec0->spec.name, sname);
+
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec0, callback, data);
+ }
+}
+
+static void
+walk_wild_section_specs2_wild1 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ asection *s;
+ struct wildcard_list *sec0 = ptr->handler_data[0];
+ struct wildcard_list *wildsec1 = ptr->handler_data[1];
+ bfd_boolean multiple_sections_found;
+ asection *s0 = find_section (file, sec0, &multiple_sections_found);
+
+ if (multiple_sections_found)
+ {
+ walk_wild_section_general (ptr, file, callback, data);
+ return;
+ }
+
+ /* Note that if the section was not found, s0 is NULL and
+ we'll simply never succeed the s == s0 test below. */
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+ /* Recall that in this code path, a section cannot satisfy more
+ than one spec, so if s == s0 then it cannot match
+ wildspec1. */
+ if (s == s0)
+ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
+ else
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname);
+
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec1, callback,
+ data);
+ }
+ }
+}
+
+static void
+walk_wild_section_specs3_wild2 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ asection *s;
+ struct wildcard_list *sec0 = ptr->handler_data[0];
+ struct wildcard_list *wildsec1 = ptr->handler_data[1];
+ struct wildcard_list *wildsec2 = ptr->handler_data[2];
+ bfd_boolean multiple_sections_found;
+ asection *s0 = find_section (file, sec0, &multiple_sections_found);
+
+ if (multiple_sections_found)
+ {
+ walk_wild_section_general (ptr, file, callback, data);
+ return;
+ }
+
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+ if (s == s0)
+ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
+ else
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname);
+
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec1, callback, data);
+ else
+ {
+ skip = !match_simple_wild (wildsec2->spec.name, sname);
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec2, callback,
+ data);
+ }
+ }
+ }
+}
+
+static void
+walk_wild_section_specs4_wild2 (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ asection *s;
+ struct wildcard_list *sec0 = ptr->handler_data[0];
+ struct wildcard_list *sec1 = ptr->handler_data[1];
+ struct wildcard_list *wildsec2 = ptr->handler_data[2];
+ struct wildcard_list *wildsec3 = ptr->handler_data[3];
+ bfd_boolean multiple_sections_found;
+ asection *s0 = find_section (file, sec0, &multiple_sections_found), *s1;
+
+ if (multiple_sections_found)
+ {
+ walk_wild_section_general (ptr, file, callback, data);
+ return;
+ }
+
+ s1 = find_section (file, sec1, &multiple_sections_found);
+ if (multiple_sections_found)
+ {
+ walk_wild_section_general (ptr, file, callback, data);
+ return;
+ }
+
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ {
+ if (s == s0)
+ walk_wild_consider_section (ptr, file, s, sec0, callback, data);
+ else
+ if (s == s1)
+ walk_wild_consider_section (ptr, file, s, sec1, callback, data);
+ else
+ {
+ const char *sname = bfd_get_section_name (file->the_bfd, s);
+ bfd_boolean skip = !match_simple_wild (wildsec2->spec.name,
+ sname);
+
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec2, callback,
+ data);
+ else
+ {
+ skip = !match_simple_wild (wildsec3->spec.name, sname);
+ if (!skip)
+ walk_wild_consider_section (ptr, file, s, wildsec3,
+ callback, data);
+ }
+ }
+ }
+}
+
+static void
+walk_wild_section (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
+{
+ if (file->just_syms_flag)
+ return;
+
+ (*ptr->walk_wild_section_handler) (ptr, file, callback, data);
+}
+
+/* Returns TRUE when name1 is a wildcard spec that might match
+ something name2 can match. We're conservative: we return FALSE
+ only if the prefixes of name1 and name2 are different up to the
+ first wildcard character. */
+
+static bfd_boolean
+wild_spec_can_overlap (const char *name1, const char *name2)
+{
+ size_t prefix1_len = strcspn (name1, "?*[");
+ size_t prefix2_len = strcspn (name2, "?*[");
+ size_t min_prefix_len;
+
+ /* Note that if there is no wildcard character, then we treat the
+ terminating 0 as part of the prefix. Thus ".text" won't match
+ ".text." or ".text.*", for example. */
+ if (name1[prefix1_len] == '\0')
+ prefix1_len++;
+ if (name2[prefix2_len] == '\0')
+ prefix2_len++;
+
+ min_prefix_len = prefix1_len < prefix2_len ? prefix1_len : prefix2_len;
+
+ return memcmp (name1, name2, min_prefix_len) == 0;
+}
+
+/* Select specialized code to handle various kinds of wildcard
+ statements. */
+
+static void
+analyze_walk_wild_section_handler (lang_wild_statement_type *ptr)
+{
+ int sec_count = 0;
+ int wild_name_count = 0;
+ struct wildcard_list *sec;
+ int signature;
+ int data_counter;
+
+ ptr->walk_wild_section_handler = walk_wild_section_general;
+
+ /* Count how many wildcard_specs there are, and how many of those
+ actually use wildcards in the name. Also, bail out if any of the
+ wildcard names are NULL. (Can this actually happen?
+ walk_wild_section used to test for it.) And bail out if any
+ of the wildcards are more complex than a simple string
+ ending in a single '*'. */
+ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
+ {
+ ++sec_count;
+ if (sec->spec.name == NULL)
+ return;
+ if (wildcardp (sec->spec.name))
+ {
+ ++wild_name_count;
+ if (!is_simple_wild (sec->spec.name))
+ return;
+ }
+ }
+
+ /* The zero-spec case would be easy to optimize but it doesn't
+ happen in practice. Likewise, more than 4 specs doesn't
+ happen in practice. */
+ if (sec_count == 0 || sec_count > 4)
+ return;
+
+ /* Check that no two specs can match the same section. */
+ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
+ {
+ struct wildcard_list *sec2;
+ for (sec2 = sec->next; sec2 != NULL; sec2 = sec2->next)
+ {
+ if (wild_spec_can_overlap (sec->spec.name, sec2->spec.name))
+ return;
+ }
+ }
+
+ signature = (sec_count << 8) + wild_name_count;
+ switch (signature)
+ {
+ case 0x0100:
+ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild0;
+ break;
+ case 0x0101:
+ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild1;
+ break;
+ case 0x0201:
+ ptr->walk_wild_section_handler = walk_wild_section_specs2_wild1;
+ break;
+ case 0x0302:
+ ptr->walk_wild_section_handler = walk_wild_section_specs3_wild2;
+ break;
+ case 0x0402:
+ ptr->walk_wild_section_handler = walk_wild_section_specs4_wild2;
+ break;
+ default:
+ return;
+ }
+
+ /* Now fill the data array with pointers to the specs, first the
+ specs with non-wildcard names, then the specs with wildcard
+ names. It's OK to process the specs in different order from the
+ given order, because we've already determined that no section
+ will match more than one spec. */
+ data_counter = 0;
+ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
+ if (!wildcardp (sec->spec.name))
+ ptr->handler_data[data_counter++] = sec;
+ for (sec = ptr->section_list; sec != NULL; sec = sec->next)
+ if (wildcardp (sec->spec.name))
+ ptr->handler_data[data_counter++] = sec;
+}
+
/* Handle a wild statement for a single file F. */
static void
@@ -4353,6 +4737,7 @@
new->section_list = section_list;
new->keep_sections = keep_sections;
lang_list_init (&new->children);
+ analyze_walk_wild_section_handler (new);
}
void
--- binutils-2.15/ld/ldlang.h.old 2004-05-17 15:36:16.000000000 -0400
+++ binutils-2.15/ld/ldlang.h 2006-01-23 13:32:33.653292000 -0500
@@ -295,7 +295,17 @@
union lang_statement_union *file;
} lang_afile_asection_pair_statement_type;
-typedef struct lang_wild_statement_struct
+typedef struct lang_wild_statement_struct lang_wild_statement_type;
+
+typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
+ asection *, lang_input_statement_type *, void *);
+
+typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *,
+ lang_input_statement_type *,
+ callback_t callback,
+ void *data);
+
+struct lang_wild_statement_struct
{
lang_statement_header_type header;
const char *filename;
@@ -303,7 +313,10 @@
struct wildcard_list *section_list;
bfd_boolean keep_sections;
lang_statement_list_type children;
-} lang_wild_statement_type;
+
+ walk_wild_section_handler_t walk_wild_section_handler;
+ struct wildcard_list *handler_data[4];
+};
typedef struct lang_address_statement_struct
{

View File

@ -0,0 +1,33 @@
Signed-off-by: dank@kegel.com
See http://sourceware.org/ml/binutils/2005-12/msg00270.html
http://sourceware.org/ml/binutils-cvs/2005-12/msg00139.html
STABS hash table size change, backported from the binutils CVS tree. Here's
the CVS log comment for the original change:
revision 1.25
date: 2005/12/29 10:29:23; author: nickc; state: Exp; lines: +2 -3
(_bfd_link_section_stabs): Use bfd_hash_table_init rather than
bfd_hash_table_init_n(...,251) so that the size of the hash table can be
controlled by the user.
Note that tunable hash table size changes were added after 2.15. The effect
of this change is to make bfd use its default hash table size for the stabs
hash as well.
--- binutils-2.15/bfd/stabs.c.old 2004-05-17 15:36:04.000000000 -0400
+++ binutils-2.15/bfd/stabs.c 2006-02-09 15:21:56.567014000 -0500
@@ -241,9 +241,8 @@
goto error_return;
/* Make sure the first byte is zero. */
(void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE);
- if (! bfd_hash_table_init_n (&sinfo->includes.root,
- stab_link_includes_newfunc,
- 251))
+ if (! bfd_hash_table_init (&sinfo->includes.root,
+ stab_link_includes_newfunc))
goto error_return;
sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr");
sinfo->stabstr->flags |= SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING;

View File

@ -0,0 +1,42 @@
Message-ID: <000801c48f60$cec16630$9103a8c0@ULOC5012>
From: "Michael Geiger" <mcgege@gmx.de>
To: <dank@kegel.com>
Subject: Patch for cross compiling s/390 kernel on linux host
Date: Tue, 31 Aug 2004 15:45:41 +0200
Dear Dan,
I had big problems compiling a kernel for s/390 on my linux host - I tried
different chains from crosstool-0.28-rc34 and finally succeded with
gcc-3.3.4-glibc-2.3.2 after applying another patch to binutils-2.15
(attached).
All compilations of the different kernel versions I tried stopped with
"Invalid .insn format" somewhere. I checked the recent cvs version of
binutils and applied the latest diff to gas/config/tc-s390.c and that solved
it.
Greetings
Michael Geiger
diff -u -r1.39 -r1.40
--- src/gas/config/tc-s390.c 2004/05/06 11:01:48 1.39
+++ src/gas/config/tc-s390.c 2004/06/15 12:38:08 1.40
@@ -1596,13 +1596,13 @@
if (exp.X_op == O_constant)
{
if ( ( opformat->oplen == 6
- && exp.X_add_number >= 0
+ && (addressT) exp.X_add_number >= 0
&& (addressT) exp.X_add_number < (1ULL << 48))
|| ( opformat->oplen == 4
- && exp.X_add_number >= 0
+ && (addressT) exp.X_add_number >= 0
&& (addressT) exp.X_add_number < (1ULL << 32))
|| ( opformat->oplen == 2
- && exp.X_add_number >= 0
+ && (addressT) exp.X_add_number >= 0
&& (addressT) exp.X_add_number < (1ULL << 16)))
md_number_to_chars (insn, exp.X_add_number, opformat->oplen);
else

View File

@ -0,0 +1,23 @@
Signed-off-by: dank@kegel.com
Raising the size of the hash table is a noticable win when linking
at least one large app.
There was a patch,
http://sources.redhat.com/ml/binutils/2004-06/msg00165.html
to do this dynamically. No idea why that didn't make it in.
So this tiny change to raise the default size is just
a stopgap for now.
--- binutils-2.16.1/bfd/hash.c.old 2006-03-02 23:01:39.000000000 -0800
+++ binutils-2.16.1/bfd/hash.c 2006-03-02 23:01:58.000000000 -0800
@@ -300,7 +300,7 @@
*/
/* The default number of entries to use when creating a hash table. */
-#define DEFAULT_SIZE 4051
+#define DEFAULT_SIZE 32749
static size_t bfd_default_hash_table_size = DEFAULT_SIZE;
/* Create a new hash table, given a number of entries. */

View File

@ -0,0 +1,40 @@
Make psignal prototype in libiberty match that in glibc.
Fixes:
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal':
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype
/usr/include/signal.h:131: prototype declaration
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype
/usr/include/signal.h:131: prototype declaration
gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned
mprotect... make[1]: *** [strsignal.o] Error 1
make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty'
make: *** [all-libiberty] Error 2
when building on red hat 7.1
though it's a bit of a mystery why libiberty's psignal is being compiled at
all, since red hat 7.1's glibc supports psignal (hence the error message)
--- binutils-2.15/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700
+++ binutils-2.15/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700
@@ -544,7 +544,7 @@
/*
-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
+@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message})
Print @var{message} to the standard error, followed by a colon,
followed by the description of the signal specified by @var{signo},
@@ -557,9 +557,7 @@
#ifndef HAVE_PSIGNAL
void
-psignal (signo, message)
- unsigned signo;
- char *message;
+psignal (int signo, const char *message)
{
if (signal_names == NULL)
{

View File

@ -0,0 +1,95 @@
[removed first hunk so it would apply to 2.16.1 - copyright date already updated - dank]
Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html
Fixes
localealias.s:544: Error: junk at end of line, first unrecognized character is `,'
when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3
Paths adjusted to match crosstool's patcher.
Message-Id: m3n052qw2g.fsf@whitebox.m5r.de
From: Andreas Schwab <schwab at suse dot de>
To: Nathan Sidwell <nathan at codesourcery dot com>
Cc: Ian Lance Taylor <ian at wasabisystems dot com>, binutils at sources dot redhat dot com
Date: Fri, 23 Apr 2004 22:27:19 +0200
Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line
Nathan Sidwell <nathan@codesourcery.com> writes:
> Index: read.c
> ===================================================================
> RCS file: /cvs/src/src/gas/read.c,v
> retrieving revision 1.76
> diff -c -3 -p -r1.76 read.c
> *** read.c 12 Mar 2004 17:48:12 -0000 1.76
> --- read.c 18 Mar 2004 09:56:05 -0000
> *************** read_a_source_file (char *name)
> *** 1053,1059 ****
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! ignore_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
> --- 1053,1059 ----
> #endif
> input_line_pointer--;
> /* Report unknown char as ignored. */
> ! demand_empty_rest_of_line ();
> }
>
> #ifdef md_after_pass_hook
This means that the unknown character is no longer ignored, despite the
comment. As a side effect a line starting with a line comment character
not followed by APP in NO_APP mode now triggers an error instead of just a
warning, breaking builds of glibc on m68k-linux. Earlier in
read_a_source_file where #APP is handled there is another comment that
claims that unknown comments are ignored, when in fact they aren't (only
the initial line comment character is skipped).
Note that the presence of #APP will mess up the line counters, but
that appears to be difficult to fix.
Andreas.
2004-04-23 Andreas Schwab <schwab@suse.de>
* read.c (read_a_source_file): Ignore unknown text after line
comment character. Fix misleading comment.
--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200
+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200
@@ -950,10 +950,14 @@ read_a_source_file (char *name)
unsigned int new_length;
char *tmp_buf = 0;
- bump_line_counters ();
s = input_line_pointer;
if (strncmp (s, "APP\n", 4))
- continue; /* We ignore it */
+ {
+ /* We ignore it */
+ ignore_rest_of_line ();
+ continue;
+ }
+ bump_line_counters ();
s += 4;
sb_new (&sbuf);
@@ -1052,7 +1056,7 @@ read_a_source_file (char *name)
continue;
#endif
input_line_pointer--;
- /* Report unknown char as ignored. */
+ /* Report unknown char as error. */
demand_empty_rest_of_line ();
}
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstra&#xC3;e 5, 90409 N&#xC3;rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Some files were not shown because too many files have changed in this diff Show More