diff options
Diffstat (limited to 'build/make')
-rwxr-xr-x | build/make/gen_msvs_proj.sh | 72 | ||||
-rw-r--r-- | build/make/obj_int_extract.c | 21 |
2 files changed, 91 insertions, 2 deletions
diff --git a/build/make/gen_msvs_proj.sh b/build/make/gen_msvs_proj.sh index becd95827..c2ef44a9b 100755 --- a/build/make/gen_msvs_proj.sh +++ b/build/make/gen_msvs_proj.sh @@ -33,6 +33,7 @@ Options: --proj-guid=GUID GUID to use for the project --module-def=filename File containing export definitions (for DLLs) --ver=version Version (7,8,9) of visual studio to generate for + --src-path-bare=dir Path to root of source tree -Ipath/to/include Additional include directories -DFLAG[=value] Preprocessor macros to define -Lpath/to/lib Additional library search paths @@ -191,6 +192,8 @@ for opt in "$@"; do ;; --lib) proj_kind="lib" ;; + --src-path-bare=*) src_path_bare="$optval" + ;; --static-crt) use_static_runtime=true ;; --ver=*) @@ -335,6 +338,35 @@ generate_vcproj() { case "$target" in x86*) case "$name" in + obj_int_extract) + tag Tool \ + Name="VCCLCompilerTool" \ + Optimization="0" \ + AdditionalIncludeDirectories="$incs" \ + PreprocessorDefinitions="WIN32;DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" \ + RuntimeLibrary="$debug_runtime" \ + WarningLevel="3" \ + Detect64BitPortabilityProblems="true" \ + DebugInformationFormat="1" \ + ;; + vpx) + tag Tool \ + Name="VCPreBuildEventTool" \ + CommandLine="call obj_int_extract.bat $src_path_bare" \ + + tag Tool \ + Name="VCCLCompilerTool" \ + Optimization="0" \ + AdditionalIncludeDirectories="$incs" \ + PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \ + RuntimeLibrary="$debug_runtime" \ + UsePrecompiledHeader="0" \ + WarningLevel="3" \ + DebugInformationFormat="1" \ + Detect64BitPortabilityProblems="true" \ + + $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="1" + ;; *) tag Tool \ Name="VCCLCompilerTool" \ @@ -358,6 +390,12 @@ generate_vcproj() { case "$target" in x86*) case "$name" in + obj_int_extract) + tag Tool \ + Name="VCLinkerTool" \ + OutputFile="${name}.exe" \ + GenerateDebugInformation="true" \ + ;; *) tag Tool \ Name="VCLinkerTool" \ @@ -406,6 +444,34 @@ generate_vcproj() { case "$target" in x86*) case "$name" in + obj_int_extract) + tag Tool \ + Name="VCCLCompilerTool" \ + AdditionalIncludeDirectories="$incs" \ + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" \ + RuntimeLibrary="$release_runtime" \ + UsePrecompiledHeader="0" \ + WarningLevel="3" \ + Detect64BitPortabilityProblems="true" \ + DebugInformationFormat="0" \ + ;; + vpx) + tag Tool \ + Name="VCPreBuildEventTool" \ + CommandLine="call obj_int_extract.bat $src_path_bare" \ + + tag Tool \ + Name="VCCLCompilerTool" \ + AdditionalIncludeDirectories="$incs" \ + PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \ + RuntimeLibrary="$release_runtime" \ + UsePrecompiledHeader="0" \ + WarningLevel="3" \ + DebugInformationFormat="0" \ + Detect64BitPortabilityProblems="true" \ + + $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" + ;; *) tag Tool \ Name="VCCLCompilerTool" \ @@ -428,6 +494,12 @@ generate_vcproj() { case "$target" in x86*) case "$name" in + obj_int_extract) + tag Tool \ + Name="VCLinkerTool" \ + OutputFile="${name}.exe" \ + GenerateDebugInformation="true" \ + ;; *) tag Tool \ Name="VCLinkerTool" \ diff --git a/build/make/obj_int_extract.c b/build/make/obj_int_extract.c index 22c5cf2ab..01b3129d7 100644 --- a/build/make/obj_int_extract.c +++ b/build/make/obj_int_extract.c @@ -840,9 +840,18 @@ int parse_coff(unsigned __int8 *buf, size_t sz) strtab_ptr = symtab_ptr + symtab_sz * 18; if (nsections > 96) - goto bail; + { + log_msg("Too many sections\n"); + return 1; + } - sectionlist = malloc(nsections * sizeof * sectionlist); + sectionlist = malloc(nsections * sizeof(sectionlist)); + + if (sectionlist == NULL) + { + log_msg("Allocating first level of section list failed\n"); + return 1; + } //log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections); @@ -860,6 +869,12 @@ int parse_coff(unsigned __int8 *buf, size_t sz) //log_msg("COFF: Parsing section %s\n",sectionname); sectionlist[i] = malloc(strlen(sectionname) + 1); + + if (sectionlist[i] == NULL) + { + log_msg("Allocating storage for %s failed\n", sectionname); + goto bail; + } strcpy(sectionlist[i], sectionname); if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20); @@ -903,12 +918,14 @@ int parse_coff(unsigned __int8 *buf, size_t sz) char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; strncpy(name, ptr, 8); //log_msg("COFF: Parsing symbol %s\n",name); + /* +1 to avoid printing leading underscore */ printf("%-40s EQU ", name + 1); } else { //log_msg("COFF: Parsing symbol %s\n", // buf + strtab_ptr + get_le32(ptr+4)); + /* +1 to avoid printing leading underscore */ printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4) + 1); } |