cmp: introduce new variables for linker flags

Split up the options into additional flags for the linker and
additional libraries.

Quoting from issue #636:

> Here's an example, attempting to link one object file named
  example.o into an executable named example. Libcrypto here is
  superfluous and should be removed by --as-needed:

```
LDFLAGS="-Wl,--as-needed"
LIBS="-lcrypto"
gcc ${LDFLAGS} ${LIBS} example.o -o example # doesn't link libcrypto!
gcc example.o ${LDFLAGS} ${LIBS} -o example # doesn't honor --as-needed!
gcc ${LDFLAGS} example.o ${LIBS} -o example # works great!
```

> In short, the placement of your -l<foo> flags differs from that of
  all the other linker flags. Since ECL is only providing one big
  variable ld-flags for all of the linker flags, there's no correct
  way to pass in options like --as-needed and -l<foo> at the same
  time.

Fixes #636.
This commit is contained in:
Marius Gerbershagen 2021-08-08 10:45:28 +02:00
parent d0a24fe283
commit 826cc92983
7 changed files with 103 additions and 46 deletions

View file

@ -45,6 +45,14 @@
** API changes
- A new function ~(mp:semaphore-wait semaphore count timeout)~
- Deprecate Functions ~mp:wait-on-semaphore~ and ~mp:try-get-semphore~
- The variable ~c:*user-ld-flags*~ is deprecated in favor of
~c:*user-linker-flags*~ for option flags (like ~-Wl,foo~) and
~c:*user-linker-libs*~ for libraries to link in (like ~-lfoo~).
The variable ~c:*user-ld-flags*~ is left for backward compatibility and
may be removed in future releases - it may cause option flags to be added
in the wrong place in the commandline when invoking the C compiler
program.
* 21.2.1 changes since 20.4.24
** Announcement