Merge [2121], [2122], [2123], [2124], [2125], [2126], and [2127] from trunk.
[2121]: Mark gen_x86_insn.py outputs as generated.
[2122]: Don't read past end of string in parsers (not bug).
[2123]: Fix expression simplification bug.
[2124]: Warn if unused groups are detected in gen_x86_insn.py.
[2125]: VPBLENDVB doesn't have a 256-bit form; remove it.
[2126]: Generate GOTPCREL relocation for [rel foo wrt ..gotpc].
[2127]: Optimize non-strict push with 66 override to byte size if possible.

svn path=/branches/yasm-0.7.x/; revision=2148
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index bc49eee..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-PROJECT(yasm)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
-
-SET(BUILD_SHARED_LIBS ON)
-
-# Where to look first for cmake modules
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
-
-INCLUDE(YasmMacros)
-
-OPTION(ENABLE_NLS "Enable message translations" OFF)
-
-OPTION(YASM_BUILD_TESTS "Enable building of tests" ON)
-
-IF(YASM_BUILD_TESTS)
-    ENABLE_TESTING()
-ENDIF(YASM_BUILD_TESTS)
-
-# Default build type to debug if not set
-IF(NOT CMAKE_BUILD_TYPE)
-  SET(CMAKE_BUILD_TYPE Debug CACHE STRING
-      "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
-      FORCE)
-ENDIF(NOT CMAKE_BUILD_TYPE)
-
-set (YASM_VERSION_MAJOR 0)
-set (YASM_VERSION_MINOR 6)
-set (YASM_VERSION_SUBMINOR 99)
-set (PACKAGE_INTVER "${YASM_VERSION_MAJOR}.${YASM_VERSION_MINOR}.${YASM_VERSION_SUBMINOR}")
-set (PACKAGE_BUILD "HEAD")
-set (PACKAGE_VERSION ${PACKAGE_BUILD})
-set (PACKAGE_STRING "yasm ${PACKAGE_VERSION}")
-
-INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR} ${yasm_SOURCE_DIR})
-
-INCLUDE(ConfigureChecks.cmake)
-
-ADD_SUBDIRECTORY(tools)
-ADD_SUBDIRECTORY(libyasm)
-ADD_SUBDIRECTORY(modules)
-ADD_SUBDIRECTORY(frontends)
-
-INSTALL(FILES
-    libyasm.h
-    ${CMAKE_BINARY_DIR}/libyasm-stdint.h
-    DESTINATION include
-    )
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
deleted file mode 100644
index 4b05d04..0000000
--- a/ConfigureChecks.cmake
+++ /dev/null
@@ -1,74 +0,0 @@
-INCLUDE(CheckCSourceCompiles)
-INCLUDE(CheckCCompilerFlag)
-INCLUDE(CheckFunctionExists)
-INCLUDE(CheckIncludeFile)
-INCLUDE(CheckSymbolExists)
-INCLUDE(CheckTypeSize)
-INCLUDE(CheckLibraryExists)
-
-FIND_PROGRAM(CPP_PROG NAMES cpp)
-
-# Platform-specific include files (POSIX, Win32)
-CHECK_INCLUDE_FILE(locale.h HAVE_LOCALE_H)
-CHECK_INCLUDE_FILE(libgen.h HAVE_LIBGEN_H)
-CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
-CHECK_INCLUDE_FILE(direct.h HAVE_DIRECT_H)
-CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
-
-CHECK_SYMBOL_EXISTS(abort "stdlib.h" HAVE_ABORT)
-
-CHECK_FUNCTION_EXISTS(getcwd HAVE_GETCWD)
-CHECK_FUNCTION_EXISTS(toascii HAVE_TOASCII)
-
-CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
-
-IF (HAVE_LIBDL)
-    SET(LIBDL "dl")
-ELSE (HAVE_LIBDL)
-    SET(LIBDL "")
-ENDIF (HAVE_LIBDL)
-
-CONFIGURE_FILE(libyasm-stdint.h.cmake
-               ${CMAKE_CURRENT_BINARY_DIR}/libyasm-stdint.h)
-CONFIGURE_FILE(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
-
-ADD_DEFINITIONS(-DHAVE_CONFIG_H)
-
-INCLUDE(FindPythonInterp)
-IF (NOT PYTHON_EXECUTABLE)
-    MESSAGE(FATAL_ERROR "Could not find Python executable")
-ENDIF (NOT PYTHON_EXECUTABLE)
-
-IF (CMAKE_COMPILER_IS_GNUCXX)
-    CHECK_C_COMPILER_FLAG(-pipe C_ACCEPTS_PIPE)
-    CHECK_C_COMPILER_FLAG(-ansi C_ACCEPTS_ANSI)
-    CHECK_C_COMPILER_FLAG(-pedantic C_ACCEPTS_PEDANTIC)
-    CHECK_C_COMPILER_FLAG(-Wall C_ACCEPTS_WALL)
-    CHECK_C_COMPILER_FLAG(-Wno-unused-parameter C_ACCEPTS_WNOUNUSEDPARAM)
-
-    IF (C_ACCEPTS_PIPE)
-        ADD_DEFINITIONS(-pipe)
-    ENDIF (C_ACCEPTS_PIPE)
-
-    IF (C_ACCEPTS_ANSI)
-        ADD_DEFINITIONS(-ansi)
-    ENDIF (C_ACCEPTS_ANSI)
-
-    IF (C_ACCEPTS_PEDANTIC)
-        ADD_DEFINITIONS(-pedantic)
-    ENDIF (C_ACCEPTS_PEDANTIC)
-
-    IF (C_ACCEPTS_WALL)
-        ADD_DEFINITIONS(-Wall)
-    ENDIF (C_ACCEPTS_WALL)
-
-    IF (C_ACCEPTS_WNOUNUSEDPARAM)
-        ADD_DEFINITIONS(-Wno-unused-parameter)
-    ENDIF (C_ACCEPTS_WNOUNUSEDPARAM)
-ENDIF (CMAKE_COMPILER_IS_GNUCXX)
-
-# Disable some annoying Visual Studio warnings
-IF (MSVC)
-    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
-    ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)
-ENDIF (MSVC)
diff --git a/Mkfiles/Makefile.dj b/Mkfiles/Makefile.dj
index ac10158..56afb28 100644
--- a/Mkfiles/Makefile.dj
+++ b/Mkfiles/Makefile.dj
@@ -157,25 +157,13 @@
 
 frontends/yasm/yasm.c: license.c
 
-genmacro: tools/genmacro/genmacro.c
+genmacro: modules/preprocs/nasm/genmacro.c
 	$(BUILDCC) -o $@ $<
 
-nasm-version.c: version.mac genmacro
-	./genmacro $@ nasm_version_mac version.mac
+nasm-macros.c: modules/preprocs/nasm/standard.mac version.mac genmacro
+	./genmacro modules/preprocs/nasm/standard.mac version.mac
 
-modules/preprocs/nasm/nasm-pp.c: nasm-version.c
-
-nasm-macros.c: modules/parsers/nasm/nasm-std.mac genmacro
-	./genmacro $@ nasm_standard_mac modules/parsers/nasm/nasm-std.mac
-
-modules/parsers/nasm/nasm-parser.c: nasm-macros.c
-
-win64-nasm.c: modules/objfmts/coff/win64-nasm.mac genmacro
-	./genmacro $@ win64_nasm_stdmac modules/objfmts/coff/win64-nasm.mac
-win64-gas.c: modules/objfmts/coff/win64-gas.mac genmacro
-	./genmacro $@ win64_gas_stdmac modules/objfmts/coff/win64-gas.mac
-
-modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
+modules/preprocs/nasm/nasm-pp.c: nasm-macros.c
 
 genversion: modules/preprocs/nasm/genversion.c
 	$(BUILDCC) -IMkfiles/dj -o $@ $<
diff --git a/Mkfiles/Makefile.flat b/Mkfiles/Makefile.flat
index e9aec97..2dd1b56 100644
--- a/Mkfiles/Makefile.flat
+++ b/Mkfiles/Makefile.flat
@@ -160,25 +160,13 @@
 
 frontends/yasm/yasm.c: license.c
 
-genmacro: tools/genmacro/genmacro.c
+genmacro: modules/preprocs/nasm/genmacro.c
 	$(BUILDCC) -o $@ $<
 
-nasm-version.c: version.mac genmacro
-	./genmacro $@ nasm_version_mac version.mac
+nasm-macros.c: modules/preprocs/nasm/standard.mac version.mac genmacro
+	./genmacro modules/preprocs/nasm/standard.mac version.mac
 
-modules/preprocs/nasm/nasm-pp.c: nasm-version.c
-
-nasm-macros.c: modules/parsers/nasm/nasm-std.mac genmacro
-	./genmacro $@ nasm_standard_mac modules/parsers/nasm/nasm-std.mac
-
-modules/parsers/nasm/nasm-parser.c: nasm-macros.c
-
-win64-nasm.c: modules/objfmts/coff/win64-nasm.mac genmacro
-	./genmacro $@ win64_nasm_stdmac modules/objfmts/coff/win64-nasm.mac
-win64-gas.c: modules/objfmts/coff/win64-gas.mac genmacro
-	./genmacro $@ win64_gas_stdmac modules/objfmts/coff/win64-gas.mac
-
-modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
+modules/preprocs/nasm/nasm-pp.c: nasm-macros.c
 
 genversion: modules/preprocs/nasm/genversion.c
 	$(BUILDCC) -IMkfiles -I. -o $@ $<
diff --git a/Mkfiles/dj/config.h b/Mkfiles/dj/config.h
index 2ba1985..e59a2f9 100644
--- a/Mkfiles/dj/config.h
+++ b/Mkfiles/dj/config.h
@@ -116,22 +116,22 @@
 #define PACKAGE_BUGREPORT "bug-yasm@tortall.net"

 

 /* Define to build version of this package. */

-#define PACKAGE_BUILD "HEAD"

+#define PACKAGE_BUILD "BRANCH"

 

 /* Define to internal version of this package. */

-#define PACKAGE_INTVER "0.7.99"

+#define PACKAGE_INTVER "0.7.2"

 

 /* Define to the full name of this package. */

 #define PACKAGE_NAME "yasm"

 

 /* Define to the full name and version of this package. */

-#define PACKAGE_STRING "yasm HEAD"

+#define PACKAGE_STRING "yasm 0.7.x"

 

 /* Define to the one symbol short name of this package. */

 #define PACKAGE_TARNAME "yasm"

 

 /* Define to the version of this package. */

-#define PACKAGE_VERSION "HEAD"

+#define PACKAGE_VERSION "0.7.x"

 

 /* Define if the C compiler supports function prototypes. */

 #define PROTOTYPES 1

@@ -155,7 +155,7 @@
 #define STDC_HEADERS 1

 

 /* Version number of package */

-#define VERSION "HEAD"

+#define VERSION "0.7.x"

 

 /* Define if using the dmalloc debugging malloc package */

 /* #undef WITH_DMALLOC */

diff --git a/Mkfiles/vc/config.h b/Mkfiles/vc/config.h
index 204f224..c05bc9e 100644
--- a/Mkfiles/vc/config.h
+++ b/Mkfiles/vc/config.h
@@ -117,22 +117,22 @@
 #define PACKAGE_BUGREPORT "bug-yasm@tortall.net"

 

 /* Define to build version of this package. */

-#define PACKAGE_BUILD "HEAD"

+#define PACKAGE_BUILD "BRANCH"

 

 /* Define to internal version of this package. */

-#define PACKAGE_INTVER "0.7.99"

+#define PACKAGE_INTVER "0.7.2"

 

 /* Define to the full name of this package. */

 #define PACKAGE_NAME "yasm"

 

 /* Define to the full name and version of this package. */

-#define PACKAGE_STRING "yasm HEAD"

+#define PACKAGE_STRING "yasm 0.7.x"

 

 /* Define to the one symbol short name of this package. */

 #define PACKAGE_TARNAME "yasm"

 

 /* Define to the version of this package. */

-#define PACKAGE_VERSION "HEAD"

+#define PACKAGE_VERSION "0.7.x"

 

 /* Define if the C compiler supports function prototypes. */

 #define PROTOTYPES 1

@@ -156,7 +156,7 @@
 #define STDC_HEADERS 1

 

 /* Version number of package */

-#define VERSION "HEAD"

+#define VERSION "0.7.x"

 

 /* Define if using the dmalloc debugging malloc package */

 /* #undef WITH_DMALLOC */

diff --git a/Mkfiles/vc/genmacro/genmacro.vcproj b/Mkfiles/vc/genmacro/genmacro.vcproj
index 6ca8a82..0f18b4b 100644
--- a/Mkfiles/vc/genmacro/genmacro.vcproj
+++ b/Mkfiles/vc/genmacro/genmacro.vcproj
@@ -116,7 +116,7 @@
 			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"

 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">

 			<File

-				RelativePath="..\..\..\tools\genmacro\genmacro.c">

+				RelativePath="..\..\..\modules\preprocs\nasm\genmacro.c">

 			</File>

 		</Filter>

 		<File

diff --git a/Mkfiles/vc/genmacro/run.bat b/Mkfiles/vc/genmacro/run.bat
index d2fbb98..f3323e7 100644
--- a/Mkfiles/vc/genmacro/run.bat
+++ b/Mkfiles/vc/genmacro/run.bat
@@ -1,5 +1,2 @@
 cd ..\..\..

-%1 nasm-version.c nasm_version_mac version.mac

-%1 nasm-macros.c nasm_standard_mac modules\parsers\nasm\nasm-std.mac

-%1 win64-nasm.c win64_nasm_stdmac modules\objfmts\coff\win64-nasm.mac

-%1 win64-gas.c win64_gas_stdmac modules\objfmts\coff\win64-gas.mac

+%1 modules\preprocs\nasm\standard.mac version.mac

diff --git a/Mkfiles/vc8/config.h b/Mkfiles/vc8/config.h
index 96e2ddd..53fbf5d 100644
--- a/Mkfiles/vc8/config.h
+++ b/Mkfiles/vc8/config.h
@@ -117,22 +117,22 @@
 #define PACKAGE_BUGREPORT "bug-yasm@tortall.net"

 

 /* Define to build version of this package. */

-#define PACKAGE_BUILD "HEAD"

+#define PACKAGE_BUILD "BRANCH"

 

 /* Define to internal version of this package. */

-#define PACKAGE_INTVER "0.7.99"

+#define PACKAGE_INTVER "0.7.2"

 

 /* Define to the full name of this package. */

 #define PACKAGE_NAME "yasm"

 

 /* Define to the full name and version of this package. */

-#define PACKAGE_STRING "yasm HEAD"

+#define PACKAGE_STRING "yasm 0.7.x"

 

 /* Define to the one symbol short name of this package. */

 #define PACKAGE_TARNAME "yasm"

 

 /* Define to the version of this package. */

-#define PACKAGE_VERSION "HEAD"

+#define PACKAGE_VERSION "0.7.x"

 

 /* Define if the C compiler supports function prototypes. */

 #define PROTOTYPES 1

@@ -156,7 +156,7 @@
 #define STDC_HEADERS 1

 

 /* Version number of package */

-#define VERSION "HEAD"

+#define VERSION "0.7.x"

 

 /* Define if using the dmalloc debugging malloc package */

 /* #undef WITH_DMALLOC */

diff --git a/Mkfiles/vc8/genmacro/genmacro.vcproj b/Mkfiles/vc8/genmacro/genmacro.vcproj
index c004697..6c0b611 100644
--- a/Mkfiles/vc8/genmacro/genmacro.vcproj
+++ b/Mkfiles/vc8/genmacro/genmacro.vcproj
@@ -187,7 +187,7 @@
 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"

 			>

 			<File

-				RelativePath="..\..\..\tools\genmacro\genmacro.c"

+				RelativePath="..\..\..\modules\preprocs\nasm\genmacro.c"

 				>

 			</File>

 		</Filter>

diff --git a/Mkfiles/vc8/genmacro/run.bat b/Mkfiles/vc8/genmacro/run.bat
index d2fbb98..f3323e7 100644
--- a/Mkfiles/vc8/genmacro/run.bat
+++ b/Mkfiles/vc8/genmacro/run.bat
@@ -1,5 +1,2 @@
 cd ..\..\..

-%1 nasm-version.c nasm_version_mac version.mac

-%1 nasm-macros.c nasm_standard_mac modules\parsers\nasm\nasm-std.mac

-%1 win64-nasm.c win64_nasm_stdmac modules\objfmts\coff\win64-nasm.mac

-%1 win64-gas.c win64_gas_stdmac modules\objfmts\coff\win64-gas.mac

+%1 modules\preprocs\nasm\standard.mac version.mac

diff --git a/Mkfiles/vc9/config.h b/Mkfiles/vc9/config.h
index 96e2ddd..53fbf5d 100644
--- a/Mkfiles/vc9/config.h
+++ b/Mkfiles/vc9/config.h
@@ -117,22 +117,22 @@
 #define PACKAGE_BUGREPORT "bug-yasm@tortall.net"

 

 /* Define to build version of this package. */

-#define PACKAGE_BUILD "HEAD"

+#define PACKAGE_BUILD "BRANCH"

 

 /* Define to internal version of this package. */

-#define PACKAGE_INTVER "0.7.99"

+#define PACKAGE_INTVER "0.7.2"

 

 /* Define to the full name of this package. */

 #define PACKAGE_NAME "yasm"

 

 /* Define to the full name and version of this package. */

-#define PACKAGE_STRING "yasm HEAD"

+#define PACKAGE_STRING "yasm 0.7.x"

 

 /* Define to the one symbol short name of this package. */

 #define PACKAGE_TARNAME "yasm"

 

 /* Define to the version of this package. */

-#define PACKAGE_VERSION "HEAD"

+#define PACKAGE_VERSION "0.7.x"

 

 /* Define if the C compiler supports function prototypes. */

 #define PROTOTYPES 1

@@ -156,7 +156,7 @@
 #define STDC_HEADERS 1

 

 /* Version number of package */

-#define VERSION "HEAD"

+#define VERSION "0.7.x"

 

 /* Define if using the dmalloc debugging malloc package */

 /* #undef WITH_DMALLOC */

diff --git a/Mkfiles/vc9/genmacro/genmacro.vcproj b/Mkfiles/vc9/genmacro/genmacro.vcproj
index e6980bc..2213150 100644
--- a/Mkfiles/vc9/genmacro/genmacro.vcproj
+++ b/Mkfiles/vc9/genmacro/genmacro.vcproj
@@ -186,7 +186,7 @@
 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"

 			>

 			<File

-				RelativePath="..\..\..\tools\genmacro\genmacro.c"

+				RelativePath="..\..\..\modules\preprocs\nasm\genmacro.c"

 				>

 			</File>

 		</Filter>

diff --git a/Mkfiles/vc9/genmacro/run.bat b/Mkfiles/vc9/genmacro/run.bat
index d2fbb98..f3323e7 100644
--- a/Mkfiles/vc9/genmacro/run.bat
+++ b/Mkfiles/vc9/genmacro/run.bat
@@ -1,5 +1,2 @@
 cd ..\..\..

-%1 nasm-version.c nasm_version_mac version.mac

-%1 nasm-macros.c nasm_standard_mac modules\parsers\nasm\nasm-std.mac

-%1 win64-nasm.c win64_nasm_stdmac modules\objfmts\coff\win64-nasm.mac

-%1 win64-gas.c win64_gas_stdmac modules\objfmts\coff\win64-gas.mac

+%1 modules\preprocs\nasm\standard.mac version.mac

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
deleted file mode 100644
index 5e4ef79..0000000
--- a/cmake/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-ADD_SUBDIRECTORY(modules)
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
deleted file mode 100644
index e4351fc..0000000
--- a/cmake/modules/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-FILE(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake")
-
diff --git a/cmake/modules/DummyCFile.c b/cmake/modules/DummyCFile.c
deleted file mode 100644
index f8b643a..0000000
--- a/cmake/modules/DummyCFile.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int main()
-{
-  return 0;
-}
diff --git a/cmake/modules/YasmMacros.cmake b/cmake/modules/YasmMacros.cmake
deleted file mode 100644
index ab1be00..0000000
--- a/cmake/modules/YasmMacros.cmake
+++ /dev/null
@@ -1,89 +0,0 @@
-# Portions based on kdelibs KDE4Macros.cmake:
-#
-# Copyright (c) 2006, 2007, Alexander Neundorf, <neundorf@kde.org>
-# Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org>
-# Copyright (c) 2007 Matthias Kretz <kretz@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-#
-# Changes for Yasm Copyright (c) 2007 Peter Johnson
-
-# add a unit test, which is executed when running make test
-# it will be built with RPATH pointing to the build dir
-# The targets are always created, but only built for the "all"
-# target if the option YASM_BUILD_TESTS is enabled. Otherwise the rules for
-# the target are created but not built by default. You can build them by
-# manually building the target.
-# The name of the target can be specified using TESTNAME <testname>, if it is
-# not given the macro will default to the <name>
-macro (YASM_ADD_UNIT_TEST _test_NAME)
-    set(_srcList ${ARGN})
-    set(_targetName ${_test_NAME})
-    if( ${ARGV1} STREQUAL "TESTNAME" )
-        set(_targetName ${ARGV2})
-        LIST(REMOVE_AT _srcList 0 1)
-    endif( ${ARGV1} STREQUAL "TESTNAME" )
-    yasm_add_test_executable( ${_test_NAME} ${_srcList} )
-    add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} )
-endmacro (YASM_ADD_UNIT_TEST)
-
-# add an test executable
-# it will be built with RPATH pointing to the build dir
-# The targets are always created, but only built for the "all"
-# target if the option YASM_BUILD_TESTS is enabled. Otherwise the rules for
-# the target are created but not built by default. You can build them by
-# manually building the target.
-macro (YASM_ADD_TEST_EXECUTABLE _target_NAME)
-
-   set(_add_executable_param)
-
-   if (NOT YASM_BUILD_TESTS)
-      set(_add_executable_param EXCLUDE_FROM_ALL)
-   endif (NOT YASM_BUILD_TESTS)
-
-   set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
-
-   set(_SRCS ${ARGN})
-   add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS})
-
-   set_target_properties(${_target_NAME} PROPERTIES
-                         SKIP_BUILD_RPATH FALSE
-                         BUILD_WITH_INSTALL_RPATH FALSE)
-
-endmacro (YASM_ADD_TEST_EXECUTABLE)
-
-macro (YASM_ADD_MODULE _module_NAME)
-    list(APPEND YASM_MODULES_SRC ${ARGN})
-    list(APPEND YASM_MODULES ${_module_NAME})
-endmacro (YASM_ADD_MODULE)
-
-macro (YASM_GENPERF _in_NAME _out_NAME)
-    get_target_property(_tmp_GENPERF_EXE genperf LOCATION)
-    add_custom_command(
-        OUTPUT ${_out_NAME}
-        COMMAND ${_tmp_GENPERF_EXE} ${_in_NAME} ${_out_NAME}
-        DEPENDS ${_tmp_GENPERF_EXE}
-        MAIN_DEPENDENCY ${_in_NAME}
-        )
-endmacro (YASM_GENPERF)
-
-macro (YASM_RE2C _in_NAME _out_NAME)
-    get_target_property(_tmp_RE2C_EXE re2c LOCATION)
-    add_custom_command(
-        OUTPUT ${_out_NAME}
-        COMMAND ${_tmp_RE2C_EXE} ${ARGN} -o ${_out_NAME} ${_in_NAME}
-        DEPENDS ${_tmp_RE2C_EXE}
-        MAIN_DEPENDENCY ${_in_NAME}
-        )
-endmacro (YASM_RE2C)
-
-macro (YASM_GENMACRO _in_NAME _out_NAME _var_NAME)
-    get_target_property(_tmp_GENMACRO_EXE genmacro LOCATION)
-    add_custom_command(
-        OUTPUT ${_out_NAME}
-        COMMAND ${_tmp_GENMACRO_EXE} ${_out_NAME} ${_var_NAME} ${_in_NAME}
-        DEPENDS ${_tmp_GENMACRO_EXE}
-        MAIN_DEPENDENCY ${_in_NAME}
-        )
-endmacro (YASM_GENMACRO)
-
diff --git a/config.h.cmake b/config.h.cmake
deleted file mode 100644
index d282b93..0000000
--- a/config.h.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
-/* config.h.  Generated by cmake from config.h.cmake */
-
-#define CMAKE_BUILD 1
-
-/* Define if messsage translations are enabled */
-#cmakedefine ENABLE_NLS 1
-
-/* */
-#undef HAVE_GETTEXT
-
-/* Define to 1 if you have the <libgen.h> header file. */
-#cmakedefine HAVE_LIBGEN_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#cmakedefine HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the <direct.h> header file. */
-#cmakedefine HAVE_DIRECT_H 1
-
-/* Define to 1 if you have the `getcwd' function. */
-#cmakedefine HAVE_GETCWD 1
-
-/* Define to 1 if you have the `toascii' function. */
-#cmakedefine HAVE_TOASCII 1
-
-/* Name of package */
-#define PACKAGE "yasm"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "bug-yasm@tortall.net"
-
-/* Define to internal version of this package. */
-#define PACKAGE_INTVER "@PACKAGE_INTVER@"
-
-/* Define to build version of this package. */
-#define PACKAGE_BUILD "@PACKAGE_BUILD@"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "yasm"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "@PACKAGE_STRING@"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "@PACKAGE_VERSION@"
-
-#define VERSION PACKAGE_VERSION
-
-/* Command name to run C preprocessor */
-#define CPP_PROG "@CPP_PROG@"
-
diff --git a/configure.ac b/configure.ac
index 9751062..ea1372f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,17 +5,17 @@
 # autoconf setup
 #
 AC_PREREQ(2.53)
-AC_INIT([yasm], [HEAD], [bug-yasm@tortall.net])
+AC_INIT([yasm], [0.7.x], [bug-yasm@tortall.net])
 #AC_CONFIG_SRCDIR([src/main.c])
 AC_CONFIG_AUX_DIR(config)
 AM_CONFIG_HEADER([config.h])
 
-AM_INIT_AUTOMAKE(yasm, [HEAD])
+AM_INIT_AUTOMAKE(yasm, [0.7.x])
 AM_MAINTAINER_MODE
 
-AC_DEFINE(PACKAGE_INTVER, ["0.7.99"],
+AC_DEFINE(PACKAGE_INTVER, ["0.7.2"],
 	  [Define to internal version of this package.])
-AC_DEFINE(PACKAGE_BUILD, ["HEAD"], [Define to build version of this package.])
+AC_DEFINE(PACKAGE_BUILD, ["BRANCH"], [Define to build version of this package.])
 
 #
 # autoconf command-line options
diff --git a/frontends/CMakeLists.txt b/frontends/CMakeLists.txt
deleted file mode 100644
index b8b55d2..0000000
--- a/frontends/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-ADD_SUBDIRECTORY(yasm)
diff --git a/frontends/yasm/CMakeLists.txt b/frontends/yasm/CMakeLists.txt
deleted file mode 100644
index 6d963eb..0000000
--- a/frontends/yasm/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
-
-ADD_CUSTOM_COMMAND(
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/license.c
-    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/genstring.py
-        license_msg
-        ${CMAKE_CURRENT_BINARY_DIR}/license.c
-        ${CMAKE_SOURCE_DIR}/COPYING
-    MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/COPYING
-    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/genstring.py
-    )
-
-SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
-
-ADD_EXECUTABLE(yasm
-    yasm.c
-    yasm-options.c
-    yasm-plugin.c
-    )
-TARGET_LINK_LIBRARIES(yasm libyasm ${LIBDL})
-
-SET_SOURCE_FILES_PROPERTIES(yasm.c PROPERTIES
-    OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/license.c
-    )
-
-INSTALL(TARGETS yasm RUNTIME DESTINATION bin)
diff --git a/frontends/yasm/genstring.py b/frontends/yasm/genstring.py
deleted file mode 100755
index 96f49d9..0000000
--- a/frontends/yasm/genstring.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-# Generate array-of-const-string from text file.
-#
-#  Copyright (C) 2006-2007  Peter Johnson
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-def file_to_string(fout, str_name, fin_name):
-    from os.path import basename
-    print >>fout, "/* This file auto-generated from %s by genstring.py - don't edit it */\n" % basename(fin_name)
-    print >>fout, "static const char* %s[] = {" % str_name
-    print >>fout, "\n".join('    "%s",' %
-                            l.strip().replace('\\', '\\\\').replace('"', '\\"')
-                            for l in open(fin_name))
-    print >>fout, "};"
-
-if __name__ == "__main__":
-    import sys
-    if len(sys.argv) != 4:
-        print >>sys.stderr, "Usage: genstring.py <string> <outfile> <file>"
-        sys.exit(2)
-    file_to_string(open(sys.argv[2], "w"), sys.argv[1], sys.argv[3])
diff --git a/frontends/yasm/yasm-plugin.c b/frontends/yasm/yasm-plugin.c
deleted file mode 100644
index a04c42b..0000000
--- a/frontends/yasm/yasm-plugin.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Semi-portable (Windows and Unix) plugin loading
- *
- *  Copyright (C) 2008  Peter Johnson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#include <util.h>
-/*@unused@*/ RCSID("$Id$");
-
-#include <string.h>
-
-#include "libyasm-stdint.h"
-#include "yasm-plugin.h"
-
-#if defined(_MSC_VER)
-#include <windows.h>
-#elif defined(__GNUC__)
-#include <dlfcn.h>
-#endif
-
-static void **loaded_plugins = NULL;
-static int num_loaded_plugins = 0;
-
-static void *
-load_dll(const char *name)
-{
-#if defined(_MSC_VER)
-    return LoadLibrary(name);
-#elif defined(__GNUC__)
-    return dlopen(name, RTLD_NOW);
-#else
-    return NULL;
-#endif
-}
-
-int
-load_plugin(const char *name)
-{
-    char *path;
-    void *lib = NULL;
-    void (*init_plugin) (void) = NULL;
-
-    /* Load library */
-
-    path = yasm_xmalloc(strlen(name)+10);
-#if defined(_MSC_VER)
-    strcpy(path, name);
-    strcat(path, ".dll");
-    lib = load_dll(path);
-#elif defined(__GNUC__)
-    strcpy(path, "lib");
-    strcat(path, name);
-    strcat(path, ".so");
-    lib = load_dll(path);
-    if (!lib) {
-        strcpy(path, name);
-        strcat(path, ".so");
-        lib = load_dll(path);
-    }
-#endif
-    yasm_xfree(path);
-    if (!lib)
-        lib = load_dll(name);
-
-    if (!lib)
-        return 0;       /* Didn't load successfully */
-
-    /* Add to array of loaded plugins */
-    loaded_plugins =
-        yasm_xrealloc(loaded_plugins, (num_loaded_plugins+1)*sizeof(void *));
-    loaded_plugins[num_loaded_plugins] = lib;
-    num_loaded_plugins++;
-
-    /* Get yasm_init_plugin() function and run it */
-
-#if defined(_MSC_VER)
-    init_plugin =
-        (void (*)(void))GetProcAddress((HINSTANCE)lib, "yasm_init_plugin");
-#elif defined(__GNUC__)
-    init_plugin = (void (*)(void))(uintptr_t)dlsym(lib, "yasm_init_plugin");
-#endif
-
-    if (!init_plugin)
-        return 0;       /* Didn't load successfully */
-
-    init_plugin();
-    return 1;
-}
-
-void
-unload_plugins(void)
-{
-    int i;
-
-    if (!loaded_plugins)
-        return;
-
-    for (i = 0; i < num_loaded_plugins; i++) {
-#if defined(_MSC_VER)
-        FreeLibrary((HINSTANCE)loaded_plugins[i]);
-#elif defined(__GNUC__)
-        dlclose(loaded_plugins[i]);
-#endif
-    }
-    yasm_xfree(loaded_plugins);
-    num_loaded_plugins = 0;
-}
diff --git a/frontends/yasm/yasm-plugin.h b/frontends/yasm/yasm-plugin.h
deleted file mode 100644
index edee253..0000000
--- a/frontends/yasm/yasm-plugin.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $Id$
- * Semi-portable (Windows and Unix) plugin loading
- *
- *  Copyright (C) 2008  Peter Johnson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef YASM_PLUGIN_H
-#define YASM_PLUGIN_H
-
-/* Load a plugin.  Returns 0 on failure. */
-int load_plugin(const char *name);
-void unload_plugins(void);
-
-#endif
diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c
index b8c1ac5..3920afb 100644
--- a/frontends/yasm/yasm.c
+++ b/frontends/yasm/yasm.c
@@ -38,10 +38,6 @@
 
 #include "yasm-options.h"
 
-#ifdef CMAKE_BUILD
-#include "yasm-plugin.h"
-#endif
-
 #include "license.c"
 
 /* Preprocess-only buffer size */
@@ -109,9 +105,6 @@
 static int opt_makedep_handler(char *cmd, /*@null@*/ char *param, int extra);
 static int opt_prefix_handler(char *cmd, /*@null@*/ char *param, int extra);
 static int opt_suffix_handler(char *cmd, /*@null@*/ char *param, int extra);
-#ifdef CMAKE_BUILD
-static int opt_plugin_handler(char *cmd, /*@null@*/ char *param, int extra);
-#endif
 
 static /*@only@*/ char *replace_extension(const char *orig, /*@null@*/
                                           const char *ext, const char *def);
@@ -130,7 +123,6 @@
                                const char *msg);
 
 static void apply_preproc_builtins(void);
