[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

-Wl,--as-needed considered possibly harmful



Hi,

due to the recent dpkg-shlibdeps changes, people have started adding
-Wl,--as-needed into their LDFLAGS.

THIS IS NOT A GOOD IDEA.

You are essentially telling gcc to pass an option to the linker without
understanding what it does, and, more specifically, an option that tells
the linker to second-guess the gcc compiler driver. This can introduce
really interesting and subtle bugs that will be difficult to find.

If there are broken scripts adding too many libraries then it is time to
fix those scripts, not employ an evil hack that makes the symptoms go away.

   Simon



Reply to: