-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This code is taken from GCC 13.2.0 with a number of modifications applied. See the included readme for more information.
- Loading branch information
Showing
38 changed files
with
28,321 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
add_library(demanglegnu STATIC | ||
src/alloca.c | ||
src/cp-demangle.c | ||
src/cplus-dem.c | ||
src/d-demangle.c | ||
src/dyn-string.c | ||
src/getopt1.c | ||
src/getopt.c | ||
src/rust-demangle.c | ||
src/safe-ctype.c | ||
src/xexit.c | ||
src/xmalloc.c | ||
src/xmemdup.c | ||
src/xstrdup.c | ||
) | ||
|
||
set(GNU_DEMANGLER_FLAGS -DHAVE_DECL_BASENAME=1 -DHAVE_LIMITS_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1) | ||
|
||
target_include_directories(demanglegnu PUBLIC include) | ||
target_compile_definitions(demanglegnu PUBLIC ${GNU_DEMANGLER_FLAGS}) | ||
|
||
add_executable(demangler_fuzzer testsuite/demangler-fuzzer.c) | ||
add_executable(demangler_test testsuite/test-demangle.c) | ||
target_link_libraries(demangler_fuzzer demanglegnu) | ||
target_link_libraries(demangler_test demanglegnu) | ||
target_compile_definitions(demangler_fuzzer PUBLIC ${GNU_DEMANGLER_FLAGS}) | ||
target_compile_definitions(demangler_test PUBLIC ${GNU_DEMANGLER_FLAGS}) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
This code was taken from GCC 13.2.0 and specifically the libiberty library which | ||
contains files licensed under the GPL and the LGPL. | ||
|
||
Support for GCC 2.x-style symbols has been reintroduced by reversing the changes | ||
made by the commit that removed it: | ||
|
||
From: Jason Merrill <[email protected]> | ||
Date: Sun, 23 Dec 2018 00:06:34 +0000 (-0500) | ||
Subject: Remove support for demangling GCC 2.x era mangling schemes. | ||
X-Git-Tag: releases/gcc-9.1.0~2159 | ||
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=6c8120c5ff130e03d32ff15a8f0d0e703592a2af | ||
|
||
Remove support for demangling GCC 2.x era mangling schemes. | ||
|
||
libiberty/ | ||
* cplus-dem.c: Remove cplus_mangle_opname, cplus_demangle_opname, | ||
internal_cplus_demangle, and all subroutines. | ||
(libiberty_demanglers): Remove entries for ancient GNU (pre-3.0), | ||
Lucid, ARM, HP, and EDG demangling styles. | ||
(cplus_demangle): Remove 'work' variable. Don't call | ||
internal_cplus_demangle. | ||
include/ | ||
* demangle.h: Remove support for ancient GNU (pre-3.0), Lucid, | ||
ARM, HP, and EDG demangling styles. | ||
|
||
From-SVN: r267363 | ||
|
||
In addition, the cplus_demangle_opname function has been modified to address a | ||
memory safety issue: | ||
|
||
/* CCC: Allocate the result on the heap to prevent buffer overruns. */ | ||
extern char * | ||
cplus_demangle_opname (const char *opname, int options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# This script copies all the source files needed for the GNU demangler from a | ||
# copy of GCC to the specified output directory. | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "usage: $0 <gcc dir> <out dir>" | ||
exit 1 | ||
fi | ||
|
||
GCC_DIR=$1 | ||
OUT_DIR=$2 | ||
|
||
cp "$GCC_DIR/include/ansidecl.h" "$OUT_DIR/include/" | ||
cp "$GCC_DIR/include/demangle.h" "$OUT_DIR/include/" | ||
cp "$GCC_DIR/include/dyn-string.h" "$OUT_DIR/include/" | ||
cp "$GCC_DIR/include/environ.h" "$OUT_DIR/include/" | ||
cp "$GCC_DIR/include/getopt.h" "$OUT_DIR/include/" | ||
cp "$GCC_DIR/include/libiberty.h" "$OUT_DIR/include/" | ||
cp "$GCC_DIR/include/safe-ctype.h" "$OUT_DIR/include/" | ||
cp "$GCC_DIR/libiberty/alloca.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/argv.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/cp-demangle.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/cp-demangle.h" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/cplus-dem.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/d-demangle.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/dyn-string.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/getopt.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/getopt1.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/rust-demangle.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/safe-ctype.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/xexit.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/xmalloc.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/xmemdup.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/xstrdup.c" "$OUT_DIR/src/" | ||
cp "$GCC_DIR/libiberty/testsuite/demangle-expected" "$OUT_DIR/testsuite/" | ||
cp "$GCC_DIR/libiberty/testsuite/demangler-fuzzer.c" "$OUT_DIR/testsuite/" | ||
cp "$GCC_DIR/libiberty/testsuite/test-demangle.c" "$OUT_DIR/testsuite/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(SolutionDir)common\vsprops\BaseProjectConfig.props" /> | ||
<Import Project="$(SolutionDir)common\vsprops\WinSDK.props" /> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{D31A6DD1-99CA-41D8-A230-1FAE913C8989}</ProjectGuid> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Label="Configuration"> | ||
<ConfigurationType>StaticLibrary</ConfigurationType> | ||
<PlatformToolset Condition="!$(Configuration.Contains(Clang))">$(DefaultPlatformToolset)</PlatformToolset> | ||
<PlatformToolset Condition="$(Configuration.Contains(Clang))">ClangCL</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
<WholeProgramOptimization Condition="$(Configuration.Contains(Release))">true</WholeProgramOptimization> | ||
<UseDebugLibraries Condition="$(Configuration.Contains(Debug))">true</UseDebugLibraries> | ||
<UseDebugLibraries Condition="!$(Configuration.Contains(Debug))">false</UseDebugLibraries> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings" /> | ||
<ImportGroup Label="PropertySheets"> | ||
<Import Project="..\DefaultProjectRootDir.props" /> | ||
<Import Project="..\3rdparty.props" /> | ||
<Import Condition="$(Configuration.Contains(Debug))" Project="..\..\common\vsprops\CodeGen_Debug.props" /> | ||
<Import Condition="$(Configuration.Contains(Devel))" Project="..\..\common\vsprops\CodeGen_Devel.props" /> | ||
<Import Condition="$(Configuration.Contains(Release))" Project="..\..\common\vsprops\CodeGen_Release.props" /> | ||
<Import Condition="!$(Configuration.Contains(Release))" Project="..\..\common\vsprops\IncrementalLinking.props" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup> | ||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ClInclude Include="include\ansidecl.h" /> | ||
<ClInclude Include="include\cp-demangle.h" /> | ||
<ClInclude Include="include\demangle.h" /> | ||
<ClInclude Include="include\dyn-string.h" /> | ||
<ClInclude Include="include\environ.h" /> | ||
<ClInclude Include="include\getopt.h" /> | ||
<ClInclude Include="include\libiberty.h" /> | ||
<ClInclude Include="include\safe-ctype.h" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="src\alloca.c" /> | ||
<ClCompile Include="src\argv.c" /> | ||
<ClCompile Include="src\cp-demangle.c" /> | ||
<ClCompile Include="src\cplus-dem.c" /> | ||
<ClCompile Include="src\d-demangle.c" /> | ||
<ClCompile Include="src\dyn-string.c" /> | ||
<ClCompile Include="src\getopt.c" /> | ||
<ClCompile Include="src\getopt1.c" /> | ||
<ClCompile Include="src\rust-demangle.c" /> | ||
<ClCompile Include="src\safe-ctype.c" /> | ||
<ClCompile Include="src\xexit.c" /> | ||
<ClCompile Include="src\xmalloc.c" /> | ||
<ClCompile Include="src\xmemdup.c" /> | ||
<ClCompile Include="src\xstrdup.c" /> | ||
</ItemGroup> | ||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<PreprocessorDefinitions>HAVE_DECL_BASENAME=1;HAVE_LIMITS_H;HAVE_STDLIB_H=1;HAVE_STRING_H=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<WarningLevel>TurnOffAllWarnings</WarningLevel> | ||
<AdditionalIncludeDirectories>$(ProjectDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="Resource Files"> | ||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="include\ansidecl.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="include\cp-demangle.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="include\demangle.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="include\dyn-string.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="include\environ.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="include\getopt.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="include\libiberty.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="include\safe-ctype.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="src\alloca.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\argv.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\cp-demangle.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\cplus-dem.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\d-demangle.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\dyn-string.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\getopt.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\getopt1.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\rust-demangle.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\safe-ctype.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\xexit.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\xmalloc.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\xmemdup.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="src\xstrdup.c"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.