-static void apply_preproc_standard_macros(const yasm_stdmac *stdmacs);
 static void apply_preproc_saved_options(void);
 static void print_list_keyword_desc(const char *name, const char *keyword);
 
@@ -205,10 +197,6 @@
       N_("append argument to name of all external symbols"), N_("suffix") },
     { 0, "postfix", 1, opt_suffix_handler, 0,
       N_("append argument to name of all external symbols"), N_("suffix") },
-#ifdef CMAKE_BUILD
-    { 'N', "plugin", 1, opt_plugin_handler, 0,
-      N_("load plugin module"), N_("plugin") },
-#endif
 };
 
 /* version message */
@@ -285,17 +273,13 @@
             return EXIT_FAILURE;
     }
 
-    /* Create preprocessor */
+    /* Pre-process until done */
     cur_preproc = yasm_preproc_create(cur_preproc_module, in_filename, NULL,
                                       linemap, errwarns);
 
-    /* Apply macros */
     apply_preproc_builtins();
-    apply_preproc_standard_macros(cur_parser_module->stdmacs);
-    apply_preproc_standard_macros(cur_objfmt_module->stdmacs);
     apply_preproc_saved_options();
 
-    /* Pre-process until done */
     if (generate_make_dependencies) {
         size_t totlen;
 
@@ -459,8 +443,6 @@
                                       object->symtab, linemap, errwarns);
 
     apply_preproc_builtins();
-    apply_preproc_standard_macros(cur_parser_module->stdmacs);
-    apply_preproc_standard_macros(cur_objfmt_module->stdmacs);
     apply_preproc_saved_options();
 
     /* Get initial x86 BITS setting from object format */
@@ -585,24 +567,6 @@
     yasm_gettext_hook = handle_yasm_gettext;
     yasm_errwarn_initialize();
 
-    /* Initialize BitVector (needed for intnum/floatnum). */
-    if (BitVector_Boot() != ErrCode_Ok) {
-        print_error(_("%s: could not initialize BitVector"), _("FATAL"));
-        return EXIT_FAILURE;
-    }
-
-    /* Initialize intnum and floatnum */
-    yasm_intnum_initialize();
-    yasm_floatnum_initialize();
-
-#ifdef CMAKE_BUILD
-    /* Load standard modules */
-    if (!load_plugin("yasmstd")) {
-        print_error(_("%s: could not load standard modules"), _("FATAL"));
-        return EXIT_FAILURE;
-    }
-#endif
-
     /* Initialize parameter storage */
     STAILQ_INIT(&preproc_options);
 
@@ -634,6 +598,16 @@
             return EXIT_FAILURE;
     }
 
+    /* Initialize BitVector (needed for intnum/floatnum). */
+    if (BitVector_Boot() != ErrCode_Ok) {
+        print_error(_("%s: could not initialize BitVector"), _("FATAL"));
+        return EXIT_FAILURE;
+    }
+
+    /* Initialize intnum and floatnum */
+    yasm_intnum_initialize();
+    yasm_floatnum_initialize();
+
     /* If not already specified, default to bin as the object format. */
     if (!cur_objfmt_module) {
         if (!objfmt_keyword)
@@ -797,9 +771,6 @@
 
     if (errfile != stderr && errfile != stdout)
         fclose(errfile);
-#ifdef CMAKE_BUILD
-    unload_plugins();
-#endif
 }
 
 /*
@@ -1178,17 +1149,6 @@
     return 0;
 }
 
-#ifdef CMAKE_BUILD
-static int
-opt_plugin_handler(/*@unused@*/ char *cmd, char *param,
-                   /*@unused@*/ int extra)
-{
-    if (!load_plugin(param))
-        print_error(_("warning: could not load plugin `%s'"), param);
-    return 0;
-}
-#endif
-
 static void
 apply_preproc_builtins()
 {
@@ -1204,25 +1164,6 @@
 }
 
 static void
-apply_preproc_standard_macros(const yasm_stdmac *stdmacs)
-{
-    int i, matched;
-
-    if (!stdmacs)
-        return;
-
-    matched = -1;
-    for (i=0; stdmacs[i].parser; i++)
-        if (yasm__strcasecmp(stdmacs[i].parser,
-                             cur_parser_module->keyword) == 0 &&
-            yasm__strcasecmp(stdmacs[i].preproc,
-                             cur_preproc_module->keyword) == 0)
-            matched = i;
-    if (matched >= 0 && stdmacs[matched].macros)
-        yasm_preproc_add_standard(cur_preproc, stdmacs[matched].macros);
-}
-
-static void
 apply_preproc_saved_options()
 {
     constcharparam *cp, *cpnext;
diff --git a/libyasm-stdint.h.cmake b/libyasm-stdint.h.cmake
deleted file mode 100644
index f2361d4..0000000
--- a/libyasm-stdint.h.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef YASM_STDINT_H
-#define YASM_STDINT_H
-
-#cmakedefine HAVE_STDINT_H
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#elif defined(_MSC_VER)
-
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-#include <vadefs.h>
-#else
-typedef unsigned long uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-
-#else
-typedef unsigned long uintptr_t;
-#endif
-
-#ifndef YASM_LIB_DECL
-# ifdef _MSC_VER
-#  ifdef YASM_LIB_SOURCE
-#   define YASM_LIB_DECL __declspec(dllexport)
-#  else
-#   define YASM_LIB_DECL __declspec(dllimport)
-#  endif
-# else
-#   define YASM_LIB_DECL
-# endif
-#endif
-
-#undef HAVE_STDINT_H
-
-#endif
diff --git a/libyasm/CMakeLists.txt b/libyasm/CMakeLists.txt
deleted file mode 100644
index f886f73..0000000
--- a/libyasm/CMakeLists.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
-
-ADD_LIBRARY(libyasm SHARED
-    assocdat.c
-    bitvect.c
-    bc-align.c
-    bc-data.c
-    bc-incbin.c
-    bc-org.c
-    bc-reserve.c
-    bytecode.c
-    cmake-module.c
-    errwarn.c
-    expr.c
-    file.c
-    floatnum.c
-    hamt.c
-    insn.c
-    intnum.c
-    inttree.c
-    linemap.c
-    md5.c
-    mergesort.c
-    phash.c
-    section.c
-    strcasecmp.c
-    strsep.c
-    symrec.c
-    valparam.c
-    value.c
-    xmalloc.c
-    xstrdup.c
-    )
-SET_TARGET_PROPERTIES(libyasm PROPERTIES
-    OUTPUT_NAME "yasm"
-    COMPILE_FLAGS -DYASM_LIB_SOURCE
-    )
-
-INSTALL(TARGETS libyasm
-    RUNTIME DESTINATION bin
-    LIBRARY DESTINATION lib
-    ARCHIVE DESTINATION lib
-    )
-
-INSTALL(FILES
-    arch.h
-    assocdat.h
-    bitvect.h
-    bytecode.h
-    compat-queue.h
-    coretype.h
-    dbgfmt.h
-    errwarn.h
-    expr.h
-    file.h
-    floatnum.h
-    hamt.h
-    insn.h
-    intnum.h
-    inttree.h
-    linemap.h
-    listfmt.h
-    md5.h
-    module.h
-    objfmt.h
-    parser.h
-    phash.h
-    preproc.h
-    section.h
-    symrec.h
-    valparam.h
-    value.h
-    DESTINATION include/libyasm
-    )
diff --git a/libyasm/assocdat.h b/libyasm/assocdat.h
index d18e1eb..4b162d6 100644
--- a/libyasm/assocdat.h
+++ b/libyasm/assocdat.h
@@ -34,15 +34,10 @@
 #ifndef YASM_ASSOCDAT_H
 #define YASM_ASSOCDAT_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Associated data container. */
 typedef struct yasm__assoc_data yasm__assoc_data;
 
 /** Create an associated data container. */
-YASM_LIB_DECL
 /*@only@*/ yasm__assoc_data *yasm__assoc_data_create(void);
 
 /** Get associated data for a data callback.
@@ -50,7 +45,6 @@
  * \param callback      callback used when adding data
  * \return Associated data (NULL if none).
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ void *yasm__assoc_data_get
     (/*@null@*/ yasm__assoc_data *assoc_data,
      const yasm_assoc_data_callback *callback);
@@ -61,19 +55,16 @@
  * \param callback      callback
  * \param data          data to associate
  */
-YASM_LIB_DECL
 /*@only@*/ yasm__assoc_data *yasm__assoc_data_add
     (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data,
      const yasm_assoc_data_callback *callback,
      /*@only@*/ /*@null@*/ void *data);
 
 /** Destroy all associated data in a container. */
-YASM_LIB_DECL
 void yasm__assoc_data_destroy
     (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data);
 
 /** Print all associated data in a container. */
-YASM_LIB_DECL
 void yasm__assoc_data_print(const yasm__assoc_data *assoc_data, FILE *f,
                             int indent_level);
 
diff --git a/libyasm/bitvect.h b/libyasm/bitvect.h
index dc77d4f..e2a1023 100644
--- a/libyasm/bitvect.h
+++ b/libyasm/bitvect.h
@@ -15,9 +15,6 @@
 /*        and your own application(s) which might - directly or indirectly - */
 /*        include this definitions file.                                     */
 /*****************************************************************************/
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
 
 typedef  unsigned   char    N_char;
 typedef  unsigned   char    N_byte;
@@ -120,318 +117,213 @@
 
 /* ===> MISCELLANEOUS BASIC FUNCTIONS: <=== */
 
-YASM_LIB_DECL
 const char * BitVector_Error      (ErrCode error);  /* return string for err code */
 
-YASM_LIB_DECL
 ErrCode BitVector_Boot       (void);                 /* 0 = ok, 1..7 = error */
-YASM_LIB_DECL
 void    BitVector_Shutdown   (void);                            /* undo Boot */
 
-YASM_LIB_DECL
 N_word  BitVector_Size       (N_int bits);  /* bit vector size (# of words)  */
-YASM_LIB_DECL
 N_word  BitVector_Mask       (N_int bits);  /* bit vector mask (unused bits) */
 
 /* ===> CLASS METHODS: <=== */
 
-YASM_LIB_DECL
 const char * BitVector_Version    (void);          /* returns version string */
 
-YASM_LIB_DECL
 N_int   BitVector_Word_Bits  (void);     /* return # of bits in machine word */
-YASM_LIB_DECL
 N_int   BitVector_Long_Bits  (void);    /* return # of bits in unsigned long */
 
 /* ===> CONSTRUCTOR METHODS: <=== */
 
-YASM_LIB_DECL
 /*@only@*/ wordptr BitVector_Create     (N_int bits, boolean clear);          /* malloc */
-YASM_LIB_DECL
 listptr BitVector_Create_List(N_int bits, boolean clear, N_int count);
 
-YASM_LIB_DECL
 wordptr BitVector_Resize     (wordptr oldaddr, N_int bits);       /* realloc */
 
-YASM_LIB_DECL
 wordptr BitVector_Shadow     (wordptr addr); /* make new same size but empty */
-YASM_LIB_DECL
 wordptr BitVector_Clone      (wordptr addr);         /* make exact duplicate */
 
-YASM_LIB_DECL
 wordptr BitVector_Concat     (wordptr X, wordptr Y); /* return concatenation */
 
 /* ===> DESTRUCTOR METHODS: <=== */
 
-YASM_LIB_DECL
 void    BitVector_Dispose            (/*@only@*/ /*@out@*/ charptr string);             /* string */
-YASM_LIB_DECL
 void    BitVector_Destroy            (/*@only@*/ wordptr addr);               /* bitvec */
-YASM_LIB_DECL
 void    BitVector_Destroy_List       (listptr list, N_int count);  /* list   */
 
 /* ===> OBJECT METHODS: <=== */
 
 /* ===> bit vector copy function: */
 
-YASM_LIB_DECL
 void    BitVector_Copy       (wordptr X, wordptr Y);              /* X = Y   */
 
 /* ===> bit vector initialization: */
 
-YASM_LIB_DECL
 void    BitVector_Empty      (wordptr addr);                      /* X = {}  */
-YASM_LIB_DECL
 void    BitVector_Fill       (wordptr addr);                      /* X = ~{} */
-YASM_LIB_DECL
 void    BitVector_Flip       (wordptr addr);                      /* X = ~X  */
 
-YASM_LIB_DECL
 void    BitVector_Primes     (wordptr addr);
 
 /* ===> miscellaneous functions: */
 
-YASM_LIB_DECL
 void    BitVector_Reverse    (wordptr X, wordptr Y);
 
 /* ===> bit vector interval operations and functions: */
 
-YASM_LIB_DECL
 void    BitVector_Interval_Empty     (/*@out@*/ wordptr addr, N_int lower, N_int upper);
-YASM_LIB_DECL
 void    BitVector_Interval_Fill      (/*@out@*/ wordptr addr, N_int lower, N_int upper);
-YASM_LIB_DECL
 void    BitVector_Interval_Flip      (/*@out@*/ wordptr addr, N_int lower, N_int upper);
-YASM_LIB_DECL
 void    BitVector_Interval_Reverse   (/*@out@*/ wordptr addr, N_int lower, N_int upper);
 
-YASM_LIB_DECL
 boolean BitVector_interval_scan_inc  (wordptr addr, N_int start,
                                       N_intptr min, N_intptr max);
-YASM_LIB_DECL
 boolean BitVector_interval_scan_dec  (wordptr addr, N_int start,
                                       N_intptr min, N_intptr max);
 
-YASM_LIB_DECL
 void    BitVector_Interval_Copy      (/*@out@*/ wordptr X, wordptr Y, N_int Xoffset,
                                       N_int Yoffset, N_int length);
 
-YASM_LIB_DECL
 wordptr BitVector_Interval_Substitute(/*@out@*/ wordptr X, wordptr Y,
                                       N_int Xoffset, N_int Xlength,
                                       N_int Yoffset, N_int Ylength);
 
 /* ===> bit vector test functions: */
 
-YASM_LIB_DECL
 boolean BitVector_is_empty   (wordptr addr);                  /* X == {} ?   */
-YASM_LIB_DECL
 boolean BitVector_is_full    (wordptr addr);                  /* X == ~{} ?  */
 
-YASM_LIB_DECL
 boolean BitVector_equal      (wordptr X, wordptr Y);          /* X == Y ?    */
-YASM_LIB_DECL
 Z_int   BitVector_Lexicompare(wordptr X, wordptr Y);          /* X <,=,> Y ? */
-YASM_LIB_DECL
 Z_int   BitVector_Compare    (wordptr X, wordptr Y);          /* X <,=,> Y ? */
 
 /* ===> bit vector string conversion functions: */
 
-YASM_LIB_DECL
 /*@only@*/ charptr BitVector_to_Hex     (wordptr addr);
-YASM_LIB_DECL
 ErrCode BitVector_from_Hex   (/*@out@*/wordptr addr, charptr string);
 
-YASM_LIB_DECL
 ErrCode BitVector_from_Oct(/*@out@*/ wordptr addr, charptr string);
 
-YASM_LIB_DECL
 /*@only@*/ charptr BitVector_to_Bin     (wordptr addr);
-YASM_LIB_DECL
 ErrCode BitVector_from_Bin   (/*@out@*/ wordptr addr, charptr string);
 
-YASM_LIB_DECL
 /*@only@*/ charptr BitVector_to_Dec     (wordptr addr);
-YASM_LIB_DECL
 ErrCode BitVector_from_Dec   (/*@out@*/ wordptr addr, charptr string);
 
 typedef struct BitVector_from_Dec_static_data BitVector_from_Dec_static_data;
-YASM_LIB_DECL
 BitVector_from_Dec_static_data *BitVector_from_Dec_static_Boot(N_word bits);
-YASM_LIB_DECL
 void BitVector_from_Dec_static_Shutdown(/*@null@*/ BitVector_from_Dec_static_data *data);
-YASM_LIB_DECL
 ErrCode BitVector_from_Dec_static(BitVector_from_Dec_static_data *data,
                                   /*@out@*/ wordptr addr, charptr string);
 
-YASM_LIB_DECL
 /*@only@*/ charptr BitVector_to_Enum    (wordptr addr);
-YASM_LIB_DECL
 ErrCode BitVector_from_Enum  (/*@out@*/ wordptr addr, charptr string);
 
 /* ===> bit vector bit operations, functions & tests: */
 
-YASM_LIB_DECL
 void    BitVector_Bit_Off    (/*@out@*/ wordptr addr, N_int indx); /*  X = X \ {x}    */
-YASM_LIB_DECL
 void    BitVector_Bit_On     (/*@out@*/ wordptr addr, N_int indx); /*  X = X + {x}    */
-YASM_LIB_DECL
 boolean BitVector_bit_flip   (/*@out@*/ wordptr addr, N_int indx); /* (X+{x})\(X*{x}) */
 
-YASM_LIB_DECL
 boolean BitVector_bit_test   (wordptr addr, N_int indx); /*  {x} in X ?     */
 
-YASM_LIB_DECL
 void    BitVector_Bit_Copy   (/*@out@*/ wordptr addr, N_int indx, boolean bit);
 
 /* ===> bit vector bit shift & rotate functions: */
 
-YASM_LIB_DECL
 void    BitVector_LSB                (/*@out@*/ wordptr addr, boolean bit);
-YASM_LIB_DECL
 void    BitVector_MSB                (/*@out@*/ wordptr addr, boolean bit);
-YASM_LIB_DECL
 boolean BitVector_lsb_               (wordptr addr);
-YASM_LIB_DECL
 boolean BitVector_msb_               (wordptr addr);
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_rotate_left        (wordptr addr);
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_rotate_right       (wordptr addr);
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_shift_left         (wordptr addr, boolean carry_in);
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_shift_right        (wordptr addr, boolean carry_in);
-YASM_LIB_DECL
 void    BitVector_Move_Left          (wordptr addr, N_int bits);
-YASM_LIB_DECL
 void    BitVector_Move_Right         (wordptr addr, N_int bits);
 
 /* ===> bit vector insert/delete bits: */
 
-YASM_LIB_DECL
 void    BitVector_Insert     (wordptr addr, N_int offset, N_int count,
                               boolean clear);
-YASM_LIB_DECL
 void    BitVector_Delete     (wordptr addr, N_int offset, N_int count,
                               boolean clear);
 
 /* ===> bit vector arithmetic: */
 
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_increment  (wordptr addr);                        /*  X++  */
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_decrement  (wordptr addr);                        /*  X--  */
 
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_compute    (wordptr X, wordptr Y, wordptr Z, boolean minus,
                                                                boolean *carry);
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_add        (wordptr X, wordptr Y, wordptr Z, boolean *carry);
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_sub        (wordptr X, wordptr Y, wordptr Z, boolean *carry);
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_inc        (wordptr X, wordptr Y);
-YASM_LIB_DECL
 boolean /*@alt void@*/ BitVector_dec        (wordptr X, wordptr Y);
 
-YASM_LIB_DECL
 void    BitVector_Negate     (wordptr X, wordptr Y);
-YASM_LIB_DECL
 void    BitVector_Absolute   (wordptr X, wordptr Y);
-YASM_LIB_DECL
 Z_int   BitVector_Sign       (wordptr addr);
-YASM_LIB_DECL
 ErrCode BitVector_Mul_Pos    (wordptr X, wordptr Y, wordptr Z, boolean strict);
-YASM_LIB_DECL
 ErrCode BitVector_Multiply   (wordptr X, wordptr Y, wordptr Z);
-YASM_LIB_DECL
 ErrCode BitVector_Div_Pos    (wordptr Q, wordptr X, wordptr Y, wordptr R);
-YASM_LIB_DECL
 ErrCode BitVector_Divide     (wordptr Q, wordptr X, wordptr Y, wordptr R);
-YASM_LIB_DECL
 ErrCode BitVector_GCD        (wordptr X, wordptr Y, wordptr Z);
-YASM_LIB_DECL
 ErrCode BitVector_GCD2       (wordptr U, wordptr V, wordptr W,      /*   O   */
                                          wordptr X, wordptr Y);     /*   I   */
-YASM_LIB_DECL
 ErrCode BitVector_Power      (wordptr X, wordptr Y, wordptr Z);
 
 /* ===> direct memory access functions: */
 
-YASM_LIB_DECL
 void    BitVector_Block_Store(wordptr addr, charptr buffer, N_int length);
-YASM_LIB_DECL
 charptr BitVector_Block_Read (wordptr addr, /*@out@*/ N_intptr length);
 
 /* ===> word array functions: */
 
-YASM_LIB_DECL
 void    BitVector_Word_Store (wordptr addr, N_int offset, N_int value);
-YASM_LIB_DECL
 N_int   BitVector_Word_Read  (wordptr addr, N_int offset);
 
-YASM_LIB_DECL
 void    BitVector_Word_Insert(wordptr addr, N_int offset, N_int count,
                               boolean clear);
-YASM_LIB_DECL
 void    BitVector_Word_Delete(wordptr addr, N_int offset, N_int count,
                               boolean clear);
 
 /* ===> arbitrary size chunk functions: */
 
-YASM_LIB_DECL
 void    BitVector_Chunk_Store(wordptr addr, N_int chunksize,
                               N_int offset, N_long value);
-YASM_LIB_DECL
 N_long  BitVector_Chunk_Read (wordptr addr, N_int chunksize,
                               N_int offset);
 
 /* ===> set operations: */
 
-YASM_LIB_DECL
 void    Set_Union            (wordptr X, wordptr Y, wordptr Z); /* X = Y + Z */
-YASM_LIB_DECL
 void    Set_Intersection     (wordptr X, wordptr Y, wordptr Z); /* X = Y * Z */
-YASM_LIB_DECL
 void    Set_Difference       (wordptr X, wordptr Y, wordptr Z); /* X = Y \ Z */
-YASM_LIB_DECL
 void    Set_ExclusiveOr      (wordptr X, wordptr Y, wordptr Z); /*(Y+Z)\(Y*Z)*/
-YASM_LIB_DECL
 void    Set_Complement       (wordptr X, wordptr Y);            /* X = ~Y    */
 
 /* ===> set functions: */
 
-YASM_LIB_DECL
 boolean Set_subset           (wordptr X, wordptr Y);            /* X in Y ?  */
 
-YASM_LIB_DECL
 N_int   Set_Norm             (wordptr addr);                    /* = | X |   */
-YASM_LIB_DECL
 N_int   Set_Norm2            (wordptr addr);                    /* = | X |   */
-YASM_LIB_DECL
 N_int   Set_Norm3            (wordptr addr);                    /* = | X |   */
-YASM_LIB_DECL
 Z_long  Set_Min              (wordptr addr);                    /* = min(X)  */
-YASM_LIB_DECL
 Z_long  Set_Max              (wordptr addr);                    /* = max(X)  */
 
 /* ===> matrix-of-booleans operations: */
 
-YASM_LIB_DECL
 void    Matrix_Multiplication(wordptr X, N_int rowsX, N_int colsX,
                               wordptr Y, N_int rowsY, N_int colsY,
                               wordptr Z, N_int rowsZ, N_int colsZ);
 
-YASM_LIB_DECL
 void    Matrix_Product       (wordptr X, N_int rowsX, N_int colsX,
                               wordptr Y, N_int rowsY, N_int colsY,
                               wordptr Z, N_int rowsZ, N_int colsZ);
 
-YASM_LIB_DECL
 void    Matrix_Closure       (wordptr addr, N_int rows, N_int cols);
 
-YASM_LIB_DECL
 void    Matrix_Transpose     (wordptr X, N_int rowsX, N_int colsX,
                               wordptr Y, N_int rowsY, N_int colsY);
 
diff --git a/libyasm/bytecode.h b/libyasm/bytecode.h
index bff958f..741aabb 100644
--- a/libyasm/bytecode.h
+++ b/libyasm/bytecode.h
@@ -34,10 +34,6 @@
 #ifndef YASM_BYTECODE_H
 #define YASM_BYTECODE_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** A data value (opaque type). */
 typedef struct yasm_dataval yasm_dataval;
 /** A list of data values. */
@@ -227,7 +223,6 @@
  * \param line          virtual line (from yasm_linemap)
  * \return Newly allocated bytecode of the specified type.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_bytecode *yasm_bc_create_common
     (/*@null@*/ const yasm_bytecode_callback *callback,
      /*@only@*/ /*@null@*/ void *contents, unsigned long line);
@@ -237,7 +232,6 @@
  * \param callback      new bytecode callback function
  * \param contents      new type-specific data
  */
-YASM_LIB_DECL
 void yasm_bc_transform(yasm_bytecode *bc,
                        const yasm_bytecode_callback *callback,
                        void *contents);
@@ -245,13 +239,11 @@
 /** Common bytecode callback finalize function, for where no finalization
  * is ever required for this type of bytecode.
  */
-YASM_LIB_DECL
 void yasm_bc_finalize_common(yasm_bytecode *bc, yasm_bytecode *prev_bc);
 
 /** Common bytecode callback calc_len function, for where the bytecode has
  * no calculatable length.  Causes an internal error if called.
  */
-YASM_LIB_DECL
 int yasm_bc_calc_len_common(yasm_bytecode *bc, yasm_bc_add_span_func add_span,
                             void *add_span_data);
 
@@ -259,7 +251,6 @@
  * always short (calc_len never calls add_span).  Causes an internal
  * error if called.
  */
-YASM_LIB_DECL
 int yasm_bc_expand_common
     (yasm_bytecode *bc, int span, long old_val, long new_val,
      /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres);
@@ -267,7 +258,6 @@
 /** Common bytecode callback tobytes function, for where the bytecode
  * cannot be converted to bytes.  Causes an internal error if called.
  */
-YASM_LIB_DECL
 int yasm_bc_tobytes_common
     (yasm_bytecode *bc, unsigned char **bufp, void *d,
      yasm_output_value_func output_value,
@@ -285,7 +275,6 @@
  * \param bc    bytecode
  * \param e     multiple (kept, do not free)
  */
-YASM_LIB_DECL
 void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e);
 
 /** Create a bytecode containing data value(s).
@@ -298,7 +287,6 @@
  * \param line          virtual line (from yasm_linemap)
  * \return Newly allocated bytecode.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_bytecode *yasm_bc_create_data
     (yasm_datavalhead *datahead, unsigned int size, int append_zero,
      /*@null@*/ yasm_arch *arch, unsigned long line);
@@ -309,7 +297,6 @@
  * \param line          virtual line (from yasm_linemap)
  * \return Newly allocated bytecode.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_bytecode *yasm_bc_create_leb128
     (yasm_datavalhead *datahead, int sign, unsigned long line);
 
@@ -319,7 +306,6 @@
  * \param line          virtual line (from yasm_linemap)
  * \return Newly allocated bytecode.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_bytecode *yasm_bc_create_reserve
     (/*@only@*/ yasm_expr *numitems, unsigned int itemsize,
      unsigned long line);
@@ -331,7 +317,6 @@
  * \return NULL if bc is not a reserve bytecode, otherwise an expression
  *         for the number of items to reserve.
  */
-YASM_LIB_DECL
 /*@null@*/ const yasm_expr *yasm_bc_reserve_numitems
     (yasm_bytecode *bc, /*@out@*/ unsigned int *itemsize);
 
@@ -345,7 +330,6 @@
  * \param line          virtual line (from yasm_linemap) for the bytecode
  * \return Newly allocated bytecode.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_bytecode *yasm_bc_create_incbin
     (/*@only@*/ char *filename, /*@only@*/ /*@null@*/ yasm_expr *start,
      /*@only@*/ /*@null@*/ yasm_expr *maxlen, yasm_linemap *linemap,
@@ -363,7 +347,6 @@
  *       - from code_fill parameter (if not NULL)
  *       - 0
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_bytecode *yasm_bc_create_align
     (/*@keep@*/ yasm_expr *boundary, /*@keep@*/ /*@null@*/ yasm_expr *fill,
      /*@keep@*/ /*@null@*/ yasm_expr *maxskip,
@@ -376,7 +359,6 @@
  * \param line          virtual line (from yasm_linemap)
  * \return Newly allocated bytecode.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_bytecode *yasm_bc_create_org
     (unsigned long start, unsigned long fill, unsigned long line);
 
@@ -385,7 +367,6 @@
  * \return Section containing bc (can be NULL if bytecode is not part of a
  *         section).
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ yasm_section *yasm_bc_get_section
     (yasm_bytecode *bc);
 
@@ -394,13 +375,11 @@
  * \param bc    bytecode
  * \param sym   symbol
  */
-YASM_LIB_DECL
 void yasm_bc__add_symrec(yasm_bytecode *bc, /*@dependent@*/ yasm_symrec *sym);
 
 /** Delete (free allocated memory for) a bytecode.
  * \param bc    bytecode (only pointer to it); may be NULL
  */
-YASM_LIB_DECL
 void yasm_bc_destroy(/*@only@*/ /*@null@*/ yasm_bytecode *bc);
 
 /** Print a bytecode.  For debugging purposes.
@@ -408,14 +387,12 @@
  * \param indent_level  indentation level
  * \param bc            bytecode
  */
-YASM_LIB_DECL
 void yasm_bc_print(const yasm_bytecode *bc, FILE *f, int indent_level);
 
 /** Finalize a bytecode after parsing.
  * \param bc            bytecode
  * \param prev_bc       bytecode directly preceding bc in a list of bytecodes
  */
-YASM_LIB_DECL
 void yasm_bc_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc);
 
 /** Determine the distance between the starting offsets of two bytecodes.
@@ -425,7 +402,6 @@
  *         the distance was indeterminate.
  * \warning Only valid /after/ optimization.
  */
-YASM_LIB_DECL
 /*@null@*/ /*@only@*/ yasm_intnum *yasm_calc_bc_dist
     (yasm_bytecode *precbc1, yasm_bytecode *precbc2);
 
@@ -435,7 +411,6 @@
  * \return Offset of the next bytecode in bytes.
  * \warning Only valid /after/ optimization.
  */
-YASM_LIB_DECL
 unsigned long yasm_bc_next_offset(yasm_bytecode *precbc);
 
 /** Resolve EQUs in a bytecode and calculate its minimum size.
@@ -450,7 +425,6 @@
  *         (and output) during execution.
  * \note May store to bytecode updated expressions and the short length.
  */
-YASM_LIB_DECL
 int yasm_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span,
                      void *add_span_data);
 
@@ -468,7 +442,6 @@
  *         new negative and positive thresholds returned.
  * \note May store to bytecode updated expressions and the updated length.
  */
-YASM_LIB_DECL
 int yasm_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val,
                    /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres);
 
@@ -492,7 +465,6 @@
  *       results on the second call, as calling this function may result in
  *       non-reversible changes to the bytecode.
  */
