[PATCH] [ELF] Fix undefined symbol handling in DSO.

Joerg Sonnenberger joerg at britannica.bec.de
Mon Apr 7 03:32:14 PDT 2014


On Sun, Apr 06, 2014 at 09:58:13PM -0700, Rui Ueyama wrote:
> Currently LLD ignores undefined symbols found in DSOs when linking against
> DSO files, if -shared flag is given. Internally, it's achieved by enabling
> "useShlibUndefines" flag, which makes the file reader to ignore all undefined
> symbols in DSO, so that Resolver don't see any undefined symbols when
> handling DSO files.

I don't think your patch fixes the real issue. The correct behavior
is:

(1) If the undefined symbol comes from an object file (or archive
library), it is a true undefined symbol. In this case, the behavior
depends on (a) -z defs (b) the output type. For shared libraries,
undefined symbols are by default not fatal, for executables, they are.

(2) Undefined symbols in shared libraries pulled in via -l are ignored.

(3) For ELF, shared libraries are processed recursively.

Joerg



More information about the llvm-commits mailing list