jbeverly / pam_ssh_agent_auth

Moving pam_ssh_agent_auth to github as primary development location
Other
98 stars 27 forks source link

Always use the compiler to call the linker #42

Open Peter-Levine opened 1 year ago

Peter-Levine commented 1 year ago

Building with LD defined as ld.lld fails with errors such as ld.lld: error: unknown argument '-Wl,-O1' (see https://bugs.gentoo.org/741927). This is because if LD is defined in the environment, it becomes the binary that executes the final link command. But LDFLAGS generally consist of flags prefixed with -Wl, that are designed to be passed by the compiler to the linker. Since linkers don't recognized such prefixed flags, linking fails.

In this context, the build's LD should always be $CC. Testing the final link command verbosely shows that the compiler selects the proper linker from the shell environment's $LD.