-YASM_LIB_DECL
 /*@null@*/ /*@only@*/ unsigned char *yasm_bc_tobytes
     (yasm_bytecode *bc, unsigned char *buf, unsigned long *bufsize,
      /*@out@*/ int *gap, void *d, yasm_output_value_func output_value,
@@ -506,7 +478,6 @@
  *                      calculated, 0 if error should be returned in this case
  * \return 1 on error (set with yasm_error_set), 0 on success.
  */
-YASM_LIB_DECL
 int yasm_bc_get_multiple(yasm_bytecode *bc, /*@out@*/ long *multiple,
                          int calc_bc_dist);
 
@@ -514,7 +485,6 @@
  * \param bc            bytecode
  * \return Bytecode multiple, NULL if =1.
  */
-YASM_LIB_DECL
 const yasm_expr *yasm_bc_get_multiple_expr(const yasm_bytecode *bc);
 
 /** Get a #yasm_insn structure from an instruction bytecode (if possible).
@@ -522,14 +492,12 @@
  * \return Instruction details if bytecode is an instruction bytecode,
  *         otherwise NULL.
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ yasm_insn *yasm_bc_get_insn(yasm_bytecode *bc);
 
 /** Create a new data value from an expression.
  * \param expn  expression
  * \return Newly allocated data value.
  */
-YASM_LIB_DECL
 yasm_dataval *yasm_dv_create_expr(/*@keep@*/ yasm_expr *expn);
 
 /** Create a new data value from a string.
@@ -544,7 +512,6 @@
  * \param len           length
  * \return Newly allocated data value.
  */
-YASM_LIB_DECL
 yasm_dataval *yasm_dv_create_raw(/*@keep@*/ unsigned char *contents,
                                  unsigned long len);
 
@@ -564,7 +531,6 @@
 /** Delete (free allocated memory for) a list of data values.
  * \param headp list of data values
  */
-YASM_LIB_DECL
 void yasm_dvs_delete(yasm_datavalhead *headp);
 
 /** Add data value to the end of a list of data values.
@@ -576,7 +542,6 @@
  * \return If data value was actually appended (it wasn't NULL), the data
  *         value; otherwise NULL.
  */
-YASM_LIB_DECL
 /*@null@*/ yasm_dataval *yasm_dvs_append
     (yasm_datavalhead *headp, /*@returned@*/ /*@null@*/ yasm_dataval *dv);
 
@@ -585,7 +550,6 @@
  * \param indent_level  indentation level
  * \param headp         data value list
  */
-YASM_LIB_DECL
 void yasm_dvs_print(const yasm_datavalhead *headp, FILE *f, int indent_level);
 
 #endif
diff --git a/libyasm/cmake-module.c b/libyasm/cmake-module.c
deleted file mode 100644
index 8530994..0000000
--- a/libyasm/cmake-module.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * YASM module loader
- *
- *  Copyright (C) 2004-2007  Peter Johnson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#include <util.h>
-/*@unused@*/ RCSID("$Id: module.in 2080 2008-04-30 04:40:29Z peter $");
-
-#include <libyasm.h>
-
-
-typedef struct loaded_module {
-    const char *keyword;            /* module keyword */
-    void *data;                     /* associated data */
-} loaded_module;
-
-static HAMT *loaded_modules[] = {NULL, NULL, NULL, NULL, NULL, NULL};
-
-static void
-load_module_destroy(/*@only@*/ void *data)
-{
-    /* do nothing */
-}
-
-void *
-yasm_load_module(yasm_module_type type, const char *keyword)
-{
-    if (!loaded_modules[type])
-        return NULL;
-    return HAMT_search(loaded_modules[type], keyword);
-}
-
-void
-yasm_register_module(yasm_module_type type, const char *keyword, void *data)
-{
-    int replace = 1;
-
-    assert(type < sizeof(loaded_modules));
-
-    if (!loaded_modules[type])
-        loaded_modules[type] = HAMT_create(0, yasm_internal_error_);
-
-    HAMT_insert(loaded_modules[type], keyword, data, &replace,
-                load_module_destroy);
-}
-
-typedef struct {
-    yasm_module_type type;
-    void (*printfunc) (const char *name, const char *keyword);
-} list_one_data;
-
-static int
-yasm_list_one_module(void *node, void *d)
-{
-    list_one_data *data = (list_one_data *)d;
-    yasm_arch_module *arch;
-    yasm_dbgfmt_module *dbgfmt;
-    yasm_objfmt_module *objfmt;
-    yasm_listfmt_module *listfmt;
-    yasm_parser_module *parser;
-    yasm_preproc_module *preproc;
-
-    switch (data->type) {
-        case YASM_MODULE_ARCH:
-            arch = node;
-            data->printfunc(arch->name, arch->keyword);
-            break;
-        case YASM_MODULE_DBGFMT:
-            dbgfmt = node;
-            data->printfunc(dbgfmt->name, dbgfmt->keyword);
-            break;
-        case YASM_MODULE_OBJFMT:
-            objfmt = node;
-            data->printfunc(objfmt->name, objfmt->keyword);
-            break;
-        case YASM_MODULE_LISTFMT:
-            listfmt = node;
-            data->printfunc(listfmt->name, listfmt->keyword);
-            break;
-        case YASM_MODULE_PARSER:
-            parser = node;
-            data->printfunc(parser->name, parser->keyword);
-            break;
-        case YASM_MODULE_PREPROC:
-            preproc = node;
-            data->printfunc(preproc->name, preproc->keyword);
-            break;
-    }
-    return 0;
-}
-
-void
-yasm_list_modules(yasm_module_type type,
-                  void (*printfunc) (const char *name, const char *keyword))
-{
-    list_one_data data;
-
-    /* Go through available list, and try to load each one */
-    if (!loaded_modules[type])
-        return;
-
-    data.type = type;
-    data.printfunc = printfunc;
-
-    HAMT_traverse(loaded_modules[type], &data, yasm_list_one_module);
-}
diff --git a/libyasm/coretype.h b/libyasm/coretype.h
index a78c28f..5c99816 100644
--- a/libyasm/coretype.h
+++ b/libyasm/coretype.h
@@ -34,10 +34,6 @@
 #ifndef YASM_CORETYPE_H
 #define YASM_CORETYPE_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Architecture instance (mostly opaque type).  \see arch.h for details. */
 typedef struct yasm_arch yasm_arch;
 /** Preprocessor interface.  \see preproc.h for details. */
@@ -56,21 +52,6 @@
 /** Debug format module interface.  \see dbgfmt.h for details. */
 typedef struct yasm_dbgfmt_module yasm_dbgfmt_module;
 
-/** Standard macro structure for modules that allows association of a set of
- * standard macros with a parser/preprocessor combination.
- * A NULL-terminated array of these structures is used in a number of module
- * interfaces.
- */
-typedef struct yasm_stdmac {
-    const char *parser;         /**< Parser keyword */
-    const char *preproc;        /**< Preprocessor keyword */
-
-    /** NULL-terminated array of standard macros.  May be NULL if no standard
-     * macros should be added for this preprocessor.
-     */
-    const char **macros;
-} yasm_stdmac;
-
 /** YASM associated data callback structure.  Many data structures can have
  * arbitrary data associated with them.
  */
@@ -306,7 +287,6 @@
  * \param size      size of each array element
  * \param compar    element comparison function
  */
-YASM_LIB_DECL
 int yasm__mergesort(void *base, size_t nmemb, size_t size,
                     int (*compar)(const void *, const void *));
 
@@ -316,7 +296,6 @@
  * \param delim     set of 1 or more delimiters
  * \return First/next substring.
  */
-YASM_LIB_DECL
 /*@null@*/ char *yasm__strsep(char **stringp, const char *delim);
 
 /** Compare two strings, ignoring case differences.
@@ -325,7 +304,6 @@
  * \param s2    string 2
  * \return 0 if strings are equal, -1 if s1<s2, 1 if s1>s2.
  */
-YASM_LIB_DECL
 int yasm__strcasecmp(const char *s1, const char *s2);
 
 /** Compare portion of two strings, ignoring case differences.
@@ -335,7 +313,6 @@
  * \param n     maximum number of characters to compare
  * \return 0 if strings are equal, -1 if s1<s2, 1 if s1>s2.
  */
-YASM_LIB_DECL
 int yasm__strncasecmp(const char *s1, const char *s2, size_t n);
 
 /** strdup() implementation using yasm_xmalloc().
@@ -343,7 +320,6 @@
  * \param str   string
  * \return Newly allocated duplicate string.
  */
-YASM_LIB_DECL
 /*@only@*/ char *yasm__xstrdup(const char *str);
 
 /** strndup() implementation using yasm_xmalloc().
@@ -352,7 +328,6 @@
  * \param max   maximum number of characters to copy
  * \return Newly allocated duplicate string.
  */
-YASM_LIB_DECL
 /*@only@*/ char *yasm__xstrndup(const char *str, size_t max);
 
 /** Error-checking memory allocation.  A default implementation is provided
@@ -361,7 +336,6 @@
  * \param size      number of bytes to allocate
  * \return Allocated memory block.
  */
-YASM_LIB_DECL
 extern /*@only@*/ /*@out@*/ void * (*yasm_xmalloc) (size_t size);
 
 /** Error-checking memory allocation (with clear-to-0).  A default
@@ -371,7 +345,6 @@
  * \param elsize    size (in bytes) of each element
  * \return Allocated and cleared memory block.
  */
-YASM_LIB_DECL
 extern /*@only@*/ void * (*yasm_xcalloc) (size_t nelem, size_t elsize);
 
 /** Error-checking memory reallocation.  A default implementation is provided
@@ -381,7 +354,6 @@
  * \param elsize    new size, in bytes
  * \return Re-allocated memory block.
  */
-YASM_LIB_DECL
 extern /*@only@*/ void * (*yasm_xrealloc)
     (/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size)
     /*@modifies oldmem@*/;
@@ -390,7 +362,6 @@
  * that calls yasm_fatal() on allocation errors.
  * \param p     memory block to free
  */
-YASM_LIB_DECL
 extern void (*yasm_xfree) (/*@only@*/ /*@out@*/ /*@null@*/ void *p)
     /*@modifies p@*/;
 
diff --git a/libyasm/errwarn.h b/libyasm/errwarn.h
index d1e9928..214f312 100644
--- a/libyasm/errwarn.h
+++ b/libyasm/errwarn.h
@@ -34,10 +34,6 @@
 #ifndef YASM_ERRWARN_H
 #define YASM_ERRWARN_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Warning classes (that may be enabled/disabled). */
 typedef enum yasm_warn_class {
     YASM_WARN_NONE = 0,     /**< No warning */
@@ -71,13 +67,11 @@
 } yasm_error_class;
 
 /** Initialize any internal data structures. */
-YASM_LIB_DECL
 void yasm_errwarn_initialize(void);
 
 /** Clean up any memory allocated by yasm_errwarn_initialize() or other
  * functions.
  */
-YASM_LIB_DECL
 void yasm_errwarn_cleanup(void);
 
 /** Reporting point of internal errors.  These are usually due to sanity
@@ -88,7 +82,6 @@
  * \param line      source line (ala __LINE__)
  * \param message   internal error message
  */
-YASM_LIB_DECL
 extern /*@exits@*/ void (*yasm_internal_error_)
     (const char *file, unsigned int line, const char *message);
 
@@ -105,7 +98,6 @@
  * \param message   fatal error message
  * \param va        va_list argument list for message
  */
-YASM_LIB_DECL
 extern /*@exits@*/ void (*yasm_fatal) (const char *message, va_list va);
 
 /** Reporting point of fatal errors, with variable arguments (internal only).
@@ -114,13 +106,11 @@
  * \param message   fatal error message
  * \param ...       argument list for message
  */
-YASM_LIB_DECL
 /*@exits@*/ void yasm__fatal(const char *message, ...);
 
 /** Unconditionally clear the error indicator, freeing any associated data.
  * Has no effect if the error indicator is not set.
  */
-YASM_LIB_DECL
 void yasm_error_clear(void);
 
 /** Get the error indicator.  YASM_ERROR_NONE is returned if no error has
@@ -137,11 +127,9 @@
  * \return Nonzero if error indicator is set and a subclass of eclass, 0
  *         otherwise.
  */
-YASM_LIB_DECL
 int yasm_error_matches(yasm_error_class eclass);
 
 #ifndef YASM_DOXYGEN
-YASM_LIB_DECL
 extern yasm_error_class yasm_eclass;
 #define yasm_error_occurred()       yasm_eclass
 #endif
@@ -152,7 +140,6 @@
  * \param format    printf format string
  * \param va        argument list for format
  */
-YASM_LIB_DECL
 void yasm_error_set_va(yasm_error_class eclass, const char *format, va_list va);
 
 /** Set the error indicator.  Has no effect if the error indicator is already
@@ -161,7 +148,6 @@
  * \param format    printf format string
  * \param ...       argument list for format
  */
-YASM_LIB_DECL
 void yasm_error_set(yasm_error_class eclass, const char *format, ...)
     /*@printflike@*/;
 
@@ -172,7 +158,6 @@
  * \param format    printf format string
  * \param va        argument list for format
  */
-YASM_LIB_DECL
 void yasm_error_set_xref_va(unsigned long xrefline, const char *format,
                             va_list va);
 
@@ -183,7 +168,6 @@
  * \param format    printf format string
  * \param ...       argument list for format
  */
-YASM_LIB_DECL
 void yasm_error_set_xref(unsigned long xrefline, const char *format, ...)
     /*@printflike@*/;
 
@@ -199,7 +183,6 @@
  * \param xrefline  virtual line used for cross-referencing (0 if no xref)
  * \param xrefstr   cross-reference error message (NULL if no xref)
  */
-YASM_LIB_DECL
 void yasm_error_fetch(/*@out@*/ yasm_error_class *eclass,
                       /*@out@*/ /*@only@*/ /*@null@*/ char **str,
                       /*@out@*/ unsigned long *xrefline,
@@ -208,7 +191,6 @@
 /** Unconditionally clear all warning indicators, freeing any associated data.
  * Has no effect if no warning indicators have been set.
  */
-YASM_LIB_DECL
 void yasm_warn_clear(void);
 
 /** Get the first warning indicator.  YASM_WARN_NONE is returned if no warning
@@ -216,7 +198,6 @@
  * be treated as a boolean value.
  * \return First warning indicator.
  */
-YASM_LIB_DECL
 yasm_warn_class yasm_warn_occurred(void);
 
 /** Add a warning indicator (va_list version).
@@ -224,7 +205,6 @@
  * \param format    printf format string
  * \param va        argument list for format
  */
-YASM_LIB_DECL
 void yasm_warn_set_va(yasm_warn_class wclass, const char *format, va_list va);
 
 /** Add a warning indicator.
@@ -232,7 +212,6 @@
  * \param format    printf format string
  * \param ...       argument list for format
  */
-YASM_LIB_DECL
 void yasm_warn_set(yasm_warn_class wclass, const char *format, ...)
     /*@printflike@*/;
 
@@ -246,36 +225,30 @@
  * \param wclass    warning class (output)
  * \param str       warning message
  */
-YASM_LIB_DECL
 void yasm_warn_fetch(/*@out@*/ yasm_warn_class *wclass,
                      /*@out@*/ /*@only@*/ char **str);
 
 /** Enable a class of warnings.
  * \param wclass    warning class
  */
-YASM_LIB_DECL
 void yasm_warn_enable(yasm_warn_class wclass);
 
 /** Disable a class of warnings.
  * \param wclass    warning class
  */
-YASM_LIB_DECL
 void yasm_warn_disable(yasm_warn_class wclass);
 
 /** Disable all classes of warnings. */
-YASM_LIB_DECL
 void yasm_warn_disable_all(void);
 
 /** Create an error/warning set for collection of multiple error/warnings.
  * \return Newly allocated set.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_errwarns *yasm_errwarns_create(void);
 
 /** Destroy an error/warning set.
  * \param errwarns  error/warning set
  */
-YASM_LIB_DECL
 void yasm_errwarns_destroy(/*@only@*/ yasm_errwarns *errwarns);
 
 /** Propagate error indicator and warning indicator(s) to an error/warning set.
@@ -288,7 +261,6 @@
  * \param errwarns  error/warning set
  * \param line      virtual line
  */
-YASM_LIB_DECL
 void yasm_errwarn_propagate(yasm_errwarns *errwarns, unsigned long line);
 
 /** Get total number of errors logged.
@@ -296,7 +268,6 @@
  * \param warning_as_error  if nonzero, warnings are treated as errors.
  * \return Number of errors.
  */
-YASM_LIB_DECL
 unsigned int yasm_errwarns_num_errors(yasm_errwarns *errwarns,
                                       int warning_as_error);
 
@@ -328,7 +299,6 @@
  * \param print_error       function called to print out errors
  * \param print_warning     function called to print out warnings
  */
-YASM_LIB_DECL
 void yasm_errwarns_output_all
     (yasm_errwarns *errwarns, yasm_linemap *lm, int warning_as_error,
      yasm_print_error_func print_error, yasm_print_warning_func print_warning);
@@ -338,14 +308,12 @@
  * \param ch    possibly unprintable character
  * \return Printable string representation (static buffer).
  */
-YASM_LIB_DECL
 char *yasm__conv_unprint(int ch);
 
 /** Hook for library users to map to gettext() if GNU gettext is being used.
  * \param msgid     message catalog identifier
  * \return Translated message.
  */
-YASM_LIB_DECL
 extern const char * (*yasm_gettext_hook) (const char *msgid);
 
 #endif
diff --git a/libyasm/expr.h b/libyasm/expr.h
index 96d1796..990452f 100644
--- a/libyasm/expr.h
+++ b/libyasm/expr.h
@@ -34,10 +34,6 @@
 #ifndef YASM_EXPR_H
 #define YASM_EXPR_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Type of an expression item.  Types are listed in canonical sorting order.
  * See expr_order_terms().
  * Note #YASM_EXPR_PRECBC must be used carefully (in a-b pairs), as only
@@ -90,7 +86,6 @@
  * \param line      virtual line (where expression defined)
  * \return Newly allocated expression.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_expr *yasm_expr_create
     (yasm_expr_op op, /*@only@*/ yasm_expr__item *a,
      /*@only@*/ /*@null@*/ yasm_expr__item *b, unsigned long line);
@@ -99,42 +94,36 @@
  * \param precbc    preceding bytecode
  * \return Newly allocated expression item.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_expr__item *yasm_expr_precbc(/*@keep@*/ yasm_bytecode *precbc);
 
 /** Create a new symbol expression item.
  * \param sym       symbol
  * \return Newly allocated expression item.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_expr__item *yasm_expr_sym(/*@keep@*/ yasm_symrec *sym);
 
 /** Create a new expression expression item.
  * \param e         expression
  * \return Newly allocated expression item.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_expr__item *yasm_expr_expr(/*@keep@*/ yasm_expr *e);
 
 /** Create a new intnum expression item.
  * \param intn      intnum
  * \return Newly allocated expression item.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_expr__item *yasm_expr_int(/*@keep@*/ yasm_intnum *intn);
 
 /** Create a new floatnum expression item.
  * \param flt       floatnum
  * \return Newly allocated expression item.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_expr__item *yasm_expr_float(/*@keep@*/ yasm_floatnum *flt);
 
 /** Create a new register expression item.
  * \param reg       register
  * \return Newly allocated expression item.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_expr__item *yasm_expr_reg(uintptr_t reg);
 
 /** Create a new expression tree e=l op r.
@@ -176,7 +165,6 @@
 /** Destroy (free allocated memory for) an expression.
  * \param e     expression
  */
-YASM_LIB_DECL
 void yasm_expr_destroy(/*@only@*/ /*@null@*/ yasm_expr *e);
 
 /** Determine if an expression is a specified operation (at the top level).
@@ -185,7 +173,6 @@
  * \return Nonzero if the expression was the specified operation at the top
  *         level, zero otherwise.
  */
-YASM_LIB_DECL
 int yasm_expr_is_op(const yasm_expr *e, yasm_expr_op op);
 
 /** Extra transformation function for yasm_expr__level_tree().
@@ -209,7 +196,6 @@
  * \param expr_xform_extra_data data to pass to expr_xform_extra
  * \return Leveled expression.
  */
