If the proprietary library would be dynamically linked with your program, this would not be allowed by the GPL license, unless it's a system library.
If it would be allowed by the GPL license because it is a system library, then I assume that it would either be present on the Operating System, or independently installable as runtime libraries, and therefore you should not be distributing it along with your program.
The typical use case for this would be building an app for Windows on desktop using the MSVC compiler. In this case, the app would be dynamically linked with Windows runtime libraries, that may be proprietary.
GPL FAQ on the system library exception:
Can I link a GPL program with a proprietary system library?
Both versions of the GPL have an exception to their copyleft, commonly called the system library exception. If the GPL-incompatible libraries you want to use meet the criteria for a system library, then you don't have to do anything special to use them; the requirement to distribute source code for the whole program does not include those libraries, even if you distribute a linked executable containing them.
The criteria for what counts as a “system library” vary between different versions of the GPL. GPLv3 explicitly defines “System Libraries” in section 1, to exclude it from the definition of “Corresponding Source.” GPLv2 deals with this issue slightly differently, near the end of section 3.
From the text of GPLv3:
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
Similarly, from GPLv2:
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
Edit based on the update of the question and this comment from the OP:
I'm talking about a library that is statically linked by the compiler patching the source code during compilation. Say it is GIMP. I downloaded GIMP, but when I compile it with my compiler, I get a Photoshop beater. But when others ask for the source code, I will provide the GIMP source code. Without my "compiler", they cannot get the same binary as me.
Since the patched program ("Photoshop beater") is derived from both the GPL-licensed code and proprietary code, the GPL license then applies to the whole patched program, if you're not the sole copyright owner of the GPL-licensed software. In order to be compliant to GPL, all of the source code and build scripts needed to regenerate the patched program from source code, must be distributed (or made available) to the recipient of the binaries of the patched program.
However, if you are the sole copyright owner of the GPL-licensed code and the proprietary patch code, then you can relicense the combination under another license.
WolfSSL is an example of a software that's available under either the GPLv2+ or a commercial license. The WolfSSL company can add additional features to the commercial license version of the software, if they wanted to.