Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devel/stlink: Fix build on 32 bit platforms
* Remove settings of optimization from cmake/modules/c_flags.cmake as per section 13.9 of Porter's Handbook * Switch to DISTVERSION * Pet portclippy * Reformat Makefile with portfmt PR: 257708 Approved by: maitainer timeout (> 1 month) Differential Revision: https://reviews.freebsd.org/D32545
- Loading branch information
1 parent
644e5b6
commit b6534ec
Showing
6 changed files
with
77 additions
and
26 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
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
--- CMakeLists.txt.orig 2021-07-13 15:04:41.612208000 +0300 | ||
+++ CMakeLists.txt 2021-07-13 15:06:16.763751332 +0300 | ||
@@ -299,4 +299,5 @@ | ||
--- CMakeLists.txt.orig 2021-09-15 09:54:35 UTC | ||
+++ CMakeLists.txt | ||
@@ -298,6 +298,7 @@ endif () | ||
# add_subdirectory(src/stlink-gui) # contains subordinate CMakeLists to build GUI | ||
add_subdirectory(tests) # contains subordinate CMakeLists to build test executables | ||
add_subdirectory(cmake/packaging) # contains subordinate CMakeLists to build packages | ||
+add_subdirectory(doc/dev/pkg-config) # contains subordinate CMakeLists to build pkg-config descriptor | ||
|
||
option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF) | ||
add_subdirectory(doc/man) # contains subordinate CMakeLists to generate manpages |
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,18 @@ | ||
Work around upstream bug #1175 and make the build more robust | ||
against minor platform differences. -Werror should not be | ||
provided in release builds. | ||
|
||
--- cmake/modules/c_flags.cmake.orig 2021-04-24 22:24:02 UTC | ||
+++ cmake/modules/c_flags.cmake | ||
@@ -44,11 +44,3 @@ endif () | ||
if (NOT (WIN32 OR (EXISTS "/etc/debian_version" AND MINGW))) | ||
add_cflag_if_supported("-fPIC") | ||
endif () | ||
- | ||
-if (${CMAKE_BUILD_TYPE} MATCHES "Debug") | ||
- add_cflag_if_supported("-ggdb") | ||
- add_cflag_if_supported("-O0") | ||
-else () | ||
- add_cflag_if_supported("-O2") | ||
- add_cflag_if_supported("-Werror") | ||
-endif () |
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
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
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,34 @@ | ||
Partial application of upstream commit c8fc656, closing | ||
upstream bug #985 and #1175 and fixing the build on 32 | ||
bit platforms. | ||
|
||
https://github.com/stlink-org/stlink/commit/c8fc6561fead79ad49c09d82bab864745086792c | ||
https://github.com/stlink-org/stlink/issues/985 | ||
https://github.com/stlink-org/stlink/issues/1175 | ||
|
||
--- src/common.c.orig 2021-04-24 22:24:02 UTC | ||
+++ src/common.c | ||
@@ -1,4 +1,5 @@ | ||
#define DEBUG_FLASH 0 | ||
+#include <limits.h> | ||
#include <stdarg.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
@@ -2205,7 +2206,7 @@ static int map_file(mapped_file_t *mf, const char *pat | ||
|
||
if (sizeof(st.st_size) != sizeof(size_t)) { | ||
// on 32 bit systems, check if there is an overflow | ||
- if (st.st_size > (off_t)INT32_MAX) { | ||
+ if (st.st_size > (off_t)SSIZE_MAX) { | ||
fprintf(stderr, "mmap() size_t overflow for file %s\n", path); | ||
goto on_error; | ||
} | ||
@@ -2219,7 +2220,7 @@ static int map_file(mapped_file_t *mf, const char *pat | ||
goto on_error; | ||
} | ||
|
||
- mf->len = st.st_size; | ||
+ mf->len = (size_t)st.st_size; | ||
error = 0; // success | ||
|
||
on_error: |