-YASM_LIB_DECL
 /*@only@*/ /*@null@*/ yasm_expr *yasm_expr__level_tree
     (/*@returned@*/ /*@only@*/ /*@null@*/ yasm_expr *e, int fold_const,
      int simplify_ident, int simplify_reg_mul, int calc_bc_dist,
@@ -234,7 +220,6 @@
  *         The input expression is modified such that on return, it's the
  *         offset expression.
  */
-YASM_LIB_DECL
 /*@only@*/ /*@null@*/ yasm_expr *yasm_expr_extract_deep_segoff(yasm_expr **ep);
 
 /** Extract the segment portion of a SEG:OFF expression, leaving the offset.
@@ -244,7 +229,6 @@
  *         expression is modified such that on return, it's the offset
  *         expression.
  */
-YASM_LIB_DECL
 /*@only@*/ /*@null@*/ yasm_expr *yasm_expr_extract_segoff(yasm_expr **ep);
 
 /** Extract the right portion (y) of a x WRT y expression, leaving the left
@@ -255,7 +239,6 @@
  *         input expression is modified such that on return, it's the left side
  *         of the WRT expression.
  */
-YASM_LIB_DECL
 /*@only@*/ /*@null@*/ yasm_expr *yasm_expr_extract_wrt(yasm_expr **ep);
 
 /** Get the integer value of an expression if it's just an integer.
@@ -266,7 +249,6 @@
  *         integers, ie floats, non-valued labels, registers); otherwise the
  *         intnum value of the expression.
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ yasm_intnum *yasm_expr_get_intnum
     (yasm_expr **ep, int calc_bc_dist);
 
@@ -276,7 +258,6 @@
  * \return NULL if the expression is too complex; otherwise the symbol value of
  *         the expression.
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ const yasm_symrec *yasm_expr_get_symrec
     (yasm_expr **ep, int simplify);
 
@@ -286,7 +267,6 @@
  * \return NULL if the expression is too complex; otherwise the register value
  *         of the expression.
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ const uintptr_t *yasm_expr_get_reg
     (yasm_expr **ep, int simplify);
 
@@ -294,7 +274,6 @@
  * \param e     expression
  * \param f     file
  */
-YASM_LIB_DECL
 void yasm_expr_print(/*@null@*/ const yasm_expr *e, FILE *f);
 
 /** Traverse over expression tree in order (const version).
@@ -305,7 +284,6 @@
  * \return Stops early (and returns 1) if func returns 1.
  *         Otherwise returns 0.
  */
-YASM_LIB_DECL
 int yasm_expr__traverse_leaves_in_const
     (const yasm_expr *e, /*@null@*/ void *d,
      int (*func) (/*@null@*/ const yasm_expr__item *ei, /*@null@*/ void *d));
@@ -318,7 +296,6 @@
  * \return Stops early (and returns 1) if func returns 1.
  *         Otherwise returns 0.
  */
-YASM_LIB_DECL
 int yasm_expr__traverse_leaves_in
     (yasm_expr *e, /*@null@*/ void *d,
      int (*func) (/*@null@*/ yasm_expr__item *ei, /*@null@*/ void *d));
@@ -331,7 +308,6 @@
  * \param e     expression
  * \note Only performs reordering on *one* level (no recursion).
  */
-YASM_LIB_DECL
 void yasm_expr__order_terms(yasm_expr *e);
 
 /** Copy entire expression EXCEPT for index "except" at *top level only*.
@@ -339,7 +315,6 @@
  * \param except    term index not to copy; -1 to copy all terms
  * \return Newly allocated copy of expression.
  */
-YASM_LIB_DECL
 yasm_expr *yasm_expr__copy_except(const yasm_expr *e, int except);
 
 /** Test if expression contains an item.  Searches recursively into
@@ -348,7 +323,6 @@
  * \param t     type of item to look for
  * \return Nonzero if expression contains an item of type t, zero if not.
  */
-YASM_LIB_DECL
 int yasm_expr__contains(const yasm_expr *e, yasm_expr__type t);
 
 /** Transform symrec-symrec terms in expression into #YASM_EXPR_SUBST items.
@@ -359,7 +333,6 @@
  *                      pair, bytecode pair (bc2-bc1), and cbd (callback data)
  * \return Number of transformations made.
  */
-YASM_LIB_DECL
 int yasm_expr__bc_dist_subst(yasm_expr **ep, void *cbd,
                              void (*callback) (unsigned int subst,
                                                yasm_bytecode *precbc,
@@ -373,7 +346,6 @@
  * \param items         items array
  * \return 1 on error (index out of range).
  */
-YASM_LIB_DECL
 int yasm_expr__subst(yasm_expr *e, unsigned int num_items,
                      const yasm_expr__item *items);
 
diff --git a/libyasm/file.h b/libyasm/file.h
index e16491b..3eeeb8e 100644
--- a/libyasm/file.h
+++ b/libyasm/file.h
@@ -34,10 +34,6 @@
 #ifndef YASM_FILE_H
 #define YASM_FILE_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Re2c scanner state. */
 typedef struct yasm_scanner {
     unsigned char *bot;     /**< Bottom of scan buffer */
@@ -52,13 +48,11 @@
 /** Initialize scanner state.
  * \param scanner   Re2c scanner state
  */
-YASM_LIB_DECL
 void yasm_scanner_initialize(yasm_scanner *scanner);
 
 /** Frees any memory used by scanner state; does not free state itself.
  * \param scanner   Re2c scanner state
  */
-YASM_LIB_DECL
 void yasm_scanner_delete(yasm_scanner *scanner);
 
 /** Fill a scanner state structure with data coming from an input function.
@@ -70,7 +64,6 @@
  * \return 1 if this was the first time this function was called on this
  *         scanner state, 0 otherwise.
  */
-YASM_LIB_DECL
 int yasm_fill_helper
     (yasm_scanner *scanner, unsigned char **cursor,
      size_t (*input_func) (void *d, unsigned char *buf, size_t max),
@@ -85,7 +78,6 @@
  * \param str           C-style string (updated in place)
  * \param len           length of string (updated with new length)
  */
-YASM_LIB_DECL
 void yasm_unescape_cstring(unsigned char *str, size_t *len);
 
 /** Split a UNIX pathname into head (directory) and tail (base filename)
@@ -95,7 +87,6 @@
  * \param tail  (returned) base filename
  * \return Length of head (directory).
  */
-YASM_LIB_DECL
 size_t yasm__splitpath_unix(const char *path, /*@out@*/ const char **tail);
 
 /** Split a Windows pathname into head (directory) and tail (base filename)
@@ -105,7 +96,6 @@
  * \param tail  (returned) base filename
  * \return Length of head (directory).
  */
-YASM_LIB_DECL
 size_t yasm__splitpath_win(const char *path, /*@out@*/ const char **tail);
 
 /** Split a pathname into head (directory) and tail (base filename) portions.
@@ -129,7 +119,6 @@
  * \internal
  * \return Current working directory pathname (newly allocated).
  */
-YASM_LIB_DECL
 /*@only@*/ char *yasm__getcwd(void);
 
 /** Convert a relative or absolute pathname into an absolute pathname.
@@ -137,7 +126,6 @@
  * \param path  pathname
  * \return Absolute version of path (newly allocated).
  */
-YASM_LIB_DECL
 /*@only@*/ char *yasm__abspath(const char *path);
 
 /** Build a UNIX pathname that is equivalent to accessing the "to" pathname
@@ -148,7 +136,6 @@
  * \param to    to pathname
  * \return Combined path (newly allocated).
  */
-YASM_LIB_DECL
 char *yasm__combpath_unix(const char *from, const char *to);
 
 /** Build a Windows pathname that is equivalent to accessing the "to" pathname
@@ -159,7 +146,6 @@
  * \param to    to pathname
  * \return Combined path (newly allocated).
  */
-YASM_LIB_DECL
 char *yasm__combpath_win(const char *from, const char *to);
 
 /** Build a pathname that is equivalent to accessing the "to" pathname
@@ -199,19 +185,16 @@
  *                  may be passed if this is unwanted.
  * \return fopen'ed include file, or NULL if not found.
  */
-YASM_LIB_DECL
 /*@null@*/ FILE *yasm_fopen_include
     (const char *iname, const char *from, const char *mode,
      /*@null@*/ /*@out@*/ /*@only@*/ char **oname);
 
 /** Delete any stored include paths added by yasm_add_include_path().
  */
-YASM_LIB_DECL
 void yasm_delete_include_paths(void);
 
 /** Iterate through include paths.
 */
-YASM_LIB_DECL
 const char * yasm_get_include_dir(void **iter);
 
 /** Add an include path for use by yasm_fopen_include().
@@ -220,7 +203,6 @@
  *
  * \param path      path to add
  */
-YASM_LIB_DECL
 void yasm_add_include_path(const char *path);
 
 /** Write an 8-bit value to a buffer, incrementing buffer pointer.
@@ -351,7 +333,6 @@
  * \param f     file
  * \return 1 if the write was successful, 0 if not (just like fwrite()).
  */
-YASM_LIB_DECL
 size_t yasm_fwrite_16_l(unsigned short val, FILE *f);
 
 /** Direct-to-file version of YASM_SAVE_32_L().
@@ -361,7 +342,6 @@
  * \param f     file
  * \return 1 if the write was successful, 0 if not (just like fwrite()).
  */
-YASM_LIB_DECL
 size_t yasm_fwrite_32_l(unsigned long val, FILE *f);
 
 /** Direct-to-file version of YASM_SAVE_16_B().
@@ -371,7 +351,6 @@
  * \param f     file
  * \return 1 if the write was successful, 0 if not (just like fwrite()).
  */
-YASM_LIB_DECL
 size_t yasm_fwrite_16_b(unsigned short val, FILE *f);
 
 /** Direct-to-file version of YASM_SAVE_32_B().
@@ -381,7 +360,6 @@
  * \param f     file
  * \return 1 if the write was successful, 0 if not (just like fwrite()).
  */
-YASM_LIB_DECL
 size_t yasm_fwrite_32_b(unsigned long val, FILE *f);
 
 /** Read an 8-bit value from a buffer, incrementing buffer pointer.
diff --git a/libyasm/floatnum.h b/libyasm/floatnum.h
index 8fa3d1d..15696a5 100644
--- a/libyasm/floatnum.h
+++ b/libyasm/floatnum.h
@@ -36,16 +36,10 @@
 #ifndef YASM_FLOATNUM_H
 #define YASM_FLOATNUM_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Initialize floatnum internal data structures. */
-YASM_LIB_DECL
 void yasm_floatnum_initialize(void);
 
 /** Clean up internal floatnum allocations. */
-YASM_LIB_DECL
 void yasm_floatnum_cleanup(void);
 
 /** Create a new floatnum from a decimal string.  The input string must be in
@@ -53,20 +47,17 @@
  * \param str   floating point decimal string
  * \return Newly allocated floatnum.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_floatnum *yasm_floatnum_create(const char *str);
 
 /** Duplicate a floatnum.
  * \param flt   floatnum
  * \return Newly allocated floatnum with the same value as flt.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_floatnum *yasm_floatnum_copy(const yasm_floatnum *flt);
 
 /** Destroy (free allocated memory for) a floatnum.
  * \param flt   floatnum
  */
-YASM_LIB_DECL
 void yasm_floatnum_destroy(/*@only@*/ yasm_floatnum *flt);
 
 /** Floating point calculation function: acc = acc op operand.
@@ -77,7 +68,6 @@
  * \param operand   floatnum operand
  * \return Nonzero on error.
  */
-YASM_LIB_DECL
 int yasm_floatnum_calc(yasm_floatnum *acc, yasm_expr_op op,
                        yasm_floatnum *operand);
 
@@ -88,7 +78,6 @@
  * \return Nonzero if flt can't fit into single precision: -1 if underflow
  *         occurred, 1 if overflow occurred.
  */
-YASM_LIB_DECL
 int yasm_floatnum_get_int(const yasm_floatnum *flt,
                           /*@out@*/ unsigned long *ret_val);
 
@@ -109,7 +98,6 @@
  * \return Nonzero if flt can't fit into the specified precision: -1 if
  *         underflow occurred, 1 if overflow occurred.
  */
-YASM_LIB_DECL
 int yasm_floatnum_get_sized(const yasm_floatnum *flt, unsigned char *ptr,
                             size_t destsize, size_t valsize, size_t shift,
                             int bigendian, int warn);
@@ -122,14 +110,12 @@
  * \param size      number of bits of output space
  * \return 1 if valid size, 0 if invalid size.
  */
-YASM_LIB_DECL
 int yasm_floatnum_check_size(const yasm_floatnum *flt, size_t size);
 
 /** Print various representations of a floatnum.  For debugging purposes only.
  * \param f         file
  * \param flt       floatnum
  */
-YASM_LIB_DECL
 void yasm_floatnum_print(const yasm_floatnum *flt, FILE *f);
 
 #endif
diff --git a/libyasm/hamt.h b/libyasm/hamt.h
index c54172b..d33bbe3 100644
--- a/libyasm/hamt.h
+++ b/libyasm/hamt.h
@@ -34,10 +34,6 @@
 #ifndef YASM_HAMT_H
 #define YASM_HAMT_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Hash array mapped trie data structure (opaque type). */
 typedef struct HAMT HAMT;
 /** Hash array mapped trie entry (opaque type). */
@@ -49,7 +45,6 @@
  * \param   error_func      function called on internal error
  * \return New, empty, hash array mapped trie.
  */
-YASM_LIB_DECL
 HAMT *HAMT_create(int nocase, /*@exits@*/ void (*error_func)
     (const char *file, unsigned int line, const char *message));
 
@@ -58,7 +53,6 @@
  * \param hamt          Hash array mapped trie
  * \param deletefunc    Data deletion function
  */
-YASM_LIB_DECL
 void HAMT_destroy(/*@only@*/ HAMT *hamt,
                   void (*deletefunc) (/*@only@*/ void *data));
 
@@ -78,7 +72,6 @@
  * \param deletefunc    Data deletion function if data is replaced
  * \return Data now associated with key.
  */
-YASM_LIB_DECL
 /*@dependent@*/ void *HAMT_insert(HAMT *hamt, /*@dependent@*/ const char *str,
                                   /*@only@*/ void *data, int *replace,
                                   void (*deletefunc) (/*@only@*/ void *data));
@@ -88,7 +81,6 @@
  * \param str           Key
  * \return NULL if key/data not present in HAMT, otherwise associated data.
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ void *HAMT_search(HAMT *hamt, const char *str);
 
 /** Traverse over all keys in HAMT, calling function on each data item. 
@@ -98,7 +90,6 @@
  * \return Stops early (and returns func's return value) if func returns a
  *         nonzero value; otherwise 0.
  */
-YASM_LIB_DECL
 int HAMT_traverse(HAMT *hamt, /*@null@*/ void *d,
                   int (*func) (/*@dependent@*/ /*@null@*/ void *node,
                                /*@null@*/ void *d));
@@ -107,21 +98,18 @@
  * \param hamt          Hash array mapped trie
  * \return First entry in HAMT, or NULL if HAMT is empty.
  */
-YASM_LIB_DECL
 const HAMTEntry *HAMT_first(const HAMT *hamt);
 
 /** Get the next entry in a HAMT.
  * \param prev          Previous entry in HAMT
  * \return Next entry in HAMT, or NULL if no more entries.
  */
-YASM_LIB_DECL
 /*@null@*/ const HAMTEntry *HAMT_next(const HAMTEntry *prev);
 
 /** Get the corresponding data for a HAMT entry.
  * \param entry         HAMT entry (as returned by HAMT_first() and HAMT_next())
  * \return Corresponding data item.
  */
-YASM_LIB_DECL
 void *HAMTEntry_get_data(const HAMTEntry *entry);
 
 #endif
diff --git a/libyasm/insn.h b/libyasm/insn.h
index 9fdf0eb..905b2f9 100644
--- a/libyasm/insn.h
+++ b/libyasm/insn.h
@@ -34,10 +34,6 @@
 #ifndef YASM_INSN_H
 #define YASM_INSN_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Base structure for an effective address.  As with all base
  * structures, must be present as the first element in any
  * #yasm_arch implementation of an effective address.
@@ -158,28 +154,24 @@
  * \param ea            effective address
  * \param segreg        segment register (0 if none)
  */
-YASM_LIB_DECL
 void yasm_ea_set_segreg(yasm_effaddr *ea, uintptr_t segreg);
 
 /** Create an instruction operand from a register.
  * \param reg   register
  * \return Newly allocated operand.
  */
-YASM_LIB_DECL
 yasm_insn_operand *yasm_operand_create_reg(uintptr_t reg);
 
 /** Create an instruction operand from a segment register.
  * \param segreg        segment register
  * \return Newly allocated operand.
  */
-YASM_LIB_DECL
 yasm_insn_operand *yasm_operand_create_segreg(uintptr_t segreg);
 
 /** Create an instruction operand from an effective address.
  * \param ea    effective address
  * \return Newly allocated operand.
  */
-YASM_LIB_DECL
 yasm_insn_operand *yasm_operand_create_mem(/*@only@*/ yasm_effaddr *ea);
 
 /** Create an instruction operand from an immediate expression.
@@ -188,7 +180,6 @@
  * \param val   immediate expression
  * \return Newly allocated operand.
  */
-YASM_LIB_DECL
 yasm_insn_operand *yasm_operand_create_imm(/*@only@*/ yasm_expr *val);
 
 /** Get the first operand in an instruction.
@@ -214,7 +205,6 @@
  * \return If operand was actually appended (it wasn't NULL), the operand;
  *         otherwise NULL.
  */
-YASM_LIB_DECL
 /*@null@*/ yasm_insn_operand *yasm_insn_ops_append
     (yasm_insn *insn,
      /*@returned@*/ /*@null@*/ yasm_insn_operand *op);
@@ -223,21 +213,18 @@
  * \param insn          instruction
  * \param prefix        data that identifies the prefix
  */
-YASM_LIB_DECL
 void yasm_insn_add_prefix(yasm_insn *insn, uintptr_t prefix);
 
 /** Associate a segment prefix with an instruction.
  * \param insn          instruction
  * \param segreg        data that identifies the segment register
  */
-YASM_LIB_DECL
 void yasm_insn_add_seg_prefix(yasm_insn *insn, uintptr_t segreg);
 
 /** Initialize the common parts of an instruction.
  * \internal For use by yasm_arch implementations only.
  * \param insn          instruction
  */
-YASM_LIB_DECL
 void yasm_insn_initialize(/*@out@*/ yasm_insn *insn);
 
 /** Delete the common parts of an instruction.
@@ -246,7 +233,6 @@
  * \param content       if nonzero, deletes content of each operand
  * \param arch          architecture
  */
-YASM_LIB_DECL
 void yasm_insn_delete(yasm_insn *insn,
                       void (*ea_destroy) (/*@only@*/ yasm_effaddr *));
 
@@ -257,14 +243,12 @@
  * \param indent_level  indentation level
  * \param arch          architecture
  */
-YASM_LIB_DECL
 void yasm_insn_print(const yasm_insn *insn, FILE *f, int indent_level);
 
 /** Finalize the common parts of an instruction.
  * \internal For use by yasm_arch implementations only.
  * \param insn          instruction
  */
-YASM_LIB_DECL
 void yasm_insn_finalize(yasm_insn *insn);
 
 #endif
diff --git a/libyasm/intnum.h b/libyasm/intnum.h
index 8e1529f..382f5fb 100644
--- a/libyasm/intnum.h
+++ b/libyasm/intnum.h
@@ -34,44 +34,34 @@
 #ifndef YASM_INTNUM_H
 #define YASM_INTNUM_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Initialize intnum internal data structures. */
-YASM_LIB_DECL
 void yasm_intnum_initialize(void);
 
 /** Clean up internal intnum allocations. */
-YASM_LIB_DECL
 void yasm_intnum_cleanup(void);
 
 /** Create a new intnum from a decimal string.
  * \param str       decimal string
  * \return Newly allocated intnum.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_dec(char *str);
 
 /** Create a new intnum from a binary string.
  * \param str       binary string
  * \return Newly allocated intnum.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_bin(char *str);
 
 /** Create a new intnum from an octal string.
  * \param str       octal string
  * \return Newly allocated intnum.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_oct(char *str);
 
 /** Create a new intnum from a hexidecimal string.
  * \param str       hexidecimal string
  * \return Newly allocated intnum.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_hex(char *str);
 
 /** Convert character constant to integer value, using NASM rules.  NASM syntax
@@ -80,21 +70,18 @@
  * \param str       character constant string
  * \return Newly allocated intnum.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_charconst_nasm(const char *str);
 
 /** Create a new intnum from an unsigned integer value.
  * \param i         unsigned integer value
  * \return Newly allocated intnum.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_uint(unsigned long i);
 
 /** Create a new intnum from an signed integer value.
  * \param i         signed integer value
  * \return Newly allocated intnum.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_int(long i);
 
 /** Create a new intnum from LEB128-encoded form.
@@ -104,7 +91,6 @@
  * \return Newly allocated intnum.  Number of bytes read returned into
  *         bytes_read parameter.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_leb128
     (const unsigned char *ptr, int sign, /*@out@*/ unsigned long *size);
 
@@ -115,7 +101,6 @@
  * \param srcsize   source buffer size (in bytes)
  * \param bigendian endianness (nonzero=big, zero=little)
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_create_sized
     (unsigned char *ptr, int sign, size_t srcsize, int bigendian);
 
@@ -123,13 +108,11 @@
  * \param intn  intnum
  * \return Newly allocated intnum with the same value as intn.
  */
-YASM_LIB_DECL
 /*@only@*/ yasm_intnum *yasm_intnum_copy(const yasm_intnum *intn);
 
 /** Destroy (free allocated memory for) an intnum.
  * \param intn  intnum
  */
-YASM_LIB_DECL
 void yasm_intnum_destroy(/*@only@*/ yasm_intnum *intn);
 
 /** Floating point calculation function: acc = acc op operand.
@@ -140,7 +123,6 @@
  * \param operand   intnum operand
  * \return Nonzero if error occurred.
  */
-YASM_LIB_DECL
 int yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand);
 
 /** Compare two intnums.
@@ -148,62 +130,53 @@
  * \param intn2     second intnum
  * \return -1 if intn1 < intn2, 0 if intn1 == intn2, 1 if intn1 > intn2.
  */
-YASM_LIB_DECL
 int yasm_intnum_compare(const yasm_intnum *intn1, const yasm_intnum *intn2);
 
 /** Zero an intnum.
  * \param intn      intnum
  */
-YASM_LIB_DECL
 void yasm_intnum_zero(yasm_intnum *intn);
 
 /** Set an intnum to the value of another intnum.
  * \param intn      intnum
  * \param val       intnum to get value from
  */
-YASM_LIB_DECL
 void yasm_intnum_set(yasm_intnum *intn, const yasm_intnum *val);
 
 /** Set an intnum to an unsigned integer.
  * \param intn      intnum
  * \param val       integer value
  */
-YASM_LIB_DECL
 void yasm_intnum_set_uint(yasm_intnum *intn, unsigned long val);
 
 /** Set an intnum to an signed integer.
  * \param intn      intnum
  * \param val       integer value
  */
-YASM_LIB_DECL
 void yasm_intnum_set_int(yasm_intnum *intn, long val);
 
 /** Simple value check for 0.
  * \param acc       intnum
  * \return Nonzero if acc==0.
  */
-YASM_LIB_DECL
 int yasm_intnum_is_zero(const yasm_intnum *acc);
 
 /** Simple value check for 1.
  * \param acc       intnum
  * \return Nonzero if acc==1.
  */
-YASM_LIB_DECL
 int yasm_intnum_is_pos1(const yasm_intnum *acc);
 
 /** Simple value check for -1.
  * \param acc       intnum
  * \return Nonzero if acc==-1.
  */
-YASM_LIB_DECL
 int yasm_intnum_is_neg1(const yasm_intnum *acc);
 
 /** Simple sign check.
  * \param acc       intnum
  * \return -1 if negative, 0 if zero, +1 if positive
  */
-YASM_LIB_DECL
 int yasm_intnum_sign(const yasm_intnum *acc);
 
 /** Convert an intnum to an unsigned 32-bit value.  The value is in "standard"
@@ -213,7 +186,6 @@
  * \param intn  intnum
  * \return Unsigned 32-bit value of intn.
  */
-YASM_LIB_DECL
 unsigned long yasm_intnum_get_uint(const yasm_intnum *intn);
 
 /** Convert an intnum to a signed 32-bit value.  The value is in "standard" C
@@ -223,7 +195,6 @@
  * \param intn  intnum
  * \return Signed 32-bit value of intn.
  */
-YASM_LIB_DECL
 long yasm_intnum_get_int(const yasm_intnum *intn);
 
 /** Output #yasm_intnum to buffer in little-endian or big-endian.  Puts the
@@ -240,7 +211,6 @@
  * \param warn      enables standard warnings (value doesn't fit into valsize
  *                  bits): <0=signed warnings, >0=unsigned warnings, 0=no warn
  */
-YASM_LIB_DECL
 void yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr,
                            size_t destsize, size_t valsize, int shift,
                            int bigendian, int warn);
@@ -255,7 +225,6 @@
  *                  2 => (signed min, unsigned max)
  * \return Nonzero if intnum will fit.
  */
-YASM_LIB_DECL
 int yasm_intnum_check_size(const yasm_intnum *intn, size_t size,
                            size_t rshift, int rangetype);
 
@@ -265,7 +234,6 @@
  * \param high      high end of range (inclusive)
  * \return Nonzero if intnum is within range.
  */
-YASM_LIB_DECL
 int yasm_intnum_in_range(const yasm_intnum *intn, long low, long high);
 
 /** Output #yasm_intnum to buffer in LEB128-encoded form.
@@ -274,7 +242,6 @@
  * \param sign      signedness of LEB128 encoding (0=unsigned, 1=signed)
  * \return Number of bytes generated.
  */
-YASM_LIB_DECL
 unsigned long yasm_intnum_get_leb128(const yasm_intnum *intn,
                                      unsigned char *ptr, int sign);
 
@@ -283,7 +250,6 @@
  * \param sign      signedness of LEB128 encoding (0=unsigned, 1=signed)
  * \return Number of bytes.
  */
-YASM_LIB_DECL
 unsigned long yasm_intnum_size_leb128(const yasm_intnum *intn, int sign);
 
 /** Output integer to buffer in signed LEB128-encoded form.
@@ -291,14 +257,12 @@
  * \param ptr       pointer to storage for output bytes
  * \return Number of bytes generated.
  */
-YASM_LIB_DECL
 unsigned long yasm_get_sleb128(long v, unsigned char *ptr);
 
 /** Calculate number of bytes signed LEB128-encoded form of integer will take.
  * \param v         integer
  * \return Number of bytes.
  */
-YASM_LIB_DECL
 unsigned long yasm_size_sleb128(long v);
 
 /** Output integer to buffer in unsigned LEB128-encoded form.
@@ -306,14 +270,12 @@
  * \param ptr       pointer to storage for output bytes
  * \return Number of bytes generated.
  */
-YASM_LIB_DECL
 unsigned long yasm_get_uleb128(unsigned long v, unsigned char *ptr);
 
 /** Calculate number of bytes unsigned LEB128-encoded form of integer will take.
  * \param v         integer
  * \return Number of bytes.
  */
-YASM_LIB_DECL
 unsigned long yasm_size_uleb128(unsigned long v);
 
 /** Get an intnum as a signed decimal string.  The returned string will
@@ -322,14 +284,12 @@
  * \return Newly allocated string containing the decimal representation of
  *         the intnum.
  */
-YASM_LIB_DECL
 /*@only@*/ char *yasm_intnum_get_str(const yasm_intnum *intn);
 
 /** Print an intnum.  For debugging purposes.
  * \param f     file
  * \param intn  intnum
  */
-YASM_LIB_DECL
 void yasm_intnum_print(const yasm_intnum *intn, FILE *f);
 
 #endif
diff --git a/libyasm/inttree.h b/libyasm/inttree.h
index de037e4..972f571 100644
--- a/libyasm/inttree.h
+++ b/libyasm/inttree.h
@@ -2,10 +2,6 @@
 #ifndef YASM_INTTREE_H
 #define YASM_INTTREE_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /* The interval_tree.h and interval_tree.cc files contain code for 
  * interval trees implemented using red-black-trees as described in
  * the book _Introduction_To_Algorithms_ by Cormen, Leisserson, 
@@ -49,22 +45,14 @@
     unsigned int recursionNodeStackTop;
 } IntervalTree;
 
-YASM_LIB_DECL
 IntervalTree *IT_create(void);
-YASM_LIB_DECL
 void IT_destroy(IntervalTree *);
-YASM_LIB_DECL
 void IT_print(const IntervalTree *);
-YASM_LIB_DECL
 void *IT_delete_node(IntervalTree *, IntervalTreeNode *, long *low,
                      long *high);
-YASM_LIB_DECL
 IntervalTreeNode *IT_insert(IntervalTree *, long low, long high, void *data);
-YASM_LIB_DECL
 IntervalTreeNode *IT_get_predecessor(const IntervalTree *, IntervalTreeNode *);
-YASM_LIB_DECL
 IntervalTreeNode *IT_get_successor(const IntervalTree *, IntervalTreeNode *);
-YASM_LIB_DECL
 void IT_enumerate(IntervalTree *, long low, long high, void *cbd,
                   void (*callback) (IntervalTreeNode *node, void *cbd));
 
diff --git a/libyasm/linemap.h b/libyasm/linemap.h
index 0391255..1806298 100644
--- a/libyasm/linemap.h
+++ b/libyasm/linemap.h
@@ -34,27 +34,20 @@
 #ifndef YASM_LINEMAP_H
 #define YASM_LINEMAP_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Create a new line mapping repository.
  * \return New repository.
  */
-YASM_LIB_DECL
 yasm_linemap *yasm_linemap_create(void);
 
 /** Clean up any memory allocated for a repository.
  * \param linemap       line mapping repository
  */
-YASM_LIB_DECL
 void yasm_linemap_destroy(yasm_linemap *linemap);
 
 /** Get the current line position in a repository.
  * \param linemap       line mapping repository
  * \return Current virtual line.
  */
-YASM_LIB_DECL
 unsigned long yasm_linemap_get_current(yasm_linemap *linemap);
 
 /** Get bytecode and source line information, if any, for a virtual line.
@@ -66,7 +59,6 @@
  * \note If source line information is not available, bcp and sourcep targets
  * are set to NULL.
  */
-YASM_LIB_DECL
 int yasm_linemap_get_source(yasm_linemap *linemap, unsigned long line,
                             /*@null@*/ yasm_bytecode **bcp,
                             const char **sourcep);
@@ -79,7 +71,6 @@
  * \param source        source code line
  * \note The source code line pointer is NOT kept, it is strdup'ed.
  */
-YASM_LIB_DECL
 void yasm_linemap_add_source(yasm_linemap *linemap,
                              /*@null@*/ yasm_bytecode *bc,
                              const char *source);
@@ -88,7 +79,6 @@
  * \param linemap       line mapping repository
  * \return The current (new) virtual line.
  */
-YASM_LIB_DECL
 unsigned long yasm_linemap_goto_next(yasm_linemap *linemap);
 
 /** Set a new file/line physical association starting point at the current
@@ -99,7 +89,6 @@
  * \param file_line     physical line number
  * \param line_inc      line increment
  */
-YASM_LIB_DECL
 void yasm_linemap_set(yasm_linemap *linemap, /*@null@*/ const char *filename,
                       unsigned long file_line, unsigned long line_inc);
 
@@ -111,7 +100,6 @@
  * \param file_line     physical line number
  * \return The virtual line number of the poked association.
  */
-YASM_LIB_DECL
 unsigned long yasm_linemap_poke(yasm_linemap *linemap,
                                 /*@null@*/ const char *filename,
                                 unsigned long file_line);
@@ -122,7 +110,6 @@
  * \param filename      physical file name (output)
  * \param file_line     physical line number (output)
  */
-YASM_LIB_DECL
 void yasm_linemap_lookup(yasm_linemap *linemap, unsigned long line,
                          /*@out@*/ const char **filename,
                          /*@out@*/ unsigned long *file_line);
@@ -135,7 +122,6 @@
  * \return Stops early (and returns func's return value) if func returns a
  *         nonzero value; otherwise 0.
  */
-YASM_LIB_DECL
 int yasm_linemap_traverse_filenames
     (yasm_linemap *linemap, /*@null@*/ void *d,
      int (*func) (const char *filename, void *d));
diff --git a/libyasm/md5.h b/libyasm/md5.h
index 7226f1d..a7dbc9a 100644
--- a/libyasm/md5.h
+++ b/libyasm/md5.h
@@ -7,10 +7,6 @@
 #ifndef YASM_MD5_H
 #define YASM_MD5_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /* Unlike previous versions of this code, uint32 need not be exactly
    32 bits, merely 32 bits or more.  Choosing a data type which is 32
    bits instead of 64 is not important; speed is considerably more
@@ -23,14 +19,10 @@
         unsigned char in[64];
 } yasm_md5_context;
 
-YASM_LIB_DECL
 void yasm_md5_init(yasm_md5_context *context);
-YASM_LIB_DECL
 void yasm_md5_update(yasm_md5_context *context, unsigned char const *buf,
                      unsigned long len);
-YASM_LIB_DECL
 void yasm_md5_final(unsigned char digest[16], yasm_md5_context *context);
-YASM_LIB_DECL
 void yasm_md5_transform(unsigned long buf[4], const unsigned char in[64]);
 
 #endif /* !YASM_MD5_H */
diff --git a/libyasm/module.h b/libyasm/module.h
index ce2e14b..f930800 100644
--- a/libyasm/module.h
+++ b/libyasm/module.h
@@ -27,10 +27,6 @@
 #ifndef YASM_MODULE_H
 #define YASM_MODULE_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 typedef enum yasm_module_type {
     YASM_MODULE_ARCH = 0,
     YASM_MODULE_DBGFMT,
@@ -40,7 +36,6 @@
     YASM_MODULE_PREPROC
 } yasm_module_type;
 
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ void *yasm_load_module
     (yasm_module_type type, const char *keyword);
 
@@ -57,7 +52,6 @@
 #define yasm_load_preproc(keyword)      \
     yasm_load_module(YASM_MODULE_PREPROC, keyword)
 
-YASM_LIB_DECL
 void yasm_list_modules
     (yasm_module_type type,
      void (*printfunc) (const char *name, const char *keyword));
@@ -75,8 +69,4 @@
 #define yasm_list_preproc(func)         \
     yasm_list_modules(YASM_MODULE_PREPROC, func)
 
-YASM_LIB_DECL
-void yasm_register_module(yasm_module_type type, const char *keyword,
-                          void *data);
-
 #endif
diff --git a/libyasm/module.in b/libyasm/module.in
index ff1e399..2a3fd57 100644
--- a/libyasm/module.in
+++ b/libyasm/module.in
@@ -73,33 +73,14 @@
     {preproc_modules, sizeof(preproc_modules)/sizeof(module)},
 };
 
