llvm-project/clang/lib
Oleg Ranevskyy cd5163720f [Clang/Support/Windows/Unix] Command lines created by clang may exceed the command length limit set by the OS
Summary:
LLVM part of the patch is D15831.

When clang runs an external tool such as a linker it may create a command line that exceeds the length limit.

Clang uses the llvm::sys::argumentsFitWithinSystemLimits function to check if command line length fits the OS 

limitation. There are two problems in this function that may cause exceeding of the limit:

1. It ignores the length of the program path in its calculations. On the other hand, clang adds the program 

path to the command line when it runs the program.

2. It assumes no space character is inserted after the last argument, which is not true for Windows. The flattenArgs function adds the trailing space for *each* argument. The result of this is that the terminating NULL character is not counted and may be placed beyond the length limit if the command line is exactly 32768 characters long. The WinAPI's CreateProcess does not find the NULL character and fails.


Reviewers: rafael, asl

Subscribers: asl, llvm-commits

Differential Revision: http://reviews.llvm.org/D15832

llvm-svn: 256865
2016-01-05 19:54:39 +00:00
..
ARCMigrate Fix funciton->function typo. 2015-12-16 23:10:46 +00:00
AST ArrayRef-ize a function. NFC 2016-01-03 19:43:23 +00:00
ASTMatchers [ASTMatchers] Add booleanType() matcher. 2015-12-22 20:06:40 +00:00
Analysis Use range-based for loop to avoid the need for calculating an array size. NFC 2015-11-30 03:11:12 +00:00
Basic [AArch64] Teaches clang about Samsung Exynos-M1 2016-01-05 12:53:24 +00:00
CodeGen [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and device codegen. 2016-01-05 19:16:13 +00:00
Driver [Clang/Support/Windows/Unix] Command lines created by clang may exceed the command length limit set by the OS 2016-01-05 19:54:39 +00:00
Edit Replace double negation of !FileID.isInvalid() with FileID.isValid(). 2015-10-03 10:46:20 +00:00
Format clang-format: Fix corner case in "if it saves columns"-calculation. 2016-01-05 16:10:39 +00:00
Frontend [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and device codegen. 2016-01-05 19:16:13 +00:00
FrontendTool Provide a BuryPointer for unique_ptrs. 2014-08-29 16:53:14 +00:00
Headers Reimplement __readeflags and __writeeflags on top of intrinsics 2016-01-01 06:50:08 +00:00
Index Roll-back r250822. 2015-10-20 13:23:58 +00:00
Lex Emit a -Wmicrosoft warning when treating ^Z as EOF in MS mode. 2015-12-29 23:17:27 +00:00
Parse [OpenCL] Disallow taking an address of a function. 2016-01-05 14:39:27 +00:00
Rewrite Roll-back r250822. 2015-10-20 13:23:58 +00:00
Sema Avoid walking all the declarations in the TU when a tag is declared in function 2016-01-05 01:21:53 +00:00
Serialization [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and device codegen. 2016-01-05 19:16:13 +00:00
StaticAnalyzer [analyzer] Handle another Android assert function. 2015-12-30 00:08:59 +00:00
Tooling Add fall-back mode for clang tools. 2015-12-03 10:38:53 +00:00
CMakeLists.txt Fix build with various feature flag combinations 2014-07-14 22:17:22 +00:00
Makefile Make clang's rewrite engine a core feature 2014-07-16 16:48:33 +00:00