-typedef struct loaded_module {
-    yasm_module_type type;          /* module type */
-    const char *keyword;            /* module keyword */
-    void *data;                     /* associated data */
-} loaded_module;
-
-static loaded_module *loaded_modules = NULL;
-static size_t num_loaded_modules = 0;
-
 void *
 yasm_load_module(yasm_module_type type, const char *keyword)
 {
     size_t i;
-    module *modules;
-    size_t n;
+    module *modules = module_types[type].m;
+    size_t n = module_types[type].n;
 
-    /* Look for the module/symbol, first in loaded modules */
-    if (loaded_modules) {
-        for (i=0; i<num_loaded_modules; i++) {
-            if (loaded_modules[i].type == type &&
-                yasm__strcasecmp(loaded_modules[i].keyword, keyword) == 0)
-                return loaded_modules[i].data;
-        }
-    }
-
-    modules = module_types[type].m;
-    n = module_types[type].n;
+    /* Look for the module/symbol. */
     for (i=0; i<n; i++) {
         if (yasm__strcasecmp(modules[i].keyword, keyword) == 0)
             return modules[i].data;
@@ -109,21 +90,12 @@
 }
 
 void
-yasm_register_module(yasm_module_type type, const char *keyword, void *data)
+yasm_list_modules(yasm_module_type type,
+                  void (*printfunc) (const char *name, const char *keyword))
 {
-    loaded_modules =
-        yasm_xrealloc(loaded_modules,
-                      (num_loaded_modules+1)*sizeof(loaded_module));
-    loaded_modules[num_loaded_modules].type = type;
-    loaded_modules[num_loaded_modules].keyword = keyword;
-    loaded_modules[num_loaded_modules].data = data;
-    num_loaded_modules++;
-}
-
-static void
-yasm_list_one_module(yasm_module_type type, void *data,
-                     void (*printfunc) (const char *name, const char *keyword))
-{
+    size_t i;
+    module *modules = module_types[type].m;
+    size_t n = module_types[type].n;
     yasm_arch_module *arch;
     yasm_dbgfmt_module *dbgfmt;
     yasm_objfmt_module *objfmt;
@@ -131,50 +103,33 @@
     yasm_parser_module *parser;
     yasm_preproc_module *preproc;
 
-    switch (type) {
-        case YASM_MODULE_ARCH:
-            arch = data;
-            printfunc(arch->name, arch->keyword);
-            break;
-        case YASM_MODULE_DBGFMT:
-            dbgfmt = data;
-            printfunc(dbgfmt->name, dbgfmt->keyword);
-            break;
-        case YASM_MODULE_OBJFMT:
-            objfmt = data;
-            printfunc(objfmt->name, objfmt->keyword);
-            break;
-        case YASM_MODULE_LISTFMT:
-            listfmt = data;
-            printfunc(listfmt->name, listfmt->keyword);
-            break;
-        case YASM_MODULE_PARSER:
-            parser = data;
-            printfunc(parser->name, parser->keyword);
-            break;
-        case YASM_MODULE_PREPROC:
-            preproc = data;
-            printfunc(preproc->name, preproc->keyword);
-            break;
-    }
-}
-
-void
-yasm_list_modules(yasm_module_type type,
-                  void (*printfunc) (const char *name, const char *keyword))
-{
-    size_t i;
-    module *modules;
-    size_t n;;
-
     /* Go through available list, and try to load each one */
-    if (loaded_modules) {
-        for (i=0; i<num_loaded_modules; i++)
-            yasm_list_one_module(type, loaded_modules[i].data, printfunc);
+    for (i=0; i<n; i++) {
+        switch (type) {
+            case YASM_MODULE_ARCH:
+                arch = modules[i].data;
+                printfunc(arch->name, arch->keyword);
+                break;
+            case YASM_MODULE_DBGFMT:
+                dbgfmt = modules[i].data;
+                printfunc(dbgfmt->name, dbgfmt->keyword);
+                break;
+            case YASM_MODULE_OBJFMT:
+                objfmt = modules[i].data;
+                printfunc(objfmt->name, objfmt->keyword);
+                break;
+            case YASM_MODULE_LISTFMT:
+                listfmt = modules[i].data;
+                printfunc(listfmt->name, listfmt->keyword);
+                break;
+            case YASM_MODULE_PARSER:
+                parser = modules[i].data;
+                printfunc(parser->name, parser->keyword);
+                break;
+            case YASM_MODULE_PREPROC:
+                preproc = modules[i].data;
+                printfunc(preproc->name, preproc->keyword);
+                break;
+        }
     }
-
-    modules = module_types[type].m;
-    n = module_types[type].n;
-    for (i=0; i<n; i++)
-        yasm_list_one_module(type, modules[i].data, printfunc);
 }
diff --git a/libyasm/objfmt.h b/libyasm/objfmt.h
index c65e76c..0c40c4a 100644
--- a/libyasm/objfmt.h
+++ b/libyasm/objfmt.h
@@ -77,9 +77,6 @@
     /** NULL-terminated list of directives.  NULL if none. */
     /*@null@*/ const yasm_directive *directives;
 
-    /** NULL-terminated list of standard macro lookups.  NULL if none. */
-    const yasm_stdmac *stdmacs;
-
     /** Create object format.
      * Module-level implementation of yasm_objfmt_create().
      * Call yasm_objfmt_create() instead of calling this function.
diff --git a/libyasm/parser.h b/libyasm/parser.h
index 26c347b..fcbb20c 100644
--- a/libyasm/parser.h
+++ b/libyasm/parser.h
@@ -51,9 +51,6 @@
     /** Default preprocessor. */
     const char *default_preproc_keyword;
 
-    /** NULL-terminated list of standard macro lookups.  NULL if none. */
-    const yasm_stdmac *stdmacs;
-
     /** Parse a source file into an object.
      * \param object    object to parse into (already created)
      * \param pp        preprocessor
diff --git a/libyasm/phash.h b/libyasm/phash.h
index f446eea..c4cc88a 100644
--- a/libyasm/phash.h
+++ b/libyasm/phash.h
@@ -10,12 +10,6 @@
 ------------------------------------------------------------------------------
 */
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
-YASM_LIB_DECL
 unsigned long phash_lookup(const char *k, size_t length,
                            unsigned long level);
-YASM_LIB_DECL
 void phash_checksum(const char *k, size_t length, unsigned long *state);
diff --git a/libyasm/preproc.h b/libyasm/preproc.h
index 0b8c54f..fff40da 100644
--- a/libyasm/preproc.h
+++ b/libyasm/preproc.h
@@ -105,11 +105,6 @@
      * Call yasm_preproc_builtin_define() instead of calling this function.
      */
     void (*define_builtin) (yasm_preproc *preproc, const char *macronameval);
-
-    /** Module-level implementation of yasm_preproc_add_standard().
-     * Call yasm_preproc_add_standard() instead of calling this function.
-     */
-    void (*add_standard) (yasm_preproc *preproc, const char **macros);
 } yasm_preproc_module;
 
 /** Initialize preprocessor.
@@ -174,14 +169,6 @@
 void yasm_preproc_define_builtin(yasm_preproc *preproc,
                                  const char *macronameval);
 
-/** Define additional standard macros, preprocessed after the builtins but
- * prior to any user-defined macros.
- * \param preproc       preprocessor
- * \param macros        NULL-terminated array of macro strings
- */
-void yasm_preproc_add_standard(yasm_preproc *preproc,
-                               const char **macros);
-
 #ifndef YASM_DOXYGEN
 
 /* Inline macro implementations for preproc functions */
@@ -205,9 +192,6 @@
 #define yasm_preproc_define_builtin(preproc, macronameval) \
     ((yasm_preproc_base *)preproc)->module->define_builtin(preproc, \
                                                            macronameval)
-#define yasm_preproc_add_standard(preproc, macros) \
-    ((yasm_preproc_base *)preproc)->module->add_standard(preproc, \
-                                                         macros)
 
 #endif
 
diff --git a/libyasm/section.h b/libyasm/section.h
index 3b3942a..b1d1e51 100644
--- a/libyasm/section.h
+++ b/libyasm/section.h
@@ -34,10 +34,6 @@
 #ifndef YASM_SECTION_H
 #define YASM_SECTION_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Basic YASM relocation.  Object formats will need to extend this
  * structure with additional fields for relocation type, etc.
  */
@@ -89,7 +85,6 @@
  * \param dbgfmt_module debug format module
  * \return Newly allocated object, or NULL on error.
  */
-YASM_LIB_DECL
 /*@null@*/ /*@only@*/ yasm_object *yasm_object_create
     (const char *src_filename, const char *obj_filename,
      /*@kept@*/ yasm_arch *arch,
@@ -110,7 +105,6 @@
  *                  already exists)
  * \return New section.
  */
-YASM_LIB_DECL
 /*@dependent@*/ yasm_section *yasm_object_get_general
     (yasm_object *object, const char *name, unsigned long align, int code,
      int res_only, /*@out@*/ int *isnew, unsigned long line);
@@ -125,7 +119,6 @@
  * \param line                  virtual line (from yasm_linemap)
  * \return 0 if directive recognized, nonzero if unrecognized.
  */
-YASM_LIB_DECL
 int yasm_object_directive(yasm_object *object, const char *name,
                           const char *parser, yasm_valparamhead *valparams,
                           yasm_valparamhead *objext_valparams,
@@ -135,7 +128,6 @@
  * object and all bytecodes within those sections are also deleted.
  * \param object        object
  */
-YASM_LIB_DECL
 void yasm_object_destroy(/*@only@*/ yasm_object *object);
 
 /** Print an object.  For debugging purposes.
@@ -143,7 +135,6 @@
  * \param f             file
  * \param indent_level  indentation level
  */
-YASM_LIB_DECL
 void yasm_object_print(const yasm_object *object, FILE *f, int indent_level);
 
 /** Finalize an object after parsing.
@@ -151,7 +142,6 @@
  * \param errwarns      error/warning set
  * \note Errors/warnings are stored into errwarns.
  */
-YASM_LIB_DECL
 void yasm_object_finalize(yasm_object *object, yasm_errwarns *errwarns);
 
 /** Traverses all sections in an object, calling a function on each section.
@@ -161,7 +151,6 @@
  * \return Stops early (and returns func's return value) if func returns a
  *         nonzero value; otherwise 0.
  */
-YASM_LIB_DECL
 int yasm_object_sections_traverse
     (yasm_object *object, /*@null@*/ void *d,
      int (*func) (yasm_section *sect, /*@null@*/ void *d));
@@ -171,7 +160,6 @@
  * \param name          section name
  * \return Section matching name, or NULL if no match found.
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ yasm_section *yasm_object_find_general
     (yasm_object *object, const char *name);
 
@@ -179,21 +167,18 @@
  * \param object        object
  * \param src_filename  new source filename (e.g. "file.asm")
  */
-YASM_LIB_DECL
 void yasm_object_set_source_fn(yasm_object *object, const char *src_filename);
 
 /** Change the prefix used for externally-visible symbols.
  * \param object        object
  * \param prefix        new prefix
  */
-YASM_LIB_DECL
 void yasm_object_set_global_prefix(yasm_object *object, const char *prefix);
 
 /** Change the suffix used for externally-visible symbols.
  * \param object        object
  * \param suffix        new suffix
  */
-YASM_LIB_DECL
 void yasm_object_set_global_suffix(yasm_object *object, const char *suffix);
 
 /** Optimize an object.  Takes the unoptimized object and optimizes it.
@@ -202,28 +187,24 @@
  * \param errwarns      error/warning set
  * \note Optimization failures are stored into errwarns.
  */
-YASM_LIB_DECL
 void yasm_object_optimize(yasm_object *object, yasm_errwarns *errwarns);
 
 /** Determine if a section is flagged to contain code.
  * \param sect      section
  * \return Nonzero if section is flagged to contain code.
  */
-YASM_LIB_DECL
 int yasm_section_is_code(yasm_section *sect);
 
 /** Get yasm_optimizer-specific flags.  For yasm_optimizer use only.
  * \param sect      section
  * \return Optimizer-specific flags.
  */
-YASM_LIB_DECL
 unsigned long yasm_section_get_opt_flags(const yasm_section *sect);
 
 /** Set yasm_optimizer-specific flags.  For yasm_optimizer use only.
  * \param sect      section
  * \param opt_flags optimizer-specific flags.
  */
-YASM_LIB_DECL
 void yasm_section_set_opt_flags(yasm_section *sect, unsigned long opt_flags);
 
 /** Determine if a section was declared as the "default" section (e.g. not
@@ -231,21 +212,18 @@
  * \param sect      section
  * \return Nonzero if section was declared as default.
  */
-YASM_LIB_DECL
 int yasm_section_is_default(const yasm_section *sect);
 
 /** Set section "default" flag to a new value.
  * \param sect      section
  * \param def       new value of default flag
  */
-YASM_LIB_DECL
 void yasm_section_set_default(yasm_section *sect, int def);
 
 /** Get object owner of a section.
  * \param sect      section
  * \return Object this section is a part of.
  */
-YASM_LIB_DECL
 yasm_object *yasm_section_get_object(const yasm_section *sect);
 
 /** Get assocated data for a section and data callback.
@@ -253,7 +231,6 @@
  * \param callback  callback used when adding data
  * \return Associated data (NULL if none).
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ void *yasm_section_get_data
     (yasm_section *sect, const yasm_assoc_data_callback *callback);
 
@@ -263,7 +240,6 @@
  * \param callback  callback
  * \param data      data to associate
  */
-YASM_LIB_DECL
 void yasm_section_add_data(yasm_section *sect,
                            const yasm_assoc_data_callback *callback,
                            /*@null@*/ /*@only@*/ void *data);
@@ -277,7 +253,6 @@
  * The section will destroy the relocation address; it is the caller's
  * responsibility to destroy any other allocated data.
  */
-YASM_LIB_DECL
 void yasm_section_add_reloc(yasm_section *sect, yasm_reloc *reloc,
     void (*destroy_func) (/*@only@*/ void *reloc));
 
@@ -285,7 +260,6 @@
  * \param sect          section
  * \return First relocation for section.  NULL if no relocations.
  */
-YASM_LIB_DECL
 /*@null@*/ yasm_reloc *yasm_section_relocs_first(yasm_section *sect);
 
 /** Get the next relocation for a section.
@@ -302,7 +276,6 @@
  * \param addrp         address of relocation within section (returned)
  * \param symp          relocated symbol (returned)
  */
-YASM_LIB_DECL
 void yasm_reloc_get(yasm_reloc *reloc, yasm_intnum **addrp,
                     /*@dependent@*/ yasm_symrec **symp);
 
@@ -311,7 +284,6 @@
  * \return First bytecode in section (at least one empty bytecode is always
  *         present).
  */
-YASM_LIB_DECL
 yasm_bytecode *yasm_section_bcs_first(yasm_section *sect);
 
 /** Get the last bytecode in a section.
@@ -319,7 +291,6 @@
  * \return Last bytecode in section (at least one empty bytecode is always
  *         present).
  */
-YASM_LIB_DECL
 yasm_bytecode *yasm_section_bcs_last(yasm_section *sect);
 
 /** Add bytecode to the end of a section.
@@ -331,7 +302,6 @@
  * \return If bytecode was actually appended (it wasn't NULL or empty), the
  *         bytecode; otherwise NULL.
  */
-YASM_LIB_DECL
 /*@only@*/ /*@null@*/ yasm_bytecode *yasm_section_bcs_append
     (yasm_section *sect,
      /*@returned@*/ /*@only@*/ /*@null@*/ yasm_bytecode *bc);
@@ -346,7 +316,6 @@
  * \note If errwarns is non-NULL, yasm_errwarn_propagate() is called after
  *       each call to func (with the bytecode's line number).
  */
-YASM_LIB_DECL
 int yasm_section_bcs_traverse
     (yasm_section *sect, /*@null@*/ yasm_errwarns *errwarns,
      /*@null@*/ void *d, int (*func) (yasm_bytecode *bc, /*@null@*/ void *d));
@@ -355,7 +324,6 @@
  * \param   sect    section
  * \return Section name.
  */
-YASM_LIB_DECL
 /*@observer@*/ const char *yasm_section_get_name(const yasm_section *sect);
 
 /** Change alignment of a section.
@@ -363,7 +331,6 @@
  * \param align     alignment in bytes
  * \param line      virtual line
  */
-YASM_LIB_DECL
 void yasm_section_set_align(yasm_section *sect, unsigned long align,
                             unsigned long line);
 
@@ -371,7 +338,6 @@
  * \param sect      section
  * \return Alignment in bytes (0 if none).
  */
-YASM_LIB_DECL
 unsigned long yasm_section_get_align(const yasm_section *sect);
 
 /** Print a section.  For debugging purposes.
@@ -380,7 +346,6 @@
  * \param sect          section
  * \param print_bcs     if nonzero, print bytecodes within section
  */
-YASM_LIB_DECL
 void yasm_section_print(/*@null@*/ const yasm_section *sect, FILE *f,
                         int indent_level, int print_bcs);
 
diff --git a/libyasm/symrec.h b/libyasm/symrec.h
index 94dca89..0d1245b 100644
--- a/libyasm/symrec.h
+++ b/libyasm/symrec.h
@@ -34,10 +34,6 @@
 #ifndef YASM_SYMREC_H
 #define YASM_SYMREC_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Symbol status.  YASM_SYM_DEFINED is set by yasm_symtab_define_label(),
  * yasm_symtab_define_equ(), or yasm_symtab_declare()/yasm_symrec_declare()
  * with a visibility of #YASM_SYM_EXTERN or #YASM_SYM_COMMON.
@@ -62,7 +58,6 @@
 } yasm_sym_vis;
 
 /** Create a new symbol table. */
-YASM_LIB_DECL
 yasm_symtab *yasm_symtab_create(void);
 
 /** Destroy a symbol table and all internal symbols.
@@ -70,7 +65,6 @@
  * \warning All yasm_symrec *'s into this symbol table become invalid after
  * this is called!
  */
-YASM_LIB_DECL
 void yasm_symtab_destroy(/*@only@*/ yasm_symtab *symtab);
 
 /** Get a reference to the symbol table's "absolute" symbol.  This is
@@ -80,7 +74,6 @@
  * \param symtab    symbol table
  * \return Absolute symbol (dependent pointer, do not free).
  */
-YASM_LIB_DECL
 /*@dependent@*/ yasm_symrec *yasm_symtab_abs_sym(yasm_symtab *symtab);
 
 /** Get a reference to (use) a symbol.  The symbol does not necessarily need to
@@ -90,7 +83,6 @@
  * \param line      virtual line where referenced
  * \return Symbol (dependent pointer, do not free).
  */
-YASM_LIB_DECL
 /*@dependent@*/ yasm_symrec *yasm_symtab_use
     (yasm_symtab *symtab, const char *name, unsigned long line);
 
@@ -102,7 +94,6 @@
  * \return Symbol (dependent pointer, do not free).  May be NULL if symbol
  *         doesn't exist.
  */
-YASM_LIB_DECL
 /*@null@*/ /*@dependent@*/ yasm_symrec *yasm_symtab_get
     (yasm_symtab *symtab, const char *name);
 
@@ -113,7 +104,6 @@
  * \param line      virtual line of EQU
  * \return Symbol (dependent pointer, do not free).
  */
-YASM_LIB_DECL
 /*@dependent@*/ yasm_symrec *yasm_symtab_define_equ
     (yasm_symtab *symtab, const char *name, /*@keep@*/ yasm_expr *e,
      unsigned long line);
@@ -127,7 +117,6 @@
  * \param line      virtual line of label
  * \return Symbol (dependent pointer, do not free).
  */
-YASM_LIB_DECL
 /*@dependent@*/ yasm_symrec *yasm_symtab_define_label
     (yasm_symtab *symtab, const char *name,
      /*@dependent@*/ yasm_bytecode *precbc, int in_table, unsigned long line);
@@ -142,7 +131,6 @@
  * \param line      virtual line of label
  * \return Symbol (dependent pointer, do not free).
  */
-YASM_LIB_DECL
 /*@dependent@*/ yasm_symrec *yasm_symtab_define_curpos
     (yasm_symtab *symtab, const char *name,
      /*@dependent@*/ yasm_bytecode *precbc, unsigned long line);
@@ -155,7 +143,6 @@
  * \param vis       symbol visibility
  * \return Symbol (dependent pointer, do not free).
  */
-YASM_LIB_DECL
 /*@dependent@*/ yasm_symrec *yasm_symtab_define_special
     (yasm_symtab *symtab, const char *name, yasm_sym_vis vis);
 
@@ -167,7 +154,6 @@
  * \param line      virtual line of visibility-setting
  * \return Symbol (dependent pointer, do not free).
  */
-YASM_LIB_DECL
 /*@dependent@*/ yasm_symrec *yasm_symtab_declare
     (yasm_symtab *symtab, const char *name, yasm_sym_vis vis,
      unsigned long line);
@@ -178,7 +164,6 @@
  * \param vis       visibility
  * \param line      virtual line of visibility-setting
  */
-YASM_LIB_DECL
 void yasm_symrec_declare(yasm_symrec *symrec, yasm_sym_vis vis,
                          unsigned long line);
 
@@ -197,7 +182,6 @@
  * \return Nonzero value returned by callback function if it ever returned
  *         nonzero.
  */
-YASM_LIB_DECL
 int /*@alt void@*/ yasm_symtab_traverse
     (yasm_symtab *symtab, /*@null@*/ void *d,
      yasm_symtab_traverse_callback func);
@@ -209,14 +193,12 @@
  * \param symtab    symbol table
  * \return Iterator for the symbol table.
  */
-YASM_LIB_DECL
 const yasm_symtab_iter *yasm_symtab_first(const yasm_symtab *symtab);
 
 /** Move a symbol table iterator to the next symbol in the symbol table.
  * \param prev          Previous iterator value
  * \return Next iterator value, or NULL if no more symbols in the table.
  */
-YASM_LIB_DECL
 /*@null@*/ const yasm_symtab_iter *yasm_symtab_next
     (const yasm_symtab_iter *prev);
 
@@ -224,7 +206,6 @@
  * \param cur           iterator value
  * \return Corresponding symbol.
  */
-YASM_LIB_DECL
 yasm_symrec *yasm_symtab_iter_value(const yasm_symtab_iter *cur);
 
 /** Finalize symbol table after parsing stage.  Checks for symbols that are
@@ -234,7 +215,6 @@
  * \param errwarns      error/warning set
  * \note Errors/warnings are stored into errwarns.
  */
-YASM_LIB_DECL
 void yasm_symtab_parser_finalize(yasm_symtab *symtab, int undef_extern,
                                  yasm_errwarns *errwarns);
 
@@ -243,14 +223,12 @@
  * \param f             file
  * \param indent_level  indentation level
  */
-YASM_LIB_DECL
 void yasm_symtab_print(yasm_symtab *symtab, FILE *f, int indent_level);
 
 /** Get the name of a symbol.
  * \param sym       symbol
  * \return Symbol name.
  */
-YASM_LIB_DECL
 /*@observer@*/ const char *yasm_symrec_get_name(const yasm_symrec *sym);
 
 /** Get the externally-visible (global) name of a symbol.
@@ -258,7 +236,6 @@
  * \param object    object
  * \return Externally-visible symbol name (allocated, caller must free).
  */
-YASM_LIB_DECL
 /*@only@*/ char *yasm_symrec_get_global_name(const yasm_symrec *sym,
                                              const yasm_object *object);
 
@@ -266,42 +243,36 @@
  * \param sym       symbol
  * \return Symbol visibility.
  */
-YASM_LIB_DECL
 yasm_sym_vis yasm_symrec_get_visibility(const yasm_symrec *sym);
 
 /** Get the status of a symbol.
  * \param sym       symbol
  * \return Symbol status.
  */
-YASM_LIB_DECL
 yasm_sym_status yasm_symrec_get_status(const yasm_symrec *sym);
 
 /** Get the virtual line of where a symbol was first defined.
  * \param sym       symbol
  * \return line     virtual line
  */
-YASM_LIB_DECL
 unsigned long yasm_symrec_get_def_line(const yasm_symrec *sym);
 
 /** Get the virtual line of where a symbol was first declared.
  * \param sym       symbol
  * \return line     virtual line
  */
-YASM_LIB_DECL
 unsigned long yasm_symrec_get_decl_line(const yasm_symrec *sym);
 
 /** Get the virtual line of where a symbol was first used.
  * \param sym       symbol
  * \return line     virtual line
  */
-YASM_LIB_DECL
 unsigned long yasm_symrec_get_use_line(const yasm_symrec *sym);
 
 /** Get EQU value of a symbol.
  * \param sym       symbol
  * \return EQU value, or NULL if symbol is not an EQU or is not defined.
  */
-YASM_LIB_DECL
 /*@observer@*/ /*@null@*/ const yasm_expr *yasm_symrec_get_equ
     (const yasm_symrec *sym);
 
@@ -314,7 +285,6 @@
  * \return 0 if not symbol is not a label or if the symbol's visibility is
  *         #YASM_SYM_EXTERN or #YASM_SYM_COMMON (not defined in the file).
  */
-YASM_LIB_DECL
 int yasm_symrec_get_label(const yasm_symrec *sym,
                           /*@out@*/ yasm_symrec_get_label_bytecodep *precbc);
 
@@ -323,28 +293,24 @@
  * \param sym       symbol
  * \return 0 if symbol is not the "absolute" symbol, nonzero otherwise.
  */
-YASM_LIB_DECL
 int yasm_symrec_is_abs(const yasm_symrec *sym);
 
 /** Determine if symbol is a special symbol.
  * \param sym       symbol
  * \return 0 if symbol is not a special symbol, nonzero otherwise.
  */
-YASM_LIB_DECL
 int yasm_symrec_is_special(const yasm_symrec *sym);
 
 /** Determine if symbol is a label representing the current assembly position.
  * \param sym       symbol
  * \return 0 if symbol is not a current position label, nonzero otherwise.
  */
-YASM_LIB_DECL
 int yasm_symrec_is_curpos(const yasm_symrec *sym);
 
 /** Set object-extended valparams.
  * \param sym                   symbol
  * \param objext_valparams      object-extended valparams
  */
-YASM_LIB_DECL
 void yasm_symrec_set_objext_valparams
     (yasm_symrec *sym, /*@only@*/ yasm_valparamhead *objext_valparams);
 
@@ -353,7 +319,6 @@
  * \param sym       symbol
  * \return Object-extended valparams (NULL if none).
  */
-YASM_LIB_DECL
 /*@null@*/ /*@dependent@*/ yasm_valparamhead *yasm_symrec_get_objext_valparams
     (yasm_symrec *sym);
 
@@ -361,7 +326,6 @@
  * \param sym           symbol
  * \param common_size   common size expression
  */
-YASM_LIB_DECL
 void yasm_symrec_set_common_size
     (yasm_symrec *sym, /*@only@*/ yasm_expr *common_size);
 
@@ -370,7 +334,6 @@
  * \param sym       symbol
  * \return Common size (NULL if none).
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ yasm_expr **yasm_symrec_get_common_size
     (yasm_symrec *sym);
 
@@ -379,7 +342,6 @@
  * \param callback  callback used when adding data
  * \return Associated data (NULL if none).
  */
-YASM_LIB_DECL
 /*@dependent@*/ /*@null@*/ void *yasm_symrec_get_data
     (yasm_symrec *sym, const yasm_assoc_data_callback *callback);
 
@@ -389,7 +351,6 @@
  * \param callback  callback
  * \param data      data to associate
  */
-YASM_LIB_DECL
 void yasm_symrec_add_data(yasm_symrec *sym,
                           const yasm_assoc_data_callback *callback,
                           /*@only@*/ /*@null@*/ void *data);
@@ -399,7 +360,6 @@
  * \param indent_level  indentation level
  * \param sym           symbol
  */
-YASM_LIB_DECL
 void yasm_symrec_print(const yasm_symrec *sym, FILE *f, int indent_level);
 
 #endif
diff --git a/libyasm/valparam.h b/libyasm/valparam.h
index 3a7e8df..6914435 100644
--- a/libyasm/valparam.h
+++ b/libyasm/valparam.h
@@ -34,10 +34,6 @@
 #ifndef YASM_VALPARAM_H
 #define YASM_VALPARAM_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Value/parameter pair.  \internal */
 struct yasm_valparam {
     /*@reldef@*/ STAILQ_ENTRY(yasm_valparam) link;  /**< Next pair in list */
@@ -105,7 +101,6 @@
  * \param objext_valparams      object format-specific value/parameters
  * \param line                  virtual line (from yasm_linemap)
  */
-YASM_LIB_DECL
 void yasm_call_directive(const yasm_directive *directive, yasm_object *object,
                          yasm_valparamhead *valparams,
                          yasm_valparamhead *objext_valparams,
@@ -117,7 +112,6 @@
  * \param id_prefix     identifier prefix for raw identifiers
  * \return Newly allocated valparam.
  */
-YASM_LIB_DECL
 yasm_valparam *yasm_vp_create_id(/*@keep@*/ char *v, /*@keep@*/ char *p,
                                  int id_prefix);
 
@@ -126,7 +120,6 @@
  * \param p     parameter
  * \return Newly allocated valparam.
  */
-YASM_LIB_DECL
 yasm_valparam *yasm_vp_create_string(/*@keep@*/ char *v, /*@keep@*/ char *p);
 
 /** Create a new valparam with expression parameter.
@@ -134,7 +127,6 @@
  * \param p     parameter
  * \return Newly allocated valparam.
  */
-YASM_LIB_DECL
 yasm_valparam *yasm_vp_create_expr(/*@keep@*/ char *v,
                                    /*@keep@*/ yasm_expr *p);
 
@@ -146,7 +138,6 @@
  * \return Expression, or NULL if vp is NULL or the parameter cannot be
  *         converted to an expression.
  */
-YASM_LIB_DECL
 /*@null@*/ /*@only@*/ yasm_expr *yasm_vp_expr
     (const yasm_valparam *vp, yasm_symtab *symtab, unsigned long line);
 
@@ -156,7 +147,6 @@
  * \return String, or NULL if vp is NULL or the parameter cannot be realized
  *         as a string.
  */
-YASM_LIB_DECL
 /*@null@*/ /*@dependent@*/ const char *yasm_vp_string(const yasm_valparam *vp);
 
 /** Get a valparam parameter as an identifier.
@@ -164,19 +154,16 @@
  * \return Identifier (string), or NULL if vp is NULL or the parameter is not
  *         an identifier.
  */
-YASM_LIB_DECL
 /*@null@*/ /*@dependent@*/ const char *yasm_vp_id(const yasm_valparam *vp);
 
 /** Create a new linked list of valparams.
  * \return Newly allocated valparam list.
  */
-YASM_LIB_DECL
 yasm_valparamhead *yasm_vps_create(void);
 
 /** Destroy a list of valparams (created with yasm_vps_create).
  * \param headp         list of valparams
  */
-YASM_LIB_DECL
 void yasm_vps_destroy(yasm_valparamhead *headp);
 
 /** Initialize linked list of valparams.
@@ -192,7 +179,6 @@
  * \warning Deletes val/params.
  * \param headp linked list
  */
-YASM_LIB_DECL
 void yasm_vps_delete(yasm_valparamhead *headp);
 
 /** Append valparam to tail of linked list.
@@ -239,7 +225,6 @@
  * \param f     file
  * \param headp linked list
  */
-YASM_LIB_DECL
 void yasm_vps_print(/*@null@*/ const yasm_valparamhead *headp, FILE *f);
 
 /** Directive valparam parse helper structure. */
@@ -295,7 +280,6 @@
  * \return -1 on error, 1 if any arguments matched (including via
  *         catch-all callback), 0 if no match.
  */
-YASM_LIB_DECL
 int yasm_dir_helper(void *obj, yasm_valparam *vp_first, unsigned long line,
                     const yasm_dir_help *help, size_t nhelp, void *data,
                     int (*helper_valparam) (void *object,
@@ -313,7 +297,6 @@
  * \param arg   flag to set
  * \return 0
  */
-YASM_LIB_DECL
 int yasm_dir_helper_flag_set(void *obj, yasm_valparam *vp, unsigned long line,
                              void *data, uintptr_t arg);
 
@@ -327,7 +310,6 @@
  * \param arg   flag to OR
  * \return 0
  */
-YASM_LIB_DECL
 int yasm_dir_helper_flag_or(void *obj, yasm_valparam *vp, unsigned long line,
                             void *data, uintptr_t arg);
 
@@ -341,7 +323,6 @@
  * \param arg   flag to AND
  * \return 0
  */
-YASM_LIB_DECL
 int yasm_dir_helper_flag_and(void *obj, yasm_valparam *vp, unsigned long line,
                              void *data, uintptr_t arg);
 
@@ -359,7 +340,6 @@
  * \param arg   unused argument
  * \return -1 on error, 0 otherwise.
  */
-YASM_LIB_DECL
 int yasm_dir_helper_expr(void *obj, yasm_valparam *vp, unsigned long line,
                          void *data, uintptr_t arg);
 
@@ -377,7 +357,6 @@
  * \param arg   unused argument
  * \return -1 on error, 0 otherwise.
  */
-YASM_LIB_DECL
 int yasm_dir_helper_intn(void *obj, yasm_valparam *vp, unsigned long line,
                          void *data, uintptr_t arg);
 
@@ -394,7 +373,6 @@
  * \param arg   unused
  * \return -1 on error, 0 otherwise.
  */
-YASM_LIB_DECL
 int yasm_dir_helper_string(void *obj, yasm_valparam *vp, unsigned long line,
                            void *data, uintptr_t arg);
 
@@ -406,7 +384,6 @@
  * \param data  unused
  * \return 0
  */
-YASM_LIB_DECL
 int yasm_dir_helper_valparam_warn(void *obj, yasm_valparam *vp,
                                   unsigned long line, void *data);
 #endif
diff --git a/libyasm/value.h b/libyasm/value.h
index 3d51eba..cc6d346 100644
--- a/libyasm/value.h
+++ b/libyasm/value.h
@@ -34,10 +34,6 @@
 #ifndef YASM_VALUE_H
 #define YASM_VALUE_H
 
-#ifndef YASM_LIB_DECL
-#define YASM_LIB_DECL
-#endif
-
 /** Initialize a #yasm_value with just an expression.  No processing is
  * performed, the expression is simply stuck into value.abs and the other
  * fields are initialized.  Use yasm_expr_extract_value() to perform "smart"
@@ -49,7 +45,6 @@
  * \param e         expression (kept)
  * \param size      value size (in bits)
  */
-YASM_LIB_DECL
 void yasm_value_initialize(/*@out@*/ yasm_value *value,
                            /*@null@*/ /*@kept@*/ yasm_expr *e,
                            unsigned int size);
@@ -61,7 +56,6 @@
  * \param sym       symrec
  * \param size      value size (in bits)
  */
-YASM_LIB_DECL
 void yasm_value_init_sym(/*@out@*/ yasm_value *value,
                          /*@null@*/ yasm_symrec *sym, unsigned int size);
 
@@ -70,13 +64,11 @@
  * \param value     value (copy to create)
  * \param orig      original value
  */
-YASM_LIB_DECL
 void yasm_value_init_copy(yasm_value *value, const yasm_value *orig);
 
 /** Frees any memory inside value; does not free value itself.
  * \param value     value
  */
-YASM_LIB_DECL
 void yasm_value_delete(yasm_value *value);
 
 /** Set a value to be relative to the current assembly position rather than
@@ -88,7 +80,6 @@
  * \note If value is just an absolute value, will get an absolute symrec to
  *       reference to (via bc's symbol table).
  */
-YASM_LIB_DECL
 void yasm_value_set_curpos_rel(yasm_value *value, yasm_bytecode *bc,
                                unsigned int ip_rel);
 
@@ -98,7 +89,6 @@
  * \param precbc        previous bytecode to bytecode containing value
  * \return Nonzero if value could not be split.
  */
-YASM_LIB_DECL
 int yasm_value_finalize(yasm_value *value, /*@null@*/ yasm_bytecode *precbc);
 
 /** Break a #yasm_expr into a #yasm_value constituent parts.  Extracts
@@ -120,7 +110,6 @@
  * \note This should only be called after the parse is complete.  Calling
  *       before the parse is complete will usually result in an error return.
  */
-YASM_LIB_DECL
 int yasm_value_finalize_expr(/*@out@*/ yasm_value *value,
                              /*@null@*/ /*@kept@*/ yasm_expr *e,
                              /*@null@*/ yasm_bytecode *precbc,
@@ -137,7 +126,6 @@
  *       as bc (and there is no WRT or SEG).
  * \return Intnum if can be resolved to integer value, otherwise NULL.
  */
-YASM_LIB_DECL
 /*@null@*/ /*@only@*/ yasm_intnum *yasm_value_get_intnum
     (yasm_value *value, /*@null@*/ yasm_bytecode *bc, int calc_bc_dist);
 
@@ -160,7 +148,6 @@
  * \return 0 if no value output due to value needing relocation;
  *         1 if value output; -1 if error.
  */
-YASM_LIB_DECL
 int yasm_value_output_basic
     (yasm_value *value, /*@out@*/ unsigned char *buf, size_t destsize,
      yasm_bytecode *bc, int warn, yasm_arch *arch);
@@ -170,7 +157,6 @@
  * \param indent_level  indentation level
  * \param f             file
  */
-YASM_LIB_DECL
 void yasm_value_print(const yasm_value *value, FILE *f, int indent_level);
 
 #endif
diff --git a/libyasm/xmalloc.c b/libyasm/xmalloc.c
index 30b30f4..d2cd238 100644
--- a/libyasm/xmalloc.c
+++ b/libyasm/xmalloc.c
@@ -47,15 +47,11 @@
     /*@modifies p@*/;
 
 /* storage for global function pointers */
-YASM_LIB_DECL
 /*@only@*/ /*@out@*/ void * (*yasm_xmalloc) (size_t size) = def_xmalloc;
-YASM_LIB_DECL
 /*@only@*/ void * (*yasm_xcalloc) (size_t nelem, size_t elsize) = def_xcalloc;
-YASM_LIB_DECL
 /*@only@*/ void * (*yasm_xrealloc)
     (/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size)
     /*@modifies oldmem@*/ = def_xrealloc;
-YASM_LIB_DECL
 void (*yasm_xfree) (/*@only@*/ /*@out@*/ /*@null@*/ void *p)
     /*@modifies p@*/ = def_xfree;
 
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt
deleted file mode 100644
index 48a3b5c..0000000
--- a/modules/CMakeLists.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
-
-INCLUDE(arch/CMakeLists.txt)
-INCLUDE(listfmts/CMakeLists.txt)
-INCLUDE(parsers/CMakeLists.txt)
-INCLUDE(preprocs/CMakeLists.txt)
-INCLUDE(dbgfmts/CMakeLists.txt)
-INCLUDE(objfmts/CMakeLists.txt)
-
-MESSAGE(STATUS "Standard modules: ${YASM_MODULES}")
-
-#
-# Generate init_plugin.c
-# This file provides the yasm_init_plugin() function for yasmstd.
-#
-
-SET(INIT_PLUGIN_C ${CMAKE_CURRENT_BINARY_DIR}/init_plugin.c)
-SET(INIT_PLUGIN_C_REV 1)
-
-# Don't regen if no changes; default to regen
-SET(regen_init_plugin_c TRUE)
-IF(EXISTS ${INIT_PLUGIN_C})
-    FILE(READ ${INIT_PLUGIN_C} _old_init_plugin_c)
-    STRING(REGEX MATCHALL "[^\n]*\n" _lines "${_old_init_plugin_c}")
-    #MESSAGE(STATUS "Lines: ${_lines}")
-
-    LIST(GET _lines 0 _line0)
-    STRING(REGEX MATCH "([A-Za-z][A-Za-z0-9_]+[ ]?)+" _old_modules "${_line0}")
-    #MESSAGE(STATUS "Old modules: ${_old_modules}")
-    STRING(REPLACE ";" " " _modules_str "${YASM_MODULES}")
-    STRING(COMPARE EQUAL "${_old_modules}" "${_modules_str} " _modules_match)
-
-    LIST(GET _lines 1 _line1)
-    STRING(REGEX MATCH "rev [0-9]+" _old_modules_rev "${_line1}")
-    #MESSAGE(STATUS "Old modules rev: ${_old_modules_rev}")
-    STRING(COMPARE EQUAL "${_old_modules_rev}" "rev ${INIT_PLUGIN_C_REV}"
-           _modules_rev_match)
-
-    IF(_modules_match AND _modules_rev_match)
-        SET(regen_init_plugin_c FALSE)
-    ENDIF(_modules_match AND _modules_rev_match)
-ENDIF(EXISTS ${INIT_PLUGIN_C})
-
-IF(regen_init_plugin_c)
-    MESSAGE(STATUS "Generating standard plugin initialization file")
-    STRING(REPLACE ";" " " _modules_str "${YASM_MODULES}")
-    FILE(WRITE ${INIT_PLUGIN_C} "/* ${_modules_str} \n")
-    FILE(APPEND ${INIT_PLUGIN_C} "   rev ${INIT_PLUGIN_C_REV}\n")
-    FILE(APPEND ${INIT_PLUGIN_C} " */\n\n")
-    FILE(APPEND ${INIT_PLUGIN_C} "#include <libyasm.h>\n")
-    FILE(APPEND ${INIT_PLUGIN_C} "#include <libyasm/module.h>\n\n")
-    FOREACH(module ${YASM_MODULES})
-        STRING(REGEX MATCHALL "[a-zA-Z][a-zA-Z0-9]+" _modulepath ${module})
-        LIST(GET _modulepath 0 _type)
-        LIST(GET _modulepath 1 _keyword)
-        FILE(APPEND ${INIT_PLUGIN_C}
-             "extern yasm_${_type}_module yasm_${_keyword}_LTX_${_type};\n")
-    ENDFOREACH(module)
-    FILE(APPEND ${INIT_PLUGIN_C} "\n#ifdef _MSC_VER\n")
-    FILE(APPEND ${INIT_PLUGIN_C} "__declspec(dllexport)\n")
-    FILE(APPEND ${INIT_PLUGIN_C} "#endif\n")
-    FILE(APPEND ${INIT_PLUGIN_C} "void\n")
-    FILE(APPEND ${INIT_PLUGIN_C} "yasm_init_plugin(void)\n")
-    FILE(APPEND ${INIT_PLUGIN_C} "{\n")
-    FOREACH(module ${YASM_MODULES})
-        STRING(REGEX MATCHALL "[a-zA-Z][a-zA-Z0-9]+" _modulepath ${module})
-        LIST(GET _modulepath 0 _type)
-        LIST(GET _modulepath 1 _keyword)
-        SET(_data "yasm_${_keyword}_LTX_${_type}")
-        STRING(TOUPPER "${_type}" _type)
-        FILE(APPEND ${INIT_PLUGIN_C}
-             "    yasm_register_module(YASM_MODULE_${_type}, \"${_keyword}\", &${_data});\n")
-    ENDFOREACH(module)
-    FILE(APPEND ${INIT_PLUGIN_C} "}\n") 
-ELSE(regen_init_plugin_c)
-    MESSAGE(STATUS "Not regenerating static modules file (unchanged)")
-ENDIF(regen_init_plugin_c)
-
-SET_SOURCE_FILES_PROPERTIES(init_plugin.c GENERATED)
-
-SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
-
-ADD_LIBRARY(yasmstd MODULE
-    init_plugin.c
-    ${YASM_MODULES_SRC}
-    )
-TARGET_LINK_LIBRARIES(yasmstd libyasm)
-
-IF(WIN32)
-    INSTALL(TARGETS yasmstd LIBRARY DESTINATION bin)
-ELSE(WIN32)
-    INSTALL(TARGETS yasmstd LIBRARY DESTINATION lib)
-ENDIF(WIN32)
diff --git a/modules/arch/CMakeLists.txt b/modules/arch/CMakeLists.txt
deleted file mode 100644
index ea65fbd..0000000
--- a/modules/arch/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE(arch/lc3b/CMakeLists.txt)
-INCLUDE(arch/x86/CMakeLists.txt)
diff --git a/modules/arch/lc3b/CMakeLists.txt b/modules/arch/lc3b/CMakeLists.txt
deleted file mode 100644
index 0d5df70..0000000
--- a/modules/arch/lc3b/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-YASM_RE2C(
-    ${CMAKE_CURRENT_SOURCE_DIR}/arch/lc3b/lc3bid.re
-    ${CMAKE_CURRENT_BINARY_DIR}/lc3bid.c
-    -s
-    )
-
-YASM_ADD_MODULE(arch_lc3b
-    arch/lc3b/lc3barch.c
-    arch/lc3b/lc3bbc.c
-    lc3bid.c
-    )
diff --git a/modules/arch/x86/CMakeLists.txt b/modules/arch/x86/CMakeLists.txt
deleted file mode 100644
index d15c994..0000000
--- a/modules/arch/x86/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-ADD_CUSTOM_COMMAND(
-    OUTPUT
-        ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c
-        ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf
-        ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf
-    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/arch/x86/gen_x86_insn.py
-           ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c
-           ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf
-           ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf
-    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/arch/x86/gen_x86_insn.py
-    )
-
-YASM_GENPERF(
-    ${CMAKE_CURRENT_SOURCE_DIR}/arch/x86/x86cpu.gperf
-    ${CMAKE_CURRENT_BINARY_DIR}/x86cpu.c
-    )
-
-YASM_GENPERF(
-    ${CMAKE_CURRENT_SOURCE_DIR}/arch/x86/x86regtmod.gperf
-    ${CMAKE_CURRENT_BINARY_DIR}/x86regtmod.c
-    )
-
-YASM_GENPERF(
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.c
-    )
-
-YASM_GENPERF(
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.c
-    )
-
-YASM_ADD_MODULE(arch_x86
-    arch/x86/x86arch.c
-    arch/x86/x86bc.c
-    arch/x86/x86expr.c
-    arch/x86/x86id.c
-    x86cpu.c
-    x86regtmod.c
-    )
-
-SET(insn_DEPS
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.c
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.c
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c
-    )
-
-SET_SOURCE_FILES_PROPERTIES(arch/x86/x86id.c PROPERTIES
-    OBJECT_DEPENDS "${insn_DEPS}"
-    )
diff --git a/modules/dbgfmts/CMakeLists.txt b/modules/dbgfmts/CMakeLists.txt
deleted file mode 100644
index 93c29fe..0000000
--- a/modules/dbgfmts/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-INCLUDE(dbgfmts/codeview/CMakeLists.txt)
-INCLUDE(dbgfmts/dwarf2/CMakeLists.txt)
-INCLUDE(dbgfmts/null/CMakeLists.txt)
-INCLUDE(dbgfmts/stabs/CMakeLists.txt)
diff --git a/modules/dbgfmts/codeview/CMakeLists.txt b/modules/dbgfmts/codeview/CMakeLists.txt
deleted file mode 100644
index 3ecd9fa..0000000
--- a/modules/dbgfmts/codeview/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-YASM_ADD_MODULE(dbgfmt_cv8
-    dbgfmts/codeview/cv-dbgfmt.c
-    dbgfmts/codeview/cv-symline.c
-    dbgfmts/codeview/cv-type.c
-    )
diff --git a/modules/dbgfmts/dwarf2/CMakeLists.txt b/modules/dbgfmts/dwarf2/CMakeLists.txt
deleted file mode 100644
index 671910e..0000000
--- a/modules/dbgfmts/dwarf2/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-YASM_ADD_MODULE(dbgfmt_dwarf2
-    dbgfmts/dwarf2/dwarf2-dbgfmt.c
-    dbgfmts/dwarf2/dwarf2-line.c
-    dbgfmts/dwarf2/dwarf2-aranges.c
-    dbgfmts/dwarf2/dwarf2-info.c
-    )
diff --git a/modules/dbgfmts/null/CMakeLists.txt b/modules/dbgfmts/null/CMakeLists.txt
deleted file mode 100644
index 9f85b2f..0000000
--- a/modules/dbgfmts/null/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(dbgfmt_null
-    dbgfmts/null/null-dbgfmt.c
-    )
diff --git a/modules/dbgfmts/stabs/CMakeLists.txt b/modules/dbgfmts/stabs/CMakeLists.txt
deleted file mode 100644
index bd3b026..0000000
--- a/modules/dbgfmts/stabs/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(dbgfmt_stabs
-    dbgfmts/stabs/stabs-dbgfmt.c
-    )
diff --git a/modules/listfmts/CMakeLists.txt b/modules/listfmts/CMakeLists.txt
deleted file mode 100644
index ce3c92a..0000000
--- a/modules/listfmts/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-INCLUDE(listfmts/nasm/CMakeLists.txt)
diff --git a/modules/listfmts/nasm/CMakeLists.txt b/modules/listfmts/nasm/CMakeLists.txt
deleted file mode 100644
index 9d54f82..0000000
--- a/modules/listfmts/nasm/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(listfmt_nasm
-    listfmts/nasm/nasm-listfmt.c
-    )
diff --git a/modules/objfmts/CMakeLists.txt b/modules/objfmts/CMakeLists.txt
deleted file mode 100644
index c00a3a0..0000000
--- a/modules/objfmts/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDE(objfmts/dbg/CMakeLists.txt)
-INCLUDE(objfmts/bin/CMakeLists.txt)
-INCLUDE(objfmts/elf/CMakeLists.txt)
-INCLUDE(objfmts/coff/CMakeLists.txt)
-INCLUDE(objfmts/macho/CMakeLists.txt)
-INCLUDE(objfmts/rdf/CMakeLists.txt)
-#INCLUDE(objfmts/win32/CMakeLists.txt)
-#INCLUDE(objfmts/win64/CMakeLists.txt)
-INCLUDE(objfmts/xdf/CMakeLists.txt)
diff --git a/modules/objfmts/bin/CMakeLists.txt b/modules/objfmts/bin/CMakeLists.txt
deleted file mode 100644
index a3d396a..0000000
--- a/modules/objfmts/bin/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(objfmt_bin
-    objfmts/bin/bin-objfmt.c
-    )
diff --git a/modules/objfmts/bin/bin-objfmt.c b/modules/objfmts/bin/bin-objfmt.c
index fc283d7..89b395b 100644
--- a/modules/objfmts/bin/bin-objfmt.c
+++ b/modules/objfmts/bin/bin-objfmt.c
@@ -1773,18 +1773,6 @@
     { NULL, NULL, NULL, 0 }
 };
 
-static const char *bin_nasm_stdmac[] = {
-    "%imacro org 1+.nolist",
-    "[org %1]",
-    "%endmacro",
-    NULL
-};
-
-static const yasm_stdmac bin_objfmt_stdmacs[] = {
-    { "nasm", "nasm", bin_nasm_stdmac },
-    { NULL, NULL, NULL }
-};
-
 /* Define objfmt structure -- see objfmt.h for details */
 yasm_objfmt_module yasm_bin_LTX_objfmt = {
     "Flat format binary",
@@ -1794,7 +1782,6 @@
     bin_objfmt_dbgfmt_keywords,
     "null",
     bin_objfmt_directives,
-    bin_objfmt_stdmacs,
     bin_objfmt_create,
     bin_objfmt_output,
     bin_objfmt_destroy,
diff --git a/modules/objfmts/coff/CMakeLists.txt b/modules/objfmts/coff/CMakeLists.txt
deleted file mode 100644
index 5f63d4f..0000000
--- a/modules/objfmts/coff/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-YASM_GENMACRO(
-    ${CMAKE_CURRENT_SOURCE_DIR}/objfmts/coff/win64-nasm.mac
-    ${CMAKE_CURRENT_BINARY_DIR}/win64-nasm.c
-    win64_nasm_stdmac
-    )
-
-YASM_GENMACRO(
-    ${CMAKE_CURRENT_SOURCE_DIR}/objfmts/coff/win64-gas.mac
-    ${CMAKE_CURRENT_BINARY_DIR}/win64-gas.c
-    win64_gas_stdmac
-    )
-
-SET(coff_DEPS
-    ${CMAKE_CURRENT_BINARY_DIR}/win64-nasm.c
-    ${CMAKE_CURRENT_BINARY_DIR}/win64-gas.c
-    )
-
-SET_SOURCE_FILES_PROPERTIES(objfmts/coff/coff-objfmt.c PROPERTIES
-    OBJECT_DEPENDS "${coff_DEPS}"
-    )
-
-YASM_ADD_MODULE(objfmt_coff
-    objfmts/coff/coff-objfmt.c
-    objfmts/coff/win64-except.c
-    )
-list(APPEND YASM_MODULES objfmt_win32)
-list(APPEND YASM_MODULES objfmt_win64)
diff --git a/modules/objfmts/coff/Makefile.inc b/modules/objfmts/coff/Makefile.inc
index e9e8576..526f771 100644
--- a/modules/objfmts/coff/Makefile.inc
+++ b/modules/objfmts/coff/Makefile.inc
@@ -6,22 +6,6 @@
 
 YASM_MODULES += objfmt_coff
 
-$(top_srcdir)/modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
-
-win64-nasm.c: $(srcdir)/modules/objfmts/coff/win64-nasm.mac genmacro$(EXEEXT)
-	$(top_builddir)/genmacro$(EXEEXT) $@ win64_nasm_stdmac $(srcdir)/modules/objfmts/coff/win64-nasm.mac
-
-BUILT_SOURCES += win64-nasm.c
-CLEANFILES += win64-nasm.c
-EXTRA_DIST += modules/objfmts/coff/win64-nasm.mac
-
-win64-gas.c: $(srcdir)/modules/objfmts/coff/win64-gas.mac genmacro$(EXEEXT)
-	$(top_builddir)/genmacro$(EXEEXT) $@ win64_gas_stdmac $(srcdir)/modules/objfmts/coff/win64-gas.mac
-
-BUILT_SOURCES += win64-gas.c
-CLEANFILES += win64-gas.c
-EXTRA_DIST += modules/objfmts/coff/win64-gas.mac
-
 EXTRA_DIST += modules/objfmts/coff/tests/Makefile.inc
 
 include modules/objfmts/coff/tests/Makefile.inc
diff --git a/modules/objfmts/coff/coff-objfmt.c b/modules/objfmts/coff/coff-objfmt.c
index 46f6d1e..5800f60 100644
--- a/modules/objfmts/coff/coff-objfmt.c
+++ b/modules/objfmts/coff/coff-objfmt.c
@@ -2201,7 +2201,6 @@
     coff_objfmt_dbgfmt_keywords,
     "null",
     coff_objfmt_directives,
-    NULL,   /* no standard macros */
     coff_objfmt_create,
     coff_objfmt_output,
     coff_objfmt_destroy,
@@ -2220,29 +2219,13 @@
 
 static const yasm_directive win32_objfmt_directives[] = {
     { ".ident",         "gas",  dir_ident,      YASM_DIR_ANY },
-    { "ident",          "nasm", dir_ident,      YASM_DIR_ANY },
     { ".export",        "gas",  dir_export,     YASM_DIR_ID_REQUIRED },
+    { "ident",          "nasm", dir_ident,      YASM_DIR_ANY },
     { "export",         "nasm", dir_export,     YASM_DIR_ID_REQUIRED },
-    { ".safeseh",       "gas",  dir_safeseh,    YASM_DIR_ID_REQUIRED },
     { "safeseh",        "nasm", dir_safeseh,    YASM_DIR_ID_REQUIRED },
     { NULL, NULL, NULL, 0 }
 };
 
-static const char *win32_nasm_stdmac[] = {
-    "%imacro export 1+.nolist",
-    "[export %1]",
-    "%endmacro",
-    "%imacro safeseh 1+.nolist",
-    "[safeseh %1]",
-    "%endmacro",
-    NULL
-};
-
-static const yasm_stdmac win32_objfmt_stdmacs[] = {
-    { "nasm", "nasm", win32_nasm_stdmac },
-    { NULL, NULL, NULL }
-};
-
 /* Define objfmt structure -- see objfmt.h for details */
 yasm_objfmt_module yasm_win32_LTX_objfmt = {
     "Win32",
@@ -2252,7 +2235,6 @@
     winXX_objfmt_dbgfmt_keywords,
     "null",
     win32_objfmt_directives,
-    win32_objfmt_stdmacs,
     win32_objfmt_create,
     coff_objfmt_output,
     coff_objfmt_destroy,
@@ -2266,36 +2248,18 @@
     { "ident",          "nasm", dir_ident,      YASM_DIR_ANY },
     { ".export",        "gas",  dir_export,     YASM_DIR_ID_REQUIRED },
     { "export",         "nasm", dir_export,     YASM_DIR_ID_REQUIRED },
-    { ".proc_frame",    "gas",  dir_proc_frame, YASM_DIR_ID_REQUIRED },
     { "proc_frame",     "nasm", dir_proc_frame, YASM_DIR_ID_REQUIRED },
-    { ".pushreg",       "gas",  dir_pushreg,    YASM_DIR_ARG_REQUIRED },
     { "pushreg",        "nasm", dir_pushreg,    YASM_DIR_ARG_REQUIRED },
-    { ".setframe",      "gas",  dir_setframe,   YASM_DIR_ARG_REQUIRED },
     { "setframe",       "nasm", dir_setframe,   YASM_DIR_ARG_REQUIRED },
-    { ".allocstack",    "gas",  dir_allocstack, YASM_DIR_ARG_REQUIRED },
     { "allocstack",     "nasm", dir_allocstack, YASM_DIR_ARG_REQUIRED },
-    { ".savereg",       "gas",  dir_savereg,    YASM_DIR_ARG_REQUIRED },
     { "savereg",        "nasm", dir_savereg,    YASM_DIR_ARG_REQUIRED },
-    { ".savexmm128",    "gas",  dir_savexmm128, YASM_DIR_ARG_REQUIRED },
     { "savexmm128",     "nasm", dir_savexmm128, YASM_DIR_ARG_REQUIRED },
-    { ".pushframe",     "gas",  dir_pushframe,  YASM_DIR_ANY },
     { "pushframe",      "nasm", dir_pushframe,  YASM_DIR_ANY },
-    { ".endprolog",     "gas",  dir_endprolog,  YASM_DIR_ANY },
     { "endprolog",      "nasm", dir_endprolog,  YASM_DIR_ANY },
-    { ".endproc_frame", "gas",  dir_endproc_frame, YASM_DIR_ANY },
     { "endproc_frame",  "nasm", dir_endproc_frame, YASM_DIR_ANY },
     { NULL, NULL, NULL, 0 }
 };
 
-#include "win64-nasm.c"
-#include "win64-gas.c"
-
-static const yasm_stdmac win64_objfmt_stdmacs[] = {
-    { "nasm", "nasm", win64_nasm_stdmac },
-    { "gas", "nasm", win64_gas_stdmac },
-    { NULL, NULL, NULL }
-};
-
 /* Define objfmt structure -- see objfmt.h for details */
 yasm_objfmt_module yasm_win64_LTX_objfmt = {
     "Win64",
@@ -2305,7 +2269,6 @@
     winXX_objfmt_dbgfmt_keywords,
     "null",
     win64_objfmt_directives,
-    win64_objfmt_stdmacs,
     win64_objfmt_create,
     coff_objfmt_output,
     coff_objfmt_destroy,
@@ -2321,7 +2284,6 @@
     winXX_objfmt_dbgfmt_keywords,
     "null",
     win64_objfmt_directives,
-    win64_objfmt_stdmacs,
     win64_objfmt_create,
     coff_objfmt_output,
     coff_objfmt_destroy,
diff --git a/modules/objfmts/coff/win64-except.c b/modules/objfmts/coff/win64-except.c
index 11ea4bd..ea70381 100644
--- a/modules/objfmts/coff/win64-except.c
+++ b/modules/objfmts/coff/win64-except.c
@@ -34,7 +34,7 @@
 
 #define UNW_FLAG_EHANDLER   0x01
 #define UNW_FLAG_UHANDLER   0x02
-#define UNW_FLAG_CHAININFO  0x04
+#define UNW_FLAG_CHAININFO  0x03
 
 /* Bytecode callback function prototypes */
 static void win64_uwinfo_bc_destroy(void *contents);
diff --git a/modules/objfmts/coff/win64-gas.mac b/modules/objfmts/coff/win64-gas.mac
deleted file mode 100644
index c8c36fb..0000000
--- a/modules/objfmts/coff/win64-gas.mac
+++ /dev/null
@@ -1,73 +0,0 @@
-%imacro export 1+.nolist
-.export %1
-%endmacro
-
-; Raw exception handling operations
-%imacro proc_frame 1+.nolist
-%1:
-.proc_frame %1
-%endmacro
-
-%imacro endproc_frame 0.nolist
-.endproc_frame
-%endmacro
-
-; Complex (macro) exception handling operations
-; Mimics many macros provided by MASM's macamd64.inc
-%imacro push_reg 1
-pushq %1
-.pushreg %1
-%endmacro
-
-%imacro rex_push_reg 1
-.byte 0x48
-pushq %1
-.pushreg %1
-%endmacro
-
-%imacro push_eflags 0
-pushfq
-.allocstack 8
-%endmacro
-
-%imacro rex_push_eflags 0
-.byte 0x48
-pushfq
-.allocstack 8
-%endmacro
-
-%imacro alloc_stack 1
-subq $%1, %rsp
-.allocstack %1
-%endmacro
-
-%imacro save_reg 2
-movq %1, %2(%rsp)
-.savereg %1 %2
-%endmacro
-
-%imacro save_xmm128 2
-movdqa %1, %2(%rsp)
-.savexmm128 %1, %2
-%endmacro
-
-%imacro push_frame 0-1.nolist
-.pushframe %1
-%endmacro
-
-%imacro set_frame 1-2
-%if %0==1
-movq %rsp, %1
-%else
-leaq %2(%rsp), %1
-%endif
-.setframe %1, %2
-%endmacro
-
-%imacro end_prolog 0.nolist
-.endprolog
-%endmacro
-
-%imacro end_prologue 0.nolist
-.endprolog
-%endmacro
diff --git a/modules/objfmts/coff/win64-nasm.mac b/modules/objfmts/coff/win64-nasm.mac
deleted file mode 100644
index 13954b8..0000000
--- a/modules/objfmts/coff/win64-nasm.mac
+++ /dev/null
@@ -1,106 +0,0 @@
-%imacro export 1+.nolist
-[export %1]
-%endmacro
-
-; Raw exception handling operations
-%imacro proc_frame 1+.nolist
-%1:
-[proc_frame %1]
-%endmacro
-
-; Disable these as they're too closely named to the macroized ones.
-; MASM needs a preceding . to use these, so it seems reasonable for
-; us to similarly require the [].
-;
-;%imacro pushreg 1.nolist
-;[pushreg %1]
-;%endmacro
-;
-;%imacro setframe 1-2.nolist
-;[setframe %1 %2]
-;%endmacro
-;
-;%imacro allocstack 1.nolist
-;[allocstack %1]
-;%endmacro
-;
-;%imacro savereg 2.nolist
-;[savereg %1 %2]
-;%endmacro
-;
-;%imacro savexmm128 2.nolist
-;[savexmm128 %1 %2]
-;%endmacro
-;
-;%imacro pushframe 0-1.nolist
-;[pushframe %1]
-;%endmacro
-;
-;%imacro endprolog 0.nolist
-;[endprolog]
-;%endmacro
-;
-
-%imacro endproc_frame 0.nolist
-[endproc_frame]
-%endmacro
-
-; Complex (macro) exception handling operations
-; Mimics many macros provided by MASM's macamd64.inc
-%imacro push_reg 1
-push %1
-[pushreg %1]
-%endmacro
-
-%imacro rex_push_reg 1
-db 0x48
-push %1
-[pushreg %1]
-%endmacro
-
-%imacro push_eflags 0
-pushfq
-[allocstack 8]
-%endmacro
-
-%imacro rex_push_eflags 0
-db 0x48
-pushfq
-[allocstack 8]
-%endmacro
-
-%imacro alloc_stack 1
-sub rsp, %1
-[allocstack %1]
-%endmacro
-
-%imacro save_reg 2
-mov [rsp+%2], %1
-[savereg %1 %2]
-%endmacro
-
-%imacro save_xmm128 2
-movdqa [rsp+%2], %1
-[savexmm128 %1 %2]
-%endmacro
-
-%imacro push_frame 0-1.nolist
-[pushframe %1]
-%endmacro
-
-%imacro set_frame 1-2
-%if %0==1
-mov %1, rsp
-%else
-lea %1, [rsp+%2]
-%endif
-[setframe %1 %2]
-%endmacro
-
-%imacro end_prolog 0.nolist
-[endprolog]
-%endmacro
-
-%imacro end_prologue 0.nolist
-[endprolog]
-%endmacro
diff --git a/modules/objfmts/dbg/CMakeLists.txt b/modules/objfmts/dbg/CMakeLists.txt
deleted file mode 100644
index ba5193f..0000000
--- a/modules/objfmts/dbg/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(objfmt_dbg
-    objfmts/dbg/dbg-objfmt.c
-    )
diff --git a/modules/objfmts/dbg/dbg-objfmt.c b/modules/objfmts/dbg/dbg-objfmt.c
index ad5f14a..21a161a 100644
--- a/modules/objfmts/dbg/dbg-objfmt.c
+++ b/modules/objfmts/dbg/dbg-objfmt.c
@@ -165,7 +165,6 @@
     dbg_objfmt_dbgfmt_keywords,
     "null",
     NULL,       /* no directives */
-    NULL,       /* no standard macros */
     dbg_objfmt_create,
     dbg_objfmt_output,
     dbg_objfmt_destroy,
diff --git a/modules/objfmts/elf/CMakeLists.txt b/modules/objfmts/elf/CMakeLists.txt
deleted file mode 100644
index c06b81d..0000000
--- a/modules/objfmts/elf/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-YASM_ADD_MODULE(objfmt_elf
-    objfmts/elf/elf.c
-    objfmts/elf/elf-objfmt.c
-    objfmts/elf/elf-x86-x86.c
-    objfmts/elf/elf-x86-amd64.c
-    )
-list(APPEND YASM_MODULES objfmt_elf32)
-list(APPEND YASM_MODULES objfmt_elf64)
diff --git a/modules/objfmts/elf/elf-objfmt.c b/modules/objfmts/elf/elf-objfmt.c
index 02051de..f48a4aa 100644
--- a/modules/objfmts/elf/elf-objfmt.c
+++ b/modules/objfmts/elf/elf-objfmt.c
@@ -1323,24 +1323,6 @@
     { NULL, NULL, NULL, 0 }
 };
 
-static const char *elf_nasm_stdmac[] = {
-    "%imacro type 1+.nolist",
-    "[type %1]",
-    "%endmacro",
-    "%imacro size 1+.nolist",
-    "[size %1]",
-    "%endmacro",
-    "%imacro weak 1+.nolist",
-    "[weak %1]",
-    "%endmacro",
-    NULL
-};
-
-static const yasm_stdmac elf_objfmt_stdmacs[] = {
-    { "nasm", "nasm", elf_nasm_stdmac },
-    { NULL, NULL, NULL }
-};
-
 /* Define objfmt structure -- see objfmt.h for details */
 yasm_objfmt_module yasm_elf_LTX_objfmt = {
     "ELF",
@@ -1350,7 +1332,6 @@
     elf_objfmt_dbgfmt_keywords,
     "null",
     elf_objfmt_directives,
-    elf_objfmt_stdmacs,
     elf_objfmt_create,
     elf_objfmt_output,
     elf_objfmt_destroy,
@@ -1367,7 +1348,6 @@
     elf_objfmt_dbgfmt_keywords,
     "null",
     elf_objfmt_directives,
-    elf_objfmt_stdmacs,
     elf32_objfmt_create,
     elf_objfmt_output,
     elf_objfmt_destroy,
@@ -1384,7 +1364,6 @@
     elf_objfmt_dbgfmt_keywords,
     "null",
     elf_objfmt_directives,
-    elf_objfmt_stdmacs,
     elf64_objfmt_create,
     elf_objfmt_output,
     elf_objfmt_destroy,
diff --git a/modules/objfmts/macho/CMakeLists.txt b/modules/objfmts/macho/CMakeLists.txt
deleted file mode 100644
index cb5f493..0000000
--- a/modules/objfmts/macho/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-YASM_ADD_MODULE(objfmt_macho
-    objfmts/macho/macho-objfmt.c
-    )
-list(APPEND YASM_MODULES objfmt_macho32)
-list(APPEND YASM_MODULES objfmt_macho64)
diff --git a/modules/objfmts/macho/macho-objfmt.c b/modules/objfmts/macho/macho-objfmt.c
index 10d5893..70e09ec 100644
--- a/modules/objfmts/macho/macho-objfmt.c
+++ b/modules/objfmts/macho/macho-objfmt.c
@@ -1547,7 +1547,6 @@
     macho_objfmt_dbgfmt_keywords,
     "null",
     NULL,   /* no directives */
-    NULL,   /* no standard macros */
     macho_objfmt_create,
     macho_objfmt_output,
     macho_objfmt_destroy,
@@ -1564,7 +1563,6 @@
     macho_objfmt_dbgfmt_keywords,
     "null",
     NULL,   /* no directives */
-    NULL,   /* no standard macros */
     macho32_objfmt_create,
     macho_objfmt_output,
     macho_objfmt_destroy,
@@ -1581,7 +1579,6 @@
     macho_objfmt_dbgfmt_keywords,
     "null",
     NULL,   /* no directives */
-    NULL,   /* no standard macros */
     macho64_objfmt_create,
     macho_objfmt_output,
     macho_objfmt_destroy,
diff --git a/modules/objfmts/rdf/CMakeLists.txt b/modules/objfmts/rdf/CMakeLists.txt
deleted file mode 100644
index 6cf9157..0000000
--- a/modules/objfmts/rdf/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(objfmt_rdf
-    objfmts/rdf/rdf-objfmt.c
-    )
diff --git a/modules/objfmts/rdf/rdf-objfmt.c b/modules/objfmts/rdf/rdf-objfmt.c
index 962f02f..41e95ca 100644
--- a/modules/objfmts/rdf/rdf-objfmt.c
+++ b/modules/objfmts/rdf/rdf-objfmt.c
@@ -1058,21 +1058,6 @@
     { NULL, NULL, NULL, 0 }
 };
 
-static const char *rdf_nasm_stdmac[] = {
-    "%imacro library 1+.nolist",
-    "[library %1]",
-    "%endmacro",
-    "%imacro module 1+.nolist",
-    "[module %1]",
-    "%endmacro",
-    NULL
-};
-
-static const yasm_stdmac rdf_objfmt_stdmacs[] = {
-    { "nasm", "nasm", rdf_nasm_stdmac },
-    { NULL, NULL, NULL }
-};
-
 /* Define objfmt structure -- see objfmt.h for details */
 yasm_objfmt_module yasm_rdf_LTX_objfmt = {
     "Relocatable Dynamic Object File Format (RDOFF) v2.0",
@@ -1082,7 +1067,6 @@
     rdf_objfmt_dbgfmt_keywords,
     "null",
     rdf_objfmt_directives,
-    rdf_objfmt_stdmacs,
     rdf_objfmt_create,
     rdf_objfmt_output,
     rdf_objfmt_destroy,
diff --git a/modules/objfmts/win64/tests/Makefile.inc b/modules/objfmts/win64/tests/Makefile.inc
index ed10476..5c68e01 100644
--- a/modules/objfmts/win64/tests/Makefile.inc
+++ b/modules/objfmts/win64/tests/Makefile.inc
@@ -29,7 +29,3 @@
 EXTRA_DIST += modules/objfmts/win64/tests/win64-dataref2.asm
 EXTRA_DIST += modules/objfmts/win64/tests/win64-dataref2.hex
 EXTRA_DIST += modules/objfmts/win64/tests/win64-dataref2.masm
-
-EXTRA_DIST += modules/objfmts/win64/tests/gas/Makefile.inc
-
-include modules/objfmts/win64/tests/gas/Makefile.inc
diff --git a/modules/objfmts/win64/tests/gas/Makefile.inc b/modules/objfmts/win64/tests/gas/Makefile.inc
deleted file mode 100644
index 0d16bd1..0000000
--- a/modules/objfmts/win64/tests/gas/Makefile.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id$
-
-TESTS += modules/objfmts/win64/tests/gas/win64_gas_test.sh
-
-EXTRA_DIST += modules/objfmts/win64/tests/gas/win64_gas_test.sh
-EXTRA_DIST += modules/objfmts/win64/tests/gas/win64-gas-sce.asm
-EXTRA_DIST += modules/objfmts/win64/tests/gas/win64-gas-sce.hex
diff --git a/modules/objfmts/win64/tests/gas/win64-gas-sce.asm b/modules/objfmts/win64/tests/gas/win64-gas-sce.asm
deleted file mode 100644
index 3a75ee4..0000000
--- a/modules/objfmts/win64/tests/gas/win64-gas-sce.asm
+++ /dev/null
@@ -1,11 +0,0 @@
-PROC_FRAME sample
-rex_push_reg %rbp
-rex_push_eflags
-alloc_stack 16
-save_reg %rsi, 0x18
-save_xmm128 %xmm7, 0x20
-push_frame 16
-set_frame %rdi
-set_frame %rdi, 16
-END_PROLOGUE
-ENDPROC_FRAME
diff --git a/modules/objfmts/win64/tests/gas/win64-gas-sce.hex b/modules/objfmts/win64/tests/gas/win64-gas-sce.hex
deleted file mode 100644
index 4721c51..0000000
--- a/modules/objfmts/win64/tests/gas/win64-gas-sce.hex
+++ /dev/null
@@ -1,399 +0,0 @@
-64 
-86 
-03 
-00 
-00 
-00 
-00 
-00 
-e9 
-00 
-00 
-00 
-09 
-00 
-00 
-00 
-00 
-00 
-04 
-00 
-2e 
-74 
-65 
-78 
-74 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-1b 
-00 
-00 
-00 
-8c 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-20 
-00 
-50 
-60 
-2e 
-78 
-64 
-61 
-74 
-61 
-00 
-00 
-1b 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-18 
-00 
-00 
-00 
-a7 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-40 
-00 
-40 
-40 
-2e 
-70 
-64 
-61 
-74 
-61 
-00 
-00 
-33 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-0c 
-00 
-00 
-00 
-bf 
-00 
-00 
-00 
-cb 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-03 
-00 
-00 
-00 
-40 
-00 
-30 
-40 
-48 
-55 
-48 
-9c 
-48 
-83 
-ec 
-10 
-48 
-89 
-74 
-24 
-18 
-66 
-0f 
-7f 
-7c 
-24 
-20 
-48 
-89 
-e7 
-48 
-8d 
-7c 
-24 
-10 
-01 
-1b 
-0a 
-17 
-1b 
-73 
-16 
-73 
-13 
-1a 
-13 
-78 
-02 
-00 
-0d 
-64 
-03 
-00 
-08 
-12 
-04 
-02 
-02 
-50 
-00 
-00 
-00 
-00 
-1b 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-04 
-00 
-00 
-00 
-03 
-00 
-04 
-00 
-00 
-00 
-04 
-00 
-00 
-00 
-03 
-00 
-08 
-00 
-00 
-00 
-05 
-00 
-00 
-00 
-03 
-00 
-2e 
-66 
-69 
-6c 
-65 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-fe 
-ff 
-00 
-00 
-67 
-01 
-2d 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-2e 
-74 
-65 
-78 
-74 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-01 
-00 
-00 
-00 
-03 
-01 
-1b 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-73 
-61 
-6d 
-70 
-6c 
-65 
-00 
-00 
-00 
-00 
-00 
-00 
-01 
-00 
-00 
-00 
-03 
-00 
-2e 
-78 
-64 
-61 
-74 
-61 
-00 
-00 
-00 
-00 
-00 
-00 
-02 
-00 
-00 
-00 
-03 
-01 
-18 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-2e 
-70 
-64 
-61 
-74 
-61 
-00 
-00 
-00 
-00 
-00 
-00 
-03 
-00 
-00 
-00 
-03 
-01 
-0c 
-00 
-00 
-00 
-03 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-00 
-04 
-00 
-00 
-00 
diff --git a/modules/objfmts/win64/tests/gas/win64_gas_test.sh b/modules/objfmts/win64/tests/gas/win64_gas_test.sh
deleted file mode 100755
index 5575383..0000000
--- a/modules/objfmts/win64/tests/gas/win64_gas_test.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#! /bin/sh
-# $Id$
-${srcdir}/out_test.sh win64_gas_test modules/objfmts/win64/tests/gas "win64 objfmt" "-f win64 -p gas -r nasm" ".obj"
-exit $?
diff --git a/modules/objfmts/xdf/CMakeLists.txt b/modules/objfmts/xdf/CMakeLists.txt
deleted file mode 100644
index 681ec2b..0000000
--- a/modules/objfmts/xdf/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(objfmt_xdf
-    objfmts/xdf/xdf-objfmt.c
-    )
diff --git a/modules/objfmts/xdf/xdf-objfmt.c b/modules/objfmts/xdf/xdf-objfmt.c
index bae4352..693c31c 100644
--- a/modules/objfmts/xdf/xdf-objfmt.c
+++ b/modules/objfmts/xdf/xdf-objfmt.c
@@ -841,7 +841,6 @@
     xdf_objfmt_dbgfmt_keywords,
     "null",
     NULL,       /* no directives */
-    NULL,       /* no standard macros */
     xdf_objfmt_create,
     xdf_objfmt_output,
     xdf_objfmt_destroy,
diff --git a/modules/parsers/CMakeLists.txt b/modules/parsers/CMakeLists.txt
deleted file mode 100644
index db1e371..0000000
--- a/modules/parsers/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-INCLUDE(parsers/gas/CMakeLists.txt)
-INCLUDE(parsers/nasm/CMakeLists.txt)
diff --git a/modules/parsers/gas/CMakeLists.txt b/modules/parsers/gas/CMakeLists.txt
deleted file mode 100644
index de23426..0000000
--- a/modules/parsers/gas/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-YASM_RE2C(
-    ${CMAKE_CURRENT_SOURCE_DIR}/parsers/gas/gas-token.re
-    ${CMAKE_CURRENT_BINARY_DIR}/gas-token.c
-    -b
-    )
-
-YASM_ADD_MODULE(parser_gas
-    parsers/gas/gas-parser.c
-    parsers/gas/gas-parse.c
-    gas-token.c
-    )
diff --git a/modules/parsers/gas/gas-parse.c b/modules/parsers/gas/gas-parse.c
index de46aff..583e39e 100644
--- a/modules/parsers/gas/gas-parse.c
+++ b/modules/parsers/gas/gas-parse.c
@@ -44,8 +44,7 @@
     enum gas_parser_state newstate;
 } dir_lookup;
 
-static void cpp_line_marker(yasm_parser_gas *parser_gas);
-static void nasm_line_marker(yasm_parser_gas *parser_gas);
+static yasm_bytecode * cpp_line_marker(yasm_parser_gas *parser_gas);
 static yasm_bytecode *parse_instr(yasm_parser_gas *parser_gas);
 static int parse_dirvals(yasm_parser_gas *parser_gas, yasm_valparamhead *vps);
 static int parse_datavals(yasm_parser_gas *parser_gas, yasm_datavalhead *dvs);
@@ -249,14 +248,9 @@
             define_label(parser_gas, LABEL_val, 0);
             get_next_token(); /* LABEL */
             return parse_line(parser_gas);
-        case CPP_LINE_MARKER:
+        case LINE_MARKER:
             get_next_token();
-            cpp_line_marker(parser_gas);
-            return NULL;
-        case NASM_LINE_MARKER:
-            get_next_token();
-            nasm_line_marker(parser_gas);
-            return NULL;
+            return cpp_line_marker(parser_gas);
         default:
             yasm_error_set(YASM_ERROR_SYNTAX,
                 N_("label or instruction expected at start of line"));
@@ -274,10 +268,10 @@
     without adding a filter to the input before passing it to cpp.
 
     This function is only called if the preprocessor was 'cpp', since the
-    CPP_LINE_MARKER token isn't generated for any other preprocessor. With any
-    other preprocessor, anything after a '#' is always treated as a comment.
+    LINE_MARKER token isn't generated for any other preprocessor. With any other
+    preprocessor, anything after a '#' is always treated as a comment.
 */
-static void
+static yasm_bytecode *
 cpp_line_marker(yasm_parser_gas *parser_gas)
 {
     yasm_valparamhead vps;
@@ -291,14 +285,14 @@
         while (curtok != '\n')
             get_next_token();
 
-        return;
+        return NULL;
     }
 
     if (yasm_intnum_sign(INTNUM_val) < 0) {
         get_next_token(); /* INTNUM */
         yasm_error_set(YASM_ERROR_SYNTAX,
                        N_("line number is negative"));
-        return;
+        return NULL;
     }
 
     line = yasm_intnum_get_uint(INTNUM_val);
@@ -321,7 +315,7 @@
         while (curtok != '\n')
             get_next_token();
 
-        return;
+        return NULL;
     }
 
     filename = STRING_val.contents;
@@ -345,8 +339,7 @@
         yasm_object_directive(p_object, ".file", "gas", &vps, NULL, cur_line);
 
         yasm_vps_delete(&vps);
-    } else
-        yasm_xfree(filename);
+    }
 
     /* Skip flags. */
     while (1) {
@@ -355,110 +348,18 @@
                 break;
 
             case '\n':
-                return;
+                return NULL;
 
             default:
                 yasm_error_set(YASM_ERROR_SYNTAX,
                     N_("junk at end of cpp line marker"));
-                return;
+                return NULL;
         }
         get_next_token();
     }
-}
 
-/*
-    Handle line markers generated by the nasm preproc.
-
-    We expect a positive integer (line) followed by a plus sign, followed by
-    another positive integer, followed by a string (filename).
-
-    This function is only called if the preprocessor was 'nasm', since the
-    NASM_LINE_MARKER token isn't generated for any other preprocessor.
-*/
-static void
-nasm_line_marker(yasm_parser_gas *parser_gas)
-{
-    yasm_valparamhead vps;
-    yasm_valparam *vp;
-    unsigned long line, incr;
-    char *filename;
-
-    /* Line number. */
-    if (!expect(INTNUM)) return;
-
-    if (yasm_intnum_sign(INTNUM_val) < 0) {
-        get_next_token(); /* INTNUM */
-        yasm_error_set(YASM_ERROR_SYNTAX,
-                       N_("line number is negative"));
-        return;
-    }
-
-    line = yasm_intnum_get_uint(INTNUM_val);
-
-    /*
-        Set to (line - 1) since the directive indicates that the *next* line
-        will have the number given.
-
-        cpp should never produce line=0, but the if keeps us safe just incase.
-    */
-    if (line != 0)
-        line--;
-
-    yasm_intnum_destroy(INTNUM_val);
-    get_next_token(); /* INTNUM */
-
-    if (!expect('+')) return;
-    get_next_token(); /* + */
-
-    /* Line number increment. */
-    if (!expect(INTNUM)) return;
-
-    if (yasm_intnum_sign(INTNUM_val) < 0) {
-        get_next_token(); /* INTNUM */
-        yasm_error_set(YASM_ERROR_SYNTAX,
-                       N_("line increment is negative"));
-        return;
-    }
-
-    incr = yasm_intnum_get_uint(INTNUM_val);
-    yasm_intnum_destroy(INTNUM_val);
-
-    /* File name is not in quotes, so need to switch to a different tokenizer
-     * state.
-     */
-    parser_gas->state = NASM_FILENAME;
-    get_next_token(); /* INTNUM */
-    if (!expect(STRING)) {
-        parser_gas->state = INITIAL;
-        return;
-    }
-
-    filename = STRING_val.contents;
-
-    /* Set linemap. */
-    yasm_linemap_set(parser_gas->linemap, filename, line, incr);
-
-    /*
-        The first line marker in the file (which should be on the first line
-        of the file) will give us the name of the source file. This information
-        needs to be passed on to the debug format module.
-    */
-    if (parser_gas->seen_line_marker == 0) {
-        parser_gas->seen_line_marker = 1;
-
-        yasm_vps_initialize(&vps);
-        vp = yasm_vp_create_string(NULL, filename);
-        yasm_vps_append(&vps, vp);
-
-        yasm_object_directive(p_object, ".file", "gas", &vps, NULL, cur_line);
-
-        yasm_vps_delete(&vps);
-    } else
-        yasm_xfree(filename);
-
-    /* We need to poke back on the \n that was consumed by the tokenizer */
-    parser_gas->peek_token = '\n';
-    get_next_token();
+    /* Never reached. */
+    return NULL;
 }
 
 /* Line directive */
@@ -1027,11 +928,6 @@
                 vp = yasm_vp_create_string(NULL, STRING_val.contents);
                 get_next_token(); /* STRING */
                 break;
-            case REG:
-                e = p_expr_new_ident(yasm_expr_reg(REG_val));
-                vp = yasm_vp_create_expr(NULL, e);
-                get_next_token(); /* REG */
-                break;
             case '@':
                 /* XXX: is throwing it away *really* the right thing? */
                 get_next_token(); /* @ */
diff --git a/modules/parsers/gas/gas-parser.c b/modules/parsers/gas/gas-parser.c
index de3397c..80bd503 100644
--- a/modules/parsers/gas/gas-parser.c
+++ b/modules/parsers/gas/gas-parser.c
@@ -76,11 +76,6 @@
     for (i=0; i<10; i++)
         parser_gas.local[i] = 0;
 
-    parser_gas.is_cpp_preproc =
-        yasm__strcasecmp(((yasm_preproc_base*)pp)->module->keyword, "cpp") == 0;
-    parser_gas.is_nasm_preproc =
-        yasm__strcasecmp(((yasm_preproc_base*)pp)->module->keyword, "nasm") == 0;
-
     /* yacc debugging, needs YYDEBUG set in bison.y.in to work */
     parser_gas.debug = 1;
 
@@ -119,7 +114,6 @@
 static const char *gas_parser_preproc_keywords[] = {
     "raw",
     "cpp",
-    "nasm",
     NULL
 };
 
@@ -129,7 +123,6 @@
     "gas",
     gas_parser_preproc_keywords,
     "raw",
-    NULL,   /* No standard macros */
     gas_parser_do_parse
 };
 yasm_parser_module yasm_gnu_LTX_parser = {
@@ -137,6 +130,5 @@
     "gnu",
     gas_parser_preproc_keywords,
     "raw",
-    NULL,   /* No standard macros */
     gas_parser_do_parse
 };
diff --git a/modules/parsers/gas/gas-parser.h b/modules/parsers/gas/gas-parser.h
index 70704b5..0a22e3e 100644
--- a/modules/parsers/gas/gas-parser.h
+++ b/modules/parsers/gas/gas-parser.h
@@ -48,8 +48,7 @@
     RIGHT_OP,
     ID,
     LABEL,
-    CPP_LINE_MARKER,
-    NASM_LINE_MARKER,
+    LINE_MARKER,
     NONE
 };
 
@@ -91,8 +90,7 @@
     INITIAL,
     COMMENT,
     SECTION_DIRECTIVE,
-    INSTDIR,
-    NASM_FILENAME
+    INSTDIR
 };
 
 typedef struct yasm_parser_gas {
@@ -149,9 +147,6 @@
 
     /* Parser-handled directives HAMT lookup */
     HAMT *dirs;
-
-    int is_nasm_preproc;
-    int is_cpp_preproc;
 } yasm_parser_gas;
 
 /* shorter access names to commonly used parser_gas fields */
diff --git a/modules/parsers/gas/gas-token.re b/modules/parsers/gas/gas-token.re
index c08da11..c72ce90 100644
--- a/modules/parsers/gas/gas-token.re
+++ b/modules/parsers/gas/gas-token.re
@@ -302,8 +302,6 @@
             goto comment;
         case SECTION_DIRECTIVE:
             goto section_directive;
-        case NASM_FILENAME:
-            goto nasm_filename;
         default:
             break;
     }
@@ -389,11 +387,6 @@
         [%][a-zA-Z0-9]+ {
             savech = s->tok[TOKLEN];
             s->tok[TOKLEN] = '\0';
-            if (parser_gas->is_nasm_preproc && strcmp(TOK+1, "line") == 0) {
-                s->tok[TOKLEN] = savech;
-                RETURN(NASM_LINE_MARKER);
-            }
-
             switch (yasm_arch_parse_check_regtmod
                     (p_object->arch, TOK+1, TOKLEN-1, &lvalp->arch_data)) {
                 case YASM_ARCH_REG:
@@ -489,9 +482,10 @@
 
         "/*"                    { parser_gas->state = COMMENT; goto comment; }
         "#"                     {
-            if (parser_gas->is_cpp_preproc)
+            if (strcmp(((yasm_preproc_base*)parser_gas->preproc)->module->keyword,
+                 "cpp") == 0)
             {
-                RETURN(CPP_LINE_MARKER);
+                RETURN(LINE_MARKER);
             } else
                 goto line_comment;
         }
@@ -575,39 +569,6 @@
         }
     */
 
-    /* filename portion of nasm preproc %line */
-nasm_filename:
-    strbuf = yasm_xmalloc(STRBUF_ALLOC_SIZE);
-    strbuf_size = STRBUF_ALLOC_SIZE;
-    count = 0;
-
-nasm_filename_scan:
-    SCANINIT();
-
-    /*!re2c
-        "\n" {
-            strbuf_append(count++, cursor, s, '\0');
-            lvalp->str.contents = (char *)strbuf;
-            lvalp->str.len = count;
-            parser_gas->state = INITIAL;
-            RETURN(STRING);
-        }
-
-        ws+ { goto nasm_filename_scan; }
-
-        any {
-            if (cursor == s->eof) {
-                strbuf_append(count++, cursor, s, '\0');
-                lvalp->str.contents = (char *)strbuf;
-                lvalp->str.len = count;
-                parser_gas->state = INITIAL;
-                RETURN(STRING);
-            }
-            strbuf_append(count++, cursor, s, s->tok[0]);
-            goto nasm_filename_scan;
-        }
-    */
-
     /* character constant values */
 charconst:
     /*TODO*/
diff --git a/modules/parsers/nasm/CMakeLists.txt b/modules/parsers/nasm/CMakeLists.txt
deleted file mode 100644
index 7a060d2..0000000
--- a/modules/parsers/nasm/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-YASM_GENMACRO(
-    ${CMAKE_CURRENT_SOURCE_DIR}/parsers/nasm/nasm-std.mac
-    ${CMAKE_CURRENT_BINARY_DIR}/nasm-macros.c
-    nasm_standard_mac
-    )
-
-SET_SOURCE_FILES_PROPERTIES(parsers/nasm/nasm-parser.c PROPERTIES
-    OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/nasm-macros.c
-    )
-
-YASM_RE2C(
-    ${CMAKE_CURRENT_SOURCE_DIR}/parsers/nasm/nasm-token.re
-    ${CMAKE_CURRENT_BINARY_DIR}/nasm-token.c
-    -b
-    )
-
-YASM_ADD_MODULE(parser_nasm
-    parsers/nasm/nasm-parser.c
-    parsers/nasm/nasm-parse.c
-    nasm-token.c
-    )
diff --git a/modules/parsers/nasm/Makefile.inc b/modules/parsers/nasm/Makefile.inc
index ac174ca..9994e31 100644
--- a/modules/parsers/nasm/Makefile.inc
+++ b/modules/parsers/nasm/Makefile.inc
@@ -14,17 +14,7 @@
 
 CLEANFILES += nasm-token.c
 
-EXTRA_DIST += modules/parsers/nasm/nasm-token.re
-
-$(top_srcdir)/modules/parsers/nasm/nasm-parser.c: nasm-macros.c
-
-nasm-macros.c: $(srcdir)/modules/parsers/nasm/nasm-std.mac genmacro$(EXEEXT)
-	$(top_builddir)/genmacro$(EXEEXT) $@ nasm_standard_mac $(srcdir)/modules/parsers/nasm/nasm-std.mac
-
-BUILT_SOURCES += nasm-macros.c
-CLEANFILES += nasm-macros.c
-EXTRA_DIST += modules/parsers/nasm/nasm-std.mac
-
 EXTRA_DIST += modules/parsers/nasm/tests/Makefile.inc
+EXTRA_DIST += modules/parsers/nasm/nasm-token.re
 
 include modules/parsers/nasm/tests/Makefile.inc
diff --git a/modules/parsers/nasm/nasm-parser.c b/modules/parsers/nasm/nasm-parser.c
index ac10de3..dc46a71 100644
--- a/modules/parsers/nasm/nasm-parser.c
+++ b/modules/parsers/nasm/nasm-parser.c
@@ -77,8 +77,6 @@
     yasm_symtab_parser_finalize(object->symtab, 0, errwarns);
 }
 
-#include "nasm-macros.c"
-
 /* Define valid preprocessors to use with this parser */
 static const char *nasm_parser_preproc_keywords[] = {
     "raw",
@@ -86,17 +84,11 @@
     NULL
 };
 
-static const yasm_stdmac nasm_parser_stdmacs[] = {
-    { "nasm", "nasm", nasm_standard_mac },
-    { NULL, NULL, NULL }
-};
-
 /* Define parser structure -- see parser.h for details */
 yasm_parser_module yasm_nasm_LTX_parser = {
     "NASM-compatible parser",
     "nasm",
     nasm_parser_preproc_keywords,
     "nasm",
-    nasm_parser_stdmacs,
     nasm_parser_do_parse
 };
diff --git a/modules/parsers/nasm/nasm-std.mac b/modules/parsers/nasm/nasm-std.mac
deleted file mode 100644
index 3c9223a..0000000
--- a/modules/parsers/nasm/nasm-std.mac
+++ /dev/null
@@ -1,109 +0,0 @@
-; Standard macro set for NASM -*- nasm -*-
-
-; Note that although some user-level forms of directives are defined
-; here, not all of them are: the user-level form of a format-specific
-; directive should be defined in the module for that directive.
-
-; These two need to be defined, though the actual definitions will
-; be constantly updated during preprocessing.
-%define __FILE__
-%define __LINE__
-
-%define __SECT__ [section .text] ; it ought to be defined, even if as nothing
-
-%imacro section 1+.nolist
-%define __SECT__ [section %1]
-	  __SECT__
-%endmacro
-%imacro segment 1+.nolist
-%define __SECT__ [segment %1]
-	  __SECT__
-%endmacro
-
-%imacro absolute 1+.nolist
-%define __SECT__ [absolute %1]
-	  __SECT__
-%endmacro
-
-%imacro struc 1.nolist
-%push struc
-%define %$strucname %1
-[absolute 0]
-%$strucname:			; allow definition of `.member' to work sanely
-%endmacro 
-%imacro endstruc 0.nolist
-%{$strucname}_size:
-%pop
-__SECT__
-%endmacro
-
-%imacro istruc 1.nolist
-%push istruc
-%define %$strucname %1
-%$strucstart:
-%endmacro
-%imacro at 1-2+.nolist
-	  times %1-($-%$strucstart) db 0
-	  %2
-%endmacro
-%imacro iend 0.nolist
-	  times %{$strucname}_size-($-%$strucstart) db 0
-%pop
-%endmacro
-
-%imacro align 1-2+.nolist nop
-%ifidni %2,nop
-	  [align %1]
-%else
-	  times ($$-$) & ((%1)-1) %2
-%endif
-%endmacro
-%imacro alignb 1-2+.nolist resb 1
-	  times ($$-$) & ((%1)-1) %2
-%endmacro
-
-%imacro extern 1-*.nolist
-%rep %0
-[extern %1]
-%rotate 1
-%endrep
-%endmacro
-
-%imacro bits 1+.nolist
-[bits %1]
-%endmacro
-
-%imacro use16 0.nolist
-[bits 16]
-%endmacro
-%imacro use32 0.nolist
-[bits 32]
-%endmacro
-%imacro use64 0.nolist
-[bits 64]
-%endmacro
-
-%imacro global 1-*.nolist
-%rep %0
-[global %1]
-%rotate 1
-%endrep
-%endmacro
-
-%imacro common 1-*.nolist
-%rep %0
-[common %1]
-%rotate 1
-%endrep
-%endmacro
-
-%imacro cpu 1+.nolist
-[cpu %1]
-%endmacro
-
-%imacro default 1+.nolist
-[default %1]
-%endmacro
-
-; NASM compatibility shim
-%define __OUTPUT_FORMAT__ __YASM_OBJFMT__
diff --git a/modules/preprocs/CMakeLists.txt b/modules/preprocs/CMakeLists.txt
deleted file mode 100644
index dccecbe..0000000
--- a/modules/preprocs/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-INCLUDE(preprocs/nasm/CMakeLists.txt)
-INCLUDE(preprocs/raw/CMakeLists.txt)
-INCLUDE(preprocs/cpp/CMakeLists.txt)
diff --git a/modules/preprocs/cpp/CMakeLists.txt b/modules/preprocs/cpp/CMakeLists.txt
deleted file mode 100644
index 202787c..0000000
--- a/modules/preprocs/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(preproc_cpp
-    preprocs/cpp/cpp-preproc.c
-    )
diff --git a/modules/preprocs/cpp/cpp-preproc.c b/modules/preprocs/cpp/cpp-preproc.c
index c58e404..dae2e03 100644
--- a/modules/preprocs/cpp/cpp-preproc.c
+++ b/modules/preprocs/cpp/cpp-preproc.c
@@ -377,12 +377,6 @@
     cpp_preproc_predefine_macro(preproc, macronameval);
 }
 
-static void
-cpp_preproc_add_standard(yasm_preproc *preproc, const char **macros)
-{
-    /* TODO */
-}
-
 /*******************************************************************************
     Preprocessor module object.
 *******************************************************************************/
@@ -397,6 +391,5 @@
     cpp_preproc_add_include_file,
     cpp_preproc_predefine_macro,
     cpp_preproc_undefine_macro,
-    cpp_preproc_define_builtin,
-    cpp_preproc_add_standard
+    cpp_preproc_define_builtin
 };
diff --git a/modules/preprocs/nasm/CMakeLists.txt b/modules/preprocs/nasm/CMakeLists.txt
deleted file mode 100644
index e10a9dd..0000000
--- a/modules/preprocs/nasm/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-add_executable(genversion preprocs/nasm/genversion.c)
-get_target_property(_tmp_GENVERSION_EXE genversion LOCATION)
-add_custom_command(
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.mac
-    COMMAND ${_tmp_GENVERSION_EXE} ${CMAKE_CURRENT_BINARY_DIR}/version.mac
-    DEPENDS ${_tmp_GENVERSION_EXE}
-    )
-
-YASM_GENMACRO(
-    ${CMAKE_CURRENT_BINARY_DIR}/version.mac
-    ${CMAKE_CURRENT_BINARY_DIR}/nasm-version.c
-    nasm_version_mac
-    )
-
-SET_SOURCE_FILES_PROPERTIES(preprocs/nasm/nasm-preproc.c PROPERTIES
-    OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/nasm-version.c
-    )
-
-YASM_ADD_MODULE(preproc_nasm
-    preprocs/nasm/nasm-preproc.c
-    preprocs/nasm/nasm-pp.c
-    preprocs/nasm/nasmlib.c
-    preprocs/nasm/nasm-eval.c
-    )
-
diff --git a/modules/preprocs/nasm/Makefile.inc b/modules/preprocs/nasm/Makefile.inc
index f9aa9d5..a91eb91 100644
--- a/modules/preprocs/nasm/Makefile.inc
+++ b/modules/preprocs/nasm/Makefile.inc
@@ -11,13 +11,23 @@
 
 YASM_MODULES += preproc_nasm
 
-$(top_srcdir)/modules/preprocs/nasm/nasm-preproc.c: nasm-version.c
+$(top_srcdir)/src/preprocs/nasm/nasm-pp.c: nasm-macros.c
 
-nasm-version.c: version.mac genmacro$(EXEEXT)
-	$(top_builddir)/genmacro$(EXEEXT) $@ nasm_version_mac version.mac
+nasm-macros.c: $(top_srcdir)/modules/preprocs/nasm/standard.mac version.mac genmacro$(EXEEXT)
+	$(top_builddir)/genmacro$(EXEEXT) $(top_srcdir)/modules/preprocs/nasm/standard.mac version.mac
 
-BUILT_SOURCES += nasm-version.c
-CLEANFILES += nasm-version.c
+BUILT_SOURCES += nasm-macros.c
+CLEANFILES += nasm-macros.c
+
+noinst_PROGRAMS += genmacro
+
+genmacro_SOURCES =
+EXTRA_DIST += modules/preprocs/nasm/genmacro.c
+genmacro_LDADD = genmacro.$(OBJEXT)
+genmacro_LINK = $(CCLD_FOR_BUILD) -o $@
+
+genmacro.$(OBJEXT): modules/preprocs/nasm/genmacro.c
+	$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genmacro.c || echo '$(srcdir)/'`modules/preprocs/nasm/genmacro.c
 
 version.mac: genversion$(EXEEXT)
 	$(top_builddir)/genversion$(EXEEXT) $@
@@ -35,6 +45,7 @@
 genversion.$(OBJEXT): modules/preprocs/nasm/genversion.c
 	$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f modules/preprocs/nasm/genversion.c || echo '$(srcdir)/'`modules/preprocs/nasm/genversion.c
 
+EXTRA_DIST += modules/preprocs/nasm/standard.mac
 EXTRA_DIST += modules/preprocs/nasm/tests/Makefile.inc
 
 include modules/preprocs/nasm/tests/Makefile.inc
diff --git a/tools/genmacro/genmacro.c b/modules/preprocs/nasm/genmacro.c
similarity index 83%
rename from tools/genmacro/genmacro.c
rename to modules/preprocs/nasm/genmacro.c
index d3f4200..e6f4019 100644
--- a/tools/genmacro/genmacro.c
+++ b/modules/preprocs/nasm/genmacro.c
@@ -2,7 +2,7 @@
  *
  * C version of NASM's macros.pl
  *
- *  Copyright (C) 2004-2008  Peter Johnson
+ *  Copyright (C) 2004-2007  Peter Johnson
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#define OUTPUT  "nasm-macros.c"
 #define MAXLINE 1024
 
 int
@@ -42,17 +43,18 @@
     int fline;
     int line = 0;
     int lindex = 0;
+    int tasm_count = -1;
     size_t len;
 
-    if (argc < 4) {
-        fprintf(stderr, "Usage: %s <out> <var> <file> [<file> ...]\n", argv[0]);
+    if (argc < 2) {
+        fprintf(stderr, "Usage: %s <file> [<file> ...]\n", argv[0]);
         return EXIT_FAILURE;
     }
 
-    out = fopen(argv[1], "wt");
+    out = fopen(OUTPUT, "wt");
 
     if (!out) {
-        fprintf(stderr, "Could not open `%s'.\n", argv[1]);
+        fprintf(stderr, "Could not open `%s'.\n", OUTPUT);
         return EXIT_FAILURE;
     }
 
@@ -60,14 +62,14 @@
 
     fprintf(out, "/* This file auto-generated from standard.mac by genmacro.c"
                  " - don't edit it */\n\n#include <stddef.h>\n\n"
-                 "static const char *%s[] = {\n", argv[2]);
+                 "static const char *stdmac[] = {\n");
 
-    for (i=3; i<argc; i++) {
+    for (i=1; i<argc; i++) {
         in = fopen(argv[i], "rt");
         if (!in) {
             fprintf(stderr, "Could not open `%s'.\n", argv[i]);
             fclose(out);
-            remove(argv[1]);
+            remove(OUTPUT);
             return EXIT_FAILURE;
         }
 
@@ -90,7 +92,7 @@
                     fprintf(stderr, "%s:%d: error: unterminated quote\n",
                             argv[i], fline);
                     fclose(out);
-                    remove(argv[1]);
+                    remove(OUTPUT);
                     return EXIT_FAILURE;
                 }
                 charp++;
@@ -110,6 +112,12 @@
             if (len == 0)
                 continue;
 
+            /* check for special TASM ending token */
+            if (strcmp(strp, "*END*TASM*MACROS*") == 0) {
+                tasm_count = lindex;
+                continue;
+            }
+
             /* output as string to output file */
             fprintf(out, "    \"");
             while (*strp != '\0') {
@@ -126,6 +134,9 @@
     }
 
     fprintf(out, "    NULL\n};\n");
+    if (tasm_count == -1)
+        tasm_count = lindex;
+    fprintf(out, "#define TASM_MACRO_COUNT %d\n", tasm_count);
     fclose(out);
 
     free(str);
diff --git a/modules/preprocs/nasm/genversion.c b/modules/preprocs/nasm/genversion.c
index ac97768..5426c3d 100644
--- a/modules/preprocs/nasm/genversion.c
+++ b/modules/preprocs/nasm/genversion.c
@@ -43,11 +43,6 @@
         return EXIT_FAILURE;
     }
 
-    if (sscanf(PACKAGE_INTVER, "%d.%d.%d", &major, &minor, &subminor) != 3) {
-        fprintf(stderr, "Version tokenizing error\n");
-        return EXIT_FAILURE;
-    }
-
     out = fopen(argv[1], "wt");
 
     if (!out) {
@@ -58,6 +53,13 @@
     fprintf(out, "; This file auto-generated by genversion.c"
                  " - don't edit it\n");
 
+    if (sscanf(PACKAGE_INTVER, "%d.%d.%d", &major, &minor, &subminor) != 3) {
+        fprintf(stderr, "Version tokenizing error\n");
+        fclose(out);
+        remove(argv[1]);
+        return EXIT_FAILURE;
+    }
+
     fprintf(out, "%%define __YASM_MAJOR__ %d\n", major);
     fprintf(out, "%%define __YASM_MINOR__ %d\n", minor);
     fprintf(out, "%%define __YASM_SUBMINOR__ %d\n", subminor);
diff --git a/modules/preprocs/nasm/nasm-pp.c b/modules/preprocs/nasm/nasm-pp.c
index 2d5e7d2..604bb2b 100644
--- a/modules/preprocs/nasm/nasm-pp.c
+++ b/modules/preprocs/nasm/nasm-pp.c
@@ -351,9 +351,7 @@
 static unsigned long unique;    /* unique identifier numbers */
 
 static Line *builtindef = NULL;
-static Line *stddef = NULL;
 static Line *predef = NULL;
-static int first_line = 1;
 
 static ListGen *list;
 
@@ -386,19 +384,18 @@
 #define PARAM_DELTA 16
 
 /*
- * Macros to make NASM ignore some TASM directives before the first include
- * directive.
+ * The standard macro set: defined as `static char *stdmac[]'. Also
+ * gives our position in the macro set, when we're processing it.
  */
-static const char *tasm_compat_macros[] =
-{
-    "%idefine IDEAL",
-    "%idefine JUMPS",
-    "%idefine P386",
-    "%idefine P486",
-    "%idefine P586",
-    "%idefine END",
-    NULL
-};
+#include "nasm-macros.c"
+static const char **stdmacpos;
+
+/*
+ * The extra standard macros that come from the object format, if
+ * any.
+ */
+static const char **extrastdmac = NULL;
+int any_extrastdmac;
 
 static int nested_mac_count, nested_rep_count;
 
@@ -644,6 +641,69 @@
     char *buffer, *p, *q;
     int bufsize, continued_count;
 
+    Line *pd, *l;
+    Token *head, **tail, *t;
+
+    /* Nasty hack for builtin defines */
+    for (pd = builtindef; pd; pd = pd->next)
+    {
+        head = NULL;
+        tail = &head;
+        for (t = pd->first; t; t = t->next)
+        {
+            *tail = new_Token(NULL, t->type, t->text, 0);
+            tail = &(*tail)->next;
+        }
+        l = nasm_malloc(sizeof(Line));
+        l->next = istk->expansion;
+        l->first = head;
+        l->finishes = FALSE;
+        istk->expansion = l;
+    }
+
+    if (stdmacpos)
+    {
+        if (*stdmacpos)
+        {
+            char *ret = nasm_strdup(*stdmacpos++);
+            if (!*stdmacpos && any_extrastdmac)
+            {
+                stdmacpos = extrastdmac;
+                any_extrastdmac = FALSE;
+                return ret;
+            }
+            /*
+             * Nasty hack: here we push the contents of `predef' on
+             * to the top-level expansion stack, since this is the
+             * most convenient way to implement the pre-include and
+             * pre-define features.
+             */
+            if (!*stdmacpos)
+            {
+                for (pd = predef; pd; pd = pd->next)
+                {
+                    head = NULL;
+                    tail = &head;
+                    for (t = pd->first; t; t = t->next)
+                    {
+                        *tail = new_Token(NULL, t->type, t->text, 0);
+                        tail = &(*tail)->next;
+                    }
+                    l = nasm_malloc(sizeof(Line));
+                    l->next = istk->expansion;
+                    l->first = head;
+                    l->finishes = FALSE;
+                    istk->expansion = l;
+                }
+            }
+            return ret;
+        }
+        else
+        {
+            stdmacpos = NULL;
+        }
+    }
+
     bufsize = BUF_DELTA;
     buffer = nasm_malloc(BUF_DELTA);
     p = buffer;
@@ -4153,42 +4213,15 @@
         smacros[h] = NULL;
     }
     unique = 0;
-    if (tasm_compatible_mode) {
-        pp_extra_stdmac(tasm_compat_macros);
-    }
+        if (tasm_compatible_mode) {
+            stdmacpos = stdmac;
+        } else {
+                stdmacpos = &stdmac[TASM_MACRO_COUNT];
+        }
+    any_extrastdmac = (extrastdmac != NULL);
     list = listgen;
     evaluate = eval;
     pass = apass;
-    first_line = 1;
-}
-
-/*
- * Nasty hack: here we push the contents of `predef' on
- * to the top-level expansion stack, since this is the
- * most convenient way to implement the pre-include and
- * pre-define features.
- */
-static void
-poke_predef(Line *predef_lines)
-{
-    Line *pd, *l;
-    Token *head, **tail, *t;
-
-    for (pd = predef_lines; pd; pd = pd->next)
-    {
-        head = NULL;
-        tail = &head;
-        for (t = pd->first; t; t = t->next)
-        {
-            *tail = new_Token(NULL, t->type, t->text, 0);
-            tail = &(*tail)->next;
-        }
-        l = nasm_malloc(sizeof(Line));
-        l->next = istk->expansion;
-        l->first = head;
-        l->finishes = FALSE;
-        istk->expansion = l;
-    }
 }
 
 static char *
@@ -4204,18 +4237,6 @@
          * buffer or from the input file.
          */
         tline = NULL;
-
-        if (first_line)
-        {
-            /* Reverse order */
-            poke_predef(predef);
-            poke_predef(stddef);
-            poke_predef(builtindef);
-            first_line = 0;
-        }
-
-        if (!istk)
-            return NULL;
         while (istk->expansion && istk->expansion->finishes)
         {
             Line *l = istk->expansion;
@@ -4478,7 +4499,6 @@
     if (pass_ == 0)
         {
                 free_llist(builtindef);
-                free_llist(stddef);
                 free_llist(predef);
                 delete_Blocks();
         }
@@ -4567,24 +4587,7 @@
 void
 pp_extra_stdmac(const char **macros)
 {
-    const char **lp;
-
-    for (lp=macros; *lp; lp++)
-    {
-        char *macro;
-        Token *t;
-        Line *l;
-
-        macro = nasm_strdup(*lp);
-        t = tokenise(macro);
-        nasm_free(macro);
-
-        l = nasm_malloc(sizeof(Line));
-        l->next = stddef;
-        l->first = t;
-        l->finishes = FALSE;
-        stddef = l;
-    }
+    extrastdmac = macros;
 }
 
 static void
diff --git a/modules/preprocs/nasm/nasm-preproc.c b/modules/preprocs/nasm/nasm-preproc.c
index bb4c7a7..a0d941c 100644
--- a/modules/preprocs/nasm/nasm-preproc.c
+++ b/modules/preprocs/nasm/nasm-preproc.c
@@ -48,8 +48,6 @@
 static yasm_errwarns *cur_errwarns;
 int tasm_compatible_mode = 0;
 
-#include "nasm-version.c"
-
 typedef struct preproc_dep {
     STAILQ_ENTRY(preproc_dep) link;
     char *name;
@@ -158,8 +156,6 @@
     preproc_nasm->lineinc = 0;
     nasmpp.reset(f, in_filename, 2, nasm_efunc, nasm_evaluate, &nil_list);
 
-    pp_extra_stdmac(nasm_version_mac);
-
     return (yasm_preproc *)preproc_nasm;
 }
 
@@ -294,12 +290,6 @@
     yasm_xfree(mnv);
 }
 
-static void
-nasm_preproc_add_standard(yasm_preproc *preproc, const char **macros)
-{
-    pp_extra_stdmac(macros);
-}
-
 /* Define preproc structure -- see preproc.h for details */
 yasm_preproc_module yasm_nasm_LTX_preproc = {
     "Real NASM Preprocessor",
@@ -311,6 +301,5 @@
     nasm_preproc_add_include_file,
     nasm_preproc_predefine_macro,
     nasm_preproc_undefine_macro,
-    nasm_preproc_define_builtin,
-    nasm_preproc_add_standard
+    nasm_preproc_define_builtin
 };
diff --git a/modules/preprocs/nasm/standard.mac b/modules/preprocs/nasm/standard.mac
new file mode 100644
index 0000000..f459a7d
--- /dev/null
+++ b/modules/preprocs/nasm/standard.mac
@@ -0,0 +1,293 @@
+; Standard macro set for NASM -*- nasm -*-
+
+; Macros to make NASM ignore some TASM directives before the first include
+; directive.
+
+    %idefine IDEAL
+    %idefine JUMPS
+    %idefine P386
+    %idefine P486
+    %idefine P586
+    %idefine END
+
+; This is a magic token which indicates the end of the TASM macros
+*END*TASM*MACROS*
+
+; Note that although some user-level forms of directives are defined
+; here, not all of them are: the user-level form of a format-specific
+; directive should be defined in the module for that directive.
+
+; These two need to be defined, though the actual definitions will
+; be constantly updated during preprocessing.
+%define __FILE__
+%define __LINE__
+
+%define __SECT__ [section .text] ; it ought to be defined, even if as nothing
+
+%imacro section 1+.nolist
+%define __SECT__ [section %1]
+	  __SECT__
+%endmacro
+%imacro segment 1+.nolist
+%define __SECT__ [segment %1]
+	  __SECT__
+%endmacro
+
+%imacro absolute 1+.nolist
+%define __SECT__ [absolute %1]
+	  __SECT__
+%endmacro
+
+%imacro struc 1.nolist
+%push struc
+%define %$strucname %1
+[absolute 0]
+%$strucname:			; allow definition of `.member' to work sanely
+%endmacro 
+%imacro endstruc 0.nolist
+%{$strucname}_size:
+%pop
+__SECT__
+%endmacro
+
+%imacro istruc 1.nolist
+%push istruc
+%define %$strucname %1
+%$strucstart:
+%endmacro
+%imacro at 1-2+.nolist
+	  times %1-($-%$strucstart) db 0
+	  %2
+%endmacro
+%imacro iend 0.nolist
+	  times %{$strucname}_size-($-%$strucstart) db 0
+%pop
+%endmacro
+
+%imacro align 1-2+.nolist nop
+%ifidni %2,nop
+	  [align %1]
+%else
+	  times ($$-$) & ((%1)-1) %2
+%endif
+%endmacro
+%imacro alignb 1-2+.nolist resb 1
+	  times ($$-$) & ((%1)-1) %2
+%endmacro
+
+%imacro extern 1-*.nolist
+%rep %0
+[extern %1]
+%rotate 1
+%endrep
+%endmacro
+
+%imacro bits 1+.nolist
+[bits %1]
+%endmacro
+
+%imacro use16 0.nolist
+[bits 16]
+%endmacro
+%imacro use32 0.nolist
+[bits 32]
+%endmacro
+%imacro use64 0.nolist
+[bits 64]
+%endmacro
+
+%imacro global 1-*.nolist
+%rep %0
+[global %1]
+%rotate 1
+%endrep
+%endmacro
+
+%imacro common 1-*.nolist
+%rep %0
+[common %1]
+%rotate 1
+%endrep
+%endmacro
+
+%imacro cpu 1+.nolist
+[cpu %1]
+%endmacro
+
+%imacro default 1+.nolist
+[default %1]
+%endmacro
+
+; NASM compatibility shim
+%define __OUTPUT_FORMAT__ __YASM_OBJFMT__
+
+%ifidn __YASM_OBJFMT__,bin
+%imacro org 1+.nolist
+[org %1]
+%endmacro
+%endif
+
+%ifidn __YASM_OBJFMT__,win32
+%imacro export 1+.nolist
+[export %1]
+%endmacro
+
+%imacro safeseh 1+.nolist
+[safeseh %1]
+%endmacro
+%endif
+
+%ifidn __YASM_OBJFMT__,win64
+%define __YASM_WIN64__
+%endif
+
+%ifidn __YASM_OBJFMT__,x64
+%define __YASM_WIN64__
+%endif
+
+%ifdef __YASM_WIN64__
+%undef __YASM_WIN64__
+
+%imacro export 1+.nolist
+[export %1]
+%endmacro
+
+; Raw exception handling operations
+%imacro proc_frame 1+.nolist
+%1:
+[proc_frame %1]
+%endmacro
+
+%if 0
+; Disable these as they're too closely named to the macroized ones.
+; MASM needs a preceding . to use these, so it seems reasonable for
+; us to similarly require the [].
+%imacro pushreg 1.nolist
+[pushreg %1]
+%endmacro
+
+%imacro setframe 1-2.nolist
+[setframe %1 %2]
+%endmacro
+
+%imacro allocstack 1.nolist
+[allocstack %1]
+%endmacro
+
+%imacro savereg 2.nolist
+[savereg %1 %2]
+%endmacro
+
+%imacro savexmm128 2.nolist
+[savexmm128 %1 %2]
+%endmacro
+
+%imacro pushframe 0-1.nolist
+[pushframe %1]
+%endmacro
+
+%imacro endprolog 0.nolist
+[endprolog]
+%endmacro
+%endif
+
+%imacro endproc_frame 0.nolist
+[endproc_frame]
+%endmacro
+
+; Complex (macro) exception handling operations
+; Mimics many macros provided by MASM's macamd64.inc
+%imacro push_reg 1
+push %1
+[pushreg %1]
+%endmacro
+
+%imacro rex_push_reg 1
+db 0x48
+push %1
+[pushreg %1]
+%endmacro
+
+%imacro push_eflags 0
+pushfq
+[allocstack 8]
+%endmacro
+
+%imacro rex_push_eflags 0
+db 0x48
+pushfq
+[allocstack 8]
+%endmacro
+
+%imacro alloc_stack 1
+sub rsp, %1
+[allocstack %1]
+%endmacro
+
+%imacro save_reg 2
+mov [rsp+%2], %1
+[savereg %1 %2]
+%endmacro
+
+%imacro save_xmm128 2
+movdqa [rsp+%2], %1
+[savexmm128 %1 %2]
+%endmacro
+
+%imacro push_frame 0-1.nolist
+[pushframe %1]
+%endmacro
+
+%imacro set_frame 1-2
+%if %0==1
+mov %1, rsp
+%else
+lea %1, [rsp+%2]
+%endif
+[setframe %1 %2]
+%endmacro
+
+%imacro end_prolog 0.nolist
+[endprolog]
+%endmacro
+
+%imacro end_prologue 0.nolist
+[endprolog]
+%endmacro
+
+%endif
+
+%ifidn __YASM_OBJFMT__,elf
+%define __YASM_ELF__
+%endif
+
+%ifidn __YASM_OBJFMT__,elf32
+%define __YASM_ELF__
+%endif
+
+%ifidn __YASM_OBJFMT__,elf64
+%define __YASM_ELF__
+%endif
+
+%ifdef __YASM_ELF__
+%undef __YASM_ELF__
+%imacro type 1+.nolist
+[type %1]
+%endmacro
+%imacro size 1+.nolist
+[size %1]
+%endmacro
+%imacro weak 1+.nolist
+[weak %1]
+%endmacro
+%endif
+
+%ifidn __YASM_OBJFMT__,rdf
+%imacro library 1+.nolist
+[library %1]
+%endmacro
+%imacro module 1+.nolist
+[module %1]
+%endmacro
+%endif
+
diff --git a/modules/preprocs/nasm/tests/nasmpp-nested.errwarn b/modules/preprocs/nasm/tests/nasmpp-nested.errwarn
index 31839e3..4df4928 100644
--- a/modules/preprocs/nasm/tests/nasmpp-nested.errwarn
+++ b/modules/preprocs/nasm/tests/nasmpp-nested.errwarn
@@ -1,3 +1,3 @@
--:27: warning: (WORK_1:2) 4
--:28: warning: (WORK_2:2) 4
--:29: warning: (DONT_WORK_1:3) 4 4
+-:27: warning: (WORK_1:4) 4
+-:28: warning: (WORK_2:4) 4
+-:29: warning: (DONT_WORK_1:6) 4 4
diff --git a/modules/preprocs/raw/CMakeLists.txt b/modules/preprocs/raw/CMakeLists.txt
deleted file mode 100644
index fc34538..0000000
--- a/modules/preprocs/raw/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-YASM_ADD_MODULE(preproc_raw
-    preprocs/raw/raw-preproc.c
-    )
diff --git a/modules/preprocs/raw/raw-preproc.c b/modules/preprocs/raw/raw-preproc.c
index 463ceaa..03f0755 100644
--- a/modules/preprocs/raw/raw-preproc.c
+++ b/modules/preprocs/raw/raw-preproc.c
@@ -147,12 +147,6 @@
     /* no builtin defines */
 }
 
-static void
-raw_preproc_add_standard(yasm_preproc *preproc, const char **macros)
-{
-    /* no standard macros */
-}
-
 
 /* Define preproc structure -- see preproc.h for details */
 yasm_preproc_module yasm_raw_LTX_preproc = {
@@ -165,6 +159,5 @@
     raw_preproc_add_include_file,
     raw_preproc_predefine_macro,
     raw_preproc_undefine_macro,
-    raw_preproc_define_builtin,
-    raw_preproc_add_standard
+    raw_preproc_define_builtin
 };
diff --git a/modules/preprocs/yapp/yapp-preproc.c b/modules/preprocs/yapp/yapp-preproc.c
index 0c77404..e1215a7 100644
--- a/modules/preprocs/yapp/yapp-preproc.c
+++ b/modules/preprocs/yapp/yapp-preproc.c
@@ -999,12 +999,6 @@
     /* TODO */
 }
 
-static void
-yapp_preproc_add_standard(yasm_preproc *preproc, const char **macros)
-{
-    /* TODO */
-}
-
 /* Define preproc structure -- see preproc.h for details */
 yasm_preproc_module yasm_yapp_LTX_preproc = {
     "YAPP preprocessing (NASM style)",
@@ -1016,6 +1010,5 @@
     yapp_preproc_add_include_file,
     yapp_preproc_predefine_macro,
     yapp_preproc_undefine_macro,
-    yapp_preproc_define_builtin,
-    yapp_preproc_add_standard
+    yapp_preproc_define_builtin
 };
diff --git a/plugins/README b/plugins/README
deleted file mode 100644
index 63a6a53..0000000
--- a/plugins/README
+++ /dev/null
@@ -1,22 +0,0 @@
-These directories contain example yasm plugins.
-Yasm is only capable of loading plugins when it was built using cmake.
-To build yasm with cmake on Unix, from the yasm source tree, do:
-  mkdir objdir
-  cd objdir
-  cmake ..
-  make
-
-The plugins are written to be compiled against an *installed* yasm.
-Plugins may be loaded on the yasm command line using the -N command line
-option, e.g.:
-  yasm -N ./libdbgmod.so
-  yasm -N Release/dbgmod.dll
-  yasm -N /usr/local/lib/libx86mod
-(the .so will be automatically appended)
-If no directory path is specified, yasm will search in standard library
-locations (e.g. LD_LIBRARY_PATH, the rpath of the yasm executable, etc) to
-try to load the plugin.  Thus the last example (after installing the plugin)
-could likely be written:
-  yasm -N x86mod
-
-Plugins may override builtin modules like x86.
diff --git a/plugins/dbg/CMakeLists.txt b/plugins/dbg/CMakeLists.txt
deleted file mode 100644
index 3d4fe68..0000000
--- a/plugins/dbg/CMakeLists.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-PROJECT(dbgmod)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
-
-SET (YASM_POSSIBLE_PATHS
-    "$ENV{ProgramFiles}/Yasm/Bin"
-    /usr/bin
-    /usr/local/bin
-    )
-
-FIND_PROGRAM(YASM_PATH yasm
-    PATHS ${YASM_POSSIBLE_PATHS}
-    )
-
-SET (YASM_POSSIBLE_INCLUDE_PATHS
-    "${YASM_PATH}"
-    "${YASM_PATH}/../include"
-    "$ENV{ProgramFiles}/Yasm/Include"
-    /usr/include
-    /usr/local/include
-    )
-
-FIND_PATH(YASM_INCLUDE_PATH NAMES libyasm.h
-    DOC "The path to the libyasm include files"
-    PATHS ${YASM_POSSIBLE_INCLUDE_PATHS}
-    )
-
-IF (NOT YASM_INCLUDE_PATH)
-    MESSAGE(FATAL_ERROR "Could not find yasm include files")
-ENDIF (NOT YASM_INCLUDE_PATH)
-
-INCLUDE_DIRECTORIES(${YASM_INCLUDE_PATH})
-
-SET (YASM_POSSIBLE_LIB_PATHS
-    "${YASM_PATH}"
-    "${YASM_PATH}/../lib"
-    "${YASM_INCLUDE_PATH}/../lib"
-    "$ENV{ProgramFiles}/Yasm/Lib"
-    /usr/lib
-    /usr/local/lib
-    )
-
-FIND_LIBRARY(YASM_LIBRARY
-    NAMES yasm
-    DOC "The path to the libyasm library"
-    PATHS ${YASM_POSSIBLE_LIB_PATHS}
-    )
-
-IF (NOT YASM_LIBRARY)
-    MESSAGE(FATAL_ERROR "Could not find yasm library")
-ENDIF (NOT YASM_LIBRARY)
-
-ADD_LIBRARY(dbgmod MODULE
-    init_plugin.c
-    dbg-objfmt.c
-    )
-TARGET_LINK_LIBRARIES(dbgmod ${YASM_LIBRARY})
diff --git a/plugins/dbg/README b/plugins/dbg/README
deleted file mode 100644
index d4fdbc5..0000000
--- a/plugins/dbg/README
+++ /dev/null
@@ -1,21 +0,0 @@
-This directory demonstrates how to build a basic plugin.
-It does not need access to the yasm source, only an installed yasm.
-
-To build:
-  mkdir objdir
-  cd objdir
-  cmake ..
-  make
-
-Testing (on Windows):
-  yasm -N Release/dbgmod.dll -f dbg -
-     db 5
-     ^Z
-
-Testing (on Unix):
-  yasm -N ./libdbgmod.so -f dbg -
-     db 5
-     ^D
-
-Result lines will have PLUGIN prefixed to the function calls; this
-demonstrates the plugin is being used rather than the builtin dbg module.
diff --git a/plugins/dbg/dbg-objfmt.c b/plugins/dbg/dbg-objfmt.c
deleted file mode 100644
index 1aef7c2..0000000
--- a/plugins/dbg/dbg-objfmt.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Debugging object format (used to debug object format module interface)
- *
- *  Copyright (C) 2001-2007  Peter Johnson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#include <stdio.h>
-#include <libyasm.h>
-
-#define N_(String) (String)
-
-typedef struct yasm_objfmt_dbg {
-    yasm_objfmt_base objfmt;        /* base structure */
-
-    FILE *dbgfile;
-} yasm_objfmt_dbg;
-
-yasm_objfmt_module yasm_dbg_LTX_objfmt;
-
-
-static yasm_objfmt *
-dbg_objfmt_create(yasm_object *object)
-{
-    yasm_objfmt_dbg *objfmt_dbg = yasm_xmalloc(sizeof(yasm_objfmt_dbg));
-
-    objfmt_dbg->objfmt.module = &yasm_dbg_LTX_objfmt;
-
-    objfmt_dbg->dbgfile = tmpfile();
-    if (!objfmt_dbg->dbgfile) {
-        fprintf(stderr, N_("could not open temporary file"));
-        return 0;
-    }
-    fprintf(objfmt_dbg->dbgfile, "PLUGIN create()\n");
-    return (yasm_objfmt *)objfmt_dbg;
-}
-
-static void
-dbg_objfmt_output(yasm_object *object, FILE *f, int all_syms,
-                  yasm_errwarns *errwarns)
-{
-    yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt;
-    char buf[1024];
-    size_t i;
-
-    /* Copy temp file to real output file */
-    rewind(objfmt_dbg->dbgfile);
-    while ((i = fread(buf, 1, 1024, objfmt_dbg->dbgfile))) {
-        if (fwrite(buf, 1, i, f) != i)
-            break;
-    }
-
-    /* Reassign objfmt debug file to output file */
-    fclose(objfmt_dbg->dbgfile);
-    objfmt_dbg->dbgfile = f;
-
-    fprintf(objfmt_dbg->dbgfile, "PLUGIN output(f, object->\n");
-    yasm_object_print(object, objfmt_dbg->dbgfile, 1);
-    fprintf(objfmt_dbg->dbgfile, "%d)\n", all_syms);
-    fprintf(objfmt_dbg->dbgfile, " Symbol Table:\n");
-    yasm_symtab_print(object->symtab, objfmt_dbg->dbgfile, 1);
-}
-
-static void
-dbg_objfmt_destroy(yasm_objfmt *objfmt)
-{
-    yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)objfmt;
-    fprintf(objfmt_dbg->dbgfile, "PLUGIN destroy()\n");
-    yasm_xfree(objfmt);
-}
-
-static yasm_section *
-dbg_objfmt_add_default_section(yasm_object *object)
-{
-    yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt;
-    yasm_section *retval;
-    int isnew;
-
-    retval = yasm_object_get_general(object, ".text", 0, 0, 0, &isnew, 0);
-    if (isnew) {
-        fprintf(objfmt_dbg->dbgfile, "(new) ");
-        yasm_symtab_define_label(object->symtab, ".text",
-            yasm_section_bcs_first(retval), 1, 0);
-        yasm_section_set_default(retval, 1);
-    }
-    return retval;
-}
-
-static /*@observer@*/ /*@null@*/ yasm_section *
-dbg_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams,
-                          /*@unused@*/ /*@null@*/
-                          yasm_valparamhead *objext_valparams,
-                          unsigned long line)
-{
-    yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt;
-    yasm_valparam *vp;
-    yasm_section *retval;
-    int isnew;
-
-    fprintf(objfmt_dbg->dbgfile, "PLUGIN section_switch(headp, ");
-    yasm_vps_print(valparams, objfmt_dbg->dbgfile);
-    fprintf(objfmt_dbg->dbgfile, ", ");
-    yasm_vps_print(objext_valparams, objfmt_dbg->dbgfile);
-    fprintf(objfmt_dbg->dbgfile, ", %lu), returning ", line);
-
-    vp = yasm_vps_first(valparams);
-    if (!yasm_vp_string(vp)) {
-        fprintf(objfmt_dbg->dbgfile, "NULL\n");
-        return NULL;
-    }
-    retval = yasm_object_get_general(object, yasm_vp_string(vp), 0, 0, 0,
-                                     &isnew, line);
-    if (isnew) {
-        fprintf(objfmt_dbg->dbgfile, "(new) ");
-        yasm_symtab_define_label(object->symtab, vp->val,
-                                 yasm_section_bcs_first(retval), 1, line);
-    }
-    yasm_section_set_default(retval, 0);
-    fprintf(objfmt_dbg->dbgfile, "\"%s\" section\n", vp->val);
-    return retval;
-}
-
-static /*@observer@*/ /*@null@*/ yasm_symrec *
-dbg_objfmt_get_special_sym(yasm_object *object, const char *name,
-                           const char *parser)
-{
-    yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)object->objfmt;
-    fprintf(objfmt_dbg->dbgfile,
-            "PLUGIN get_special_sym(object, \"%s\", \"%s\")\n",
-            name, parser);
-    return NULL;
-}
-
-/* Define valid debug formats to use with this object format */
-static const char *dbg_objfmt_dbgfmt_keywords[] = {
-    "null",
-    NULL
-};
-
-/* Define objfmt structure -- see objfmt.h for details */
-yasm_objfmt_module yasm_dbg_LTX_objfmt = {
-    "Trace of all info passed to object format module",
-    "dbg",
-    "dbg",
-    32,
-    dbg_objfmt_dbgfmt_keywords,
-    "null",
-    NULL,       /* no directives */
-    NULL,       /* no standard macros */
-    dbg_objfmt_create,
-    dbg_objfmt_output,
-    dbg_objfmt_destroy,
-    dbg_objfmt_add_default_section,
-    dbg_objfmt_section_switch,
-    dbg_objfmt_get_special_sym
-};
diff --git a/plugins/dbg/init_plugin.c b/plugins/dbg/init_plugin.c
deleted file mode 100644
index e8e53dc..0000000
--- a/plugins/dbg/init_plugin.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <libyasm.h>
-#include <libyasm/module.h>
-
-extern yasm_arch_module yasm_dbg_LTX_objfmt;
-
-#ifdef _MSC_VER
-__declspec(dllexport)
-#endif
-void
-yasm_init_plugin(void)
-{
-    yasm_register_module(YASM_MODULE_OBJFMT, "dbg", &yasm_dbg_LTX_objfmt);
-}
diff --git a/plugins/x86/CMakeLists.txt b/plugins/x86/CMakeLists.txt
deleted file mode 100644
index d0e10da..0000000
--- a/plugins/x86/CMakeLists.txt
+++ /dev/null
@@ -1,145 +0,0 @@
-PROJECT(x86mod)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
-
-SET(YASM_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../.."
-    CACHE STRING "Location of Yasm source")
-
-IF (NOT YASM_SOURCE_DIR)
-    MESSAGE(FATAL_ERROR "YASM_SOURCE_DIR must be defined")
-ENDIF (NOT YASM_SOURCE_DIR)
-
-SET(SOURCE_DIR "${YASM_SOURCE_DIR}/modules/arch/x86")
-
-SET (YASM_POSSIBLE_PATHS
-    "$ENV{ProgramFiles}/Yasm/Bin"
-    /usr/bin
-    /usr/local/bin
-    )
-
-FIND_PROGRAM(YASM_PATH yasm
-    PATHS ${YASM_POSSIBLE_PATHS}
-    )
-
-SET (GENPERF_POSSIBLE_PATHS
-    ${YASM_SOURCE_DIR}/objdir/tools/genperf
-    ${YASM_SOURCE_DIR}/objdir/tools/genperf/Debug
-    ${YASM_SOURCE_DIR}/objdir/tools/genperf/Release
-    )
-
-FIND_PROGRAM(GENPERF_PATH genperf
-    DOC "The path to the yasm genperf executable"
-    PATHS ${GENPERF_POSSIBLE_PATHS}
-    )
-
-IF (NOT GENPERF_PATH)
-    MESSAGE(FATAL_ERROR "Could not find genperf executable")
-ENDIF (NOT GENPERF_PATH)
-
-SET (YASM_POSSIBLE_INCLUDE_PATHS
-    "${YASM_PATH}"
-    "${YASM_PATH}/../include"
-    "$ENV{ProgramFiles}/Yasm/Include"
-    /usr/include
-    /usr/local/include
-    )
-
-FIND_PATH(YASM_INCLUDE_PATH NAMES libyasm.h
-    DOC "The path to the libyasm include files"
-    PATHS ${YASM_POSSIBLE_INCLUDE_PATHS}
-    )
-
-IF (NOT YASM_INCLUDE_PATH)
-    MESSAGE(FATAL_ERROR "Could not find yasm include files")
-ENDIF (NOT YASM_INCLUDE_PATH)
-
-INCLUDE_DIRECTORIES(${YASM_INCLUDE_PATH})
-INCLUDE_DIRECTORIES(${YASM_SOURCE_DIR})
-
-SET (YASM_POSSIBLE_LIB_PATHS
-    "${YASM_PATH}"
-    "${YASM_PATH}/../lib"
-    "${YASM_INCLUDE_PATH}/../lib"
-    "$ENV{ProgramFiles}/Yasm/Lib"
-    /usr/lib
-    /usr/local/lib
-    )
-
-FIND_LIBRARY(YASM_LIBRARY
-    NAMES yasm
-    DOC "The path to the libyasm library"
-    PATHS ${YASM_POSSIBLE_LIB_PATHS}
-    )
-
-IF (NOT YASM_LIBRARY)
-    MESSAGE(FATAL_ERROR "Could not find yasm library")
-ENDIF (NOT YASM_LIBRARY)
-
-INCLUDE(FindPythonInterp)
-
-IF (NOT PYTHON_EXECUTABLE)
-    MESSAGE(FATAL_ERROR "Could not find Python executable")
-ENDIF (NOT PYTHON_EXECUTABLE)
-
-INCLUDE_DIRECTORIES(${SOURCE_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
-
-ADD_CUSTOM_COMMAND(
-    OUTPUT
-        ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c
-        ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf
-        ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf
-    COMMAND ${PYTHON_EXECUTABLE} ${SOURCE_DIR}/gen_x86_insn.py
-           ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c
-           ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf
-           ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf
-    MAIN_DEPENDENCY ${SOURCE_DIR}/gen_x86_insn.py
-    )
-
-macro (YASM_GENPERF _in_NAME _out_NAME)
-    add_custom_command(
-        OUTPUT ${_out_NAME}
-        COMMAND ${GENPERF_PATH} ${_in_NAME} ${_out_NAME}
-        MAIN_DEPENDENCY ${_in_NAME}
-        )
-endmacro (YASM_GENPERF)
-
-YASM_GENPERF(
-    ${SOURCE_DIR}/x86cpu.gperf
-    ${CMAKE_CURRENT_BINARY_DIR}/x86cpu.c
-    )
-
-YASM_GENPERF(
-    ${SOURCE_DIR}/x86regtmod.gperf
-    ${CMAKE_CURRENT_BINARY_DIR}/x86regtmod.c
-    )
-
-YASM_GENPERF(
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.gperf
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.c
-    )
-
-YASM_GENPERF(
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.gperf
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.c
-    )
-
-SET(insn_DEPS
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_nasm.c
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insn_gas.c
-    ${CMAKE_CURRENT_BINARY_DIR}/x86insns.c
-    )
-
-SET_SOURCE_FILES_PROPERTIES(${SOURCE_DIR}/x86id.c PROPERTIES
-    OBJECT_DEPENDS "${insn_DEPS}"
-    )
-
-ADD_LIBRARY(x86mod MODULE
-    init_plugin.c
-    ${SOURCE_DIR}/x86arch.c
-    ${SOURCE_DIR}/x86bc.c
-    ${SOURCE_DIR}/x86expr.c
-    ${SOURCE_DIR}/x86id.c
-    x86cpu.c
-    x86regtmod.c
-    )
-TARGET_LINK_LIBRARIES(x86mod ${YASM_LIBRARY})
diff --git a/plugins/x86/README b/plugins/x86/README
deleted file mode 100644
index dddedd0..0000000
--- a/plugins/x86/README
+++ /dev/null
@@ -1,19 +0,0 @@
-This directory demonstrates how to build a yasm builtin module as a plugin.
-This can be useful for integrating custom changes without
-rebuilding/reinstalling yasm.
-
-It requires access to the yasm source.  It defaults to assuming it is being
-built inside of the yasm source tree.
-
-To build:
-  mkdir objdir
-  cd objdir
-  cmake ..
-  make
-
-Testing (on Windows):
-  yasm -N Release/x86mod.dll -f x86 ...
-
-Testing (on Unix):
-  yasm -N ./libx86mod.so -f x86 ...
-
diff --git a/plugins/x86/init_plugin.c b/plugins/x86/init_plugin.c
deleted file mode 100644
index d2698b1..0000000
--- a/plugins/x86/init_plugin.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <libyasm.h>
-#include <libyasm/module.h>
-
-extern yasm_arch_module yasm_x86_LTX_arch;
-
-#ifdef _MSC_VER
-__declspec(dllexport)
-#endif
-void
-yasm_init_plugin(void)
-{
-    yasm_register_module(YASM_MODULE_ARCH, "x86", &yasm_x86_LTX_arch);
-}
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
deleted file mode 100644
index 4b83d4e..0000000
--- a/tools/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-ADD_SUBDIRECTORY(genmacro)
-ADD_SUBDIRECTORY(genperf)
-ADD_SUBDIRECTORY(re2c)
diff --git a/tools/Makefile.inc b/tools/Makefile.inc
index 0dd462c..984578b 100644
--- a/tools/Makefile.inc
+++ b/tools/Makefile.inc
@@ -1,11 +1,9 @@
 # $Id$
 
 EXTRA_DIST += tools/re2c/Makefile.inc
-EXTRA_DIST += tools/genmacro/Makefile.inc
 EXTRA_DIST += tools/genperf/Makefile.inc
 EXTRA_DIST += tools/python-yasm/Makefile.inc
 
 include tools/re2c/Makefile.inc
-include tools/genmacro/Makefile.inc
 include tools/genperf/Makefile.inc
 include tools/python-yasm/Makefile.inc
diff --git a/tools/genmacro/CMakeLists.txt b/tools/genmacro/CMakeLists.txt
deleted file mode 100644
index 27ba599..0000000
--- a/tools/genmacro/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-add_executable(genmacro
-    genmacro.c
-    )
diff --git a/tools/genmacro/Makefile.inc b/tools/genmacro/Makefile.inc
deleted file mode 100644
index 6232b9c..0000000
--- a/tools/genmacro/Makefile.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-# $Id$
-
-# These utility programs have to be built for BUILD host in cross-build.
-# This makes things rather non-standard automake
-
-noinst_PROGRAMS += genmacro
-
-genmacro_SOURCES =
-EXTRA_DIST += tools/genmacro/genmacro.c
-genmacro_LDADD = genmacro.$(OBJEXT)
-genmacro_LINK = $(CCLD_FOR_BUILD) -o $@
-
-genmacro.$(OBJEXT): tools/genmacro/genmacro.c
-	$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f tools/genmacro/genmacro.c || echo '$(srcdir)/'`tools/genmacro/genmacro.c
-
diff --git a/tools/genperf/CMakeLists.txt b/tools/genperf/CMakeLists.txt
deleted file mode 100644
index 6f50989..0000000
--- a/tools/genperf/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-add_executable(genperf
-    genperf.c
-    perfect.c
-    ../../libyasm/phash.c
-    ../../libyasm/xmalloc.c
-    ../../libyasm/xstrdup.c
-    )
-set_target_properties(genperf PROPERTIES COMPILE_FLAGS -DYASM_LIB_DECL=)
diff --git a/tools/re2c/CMakeLists.txt b/tools/re2c/CMakeLists.txt
deleted file mode 100644
index 7125d49..0000000
--- a/tools/re2c/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-add_executable(re2c
-    main.c
-    code.c
-    dfa.c
-    parser.c
-    actions.c
-    scanner.c
-    mbo_getopt.c
-    substr.c
-    translate.c
-    )
diff --git a/util.h b/util.h
index 132cba1..f1886a2 100644
--- a/util.h
+++ b/util.h
@@ -64,7 +64,6 @@
 #include <strings.h>
 #endif
 
-#include <libyasm-stdint.h>
 #include <libyasm/coretype.h>
 
 #ifdef lint