This is an archive of the discontinued LLVM Phabricator instance.

[lld][linkerscript] Fix handling of DEFINED.
ClosedPublic

Authored by abidh on Jul 14 2020, 3:28 AM.

Details

Summary

Current implementation did not check that symbols is actually defined. Only checked for presence. GNU ld documentation says,

"Return 1 if symbol is in the linker global symbol table and is defined before the statement using DEFINED in the script, otherwise return 0."

https://sourceware.org/binutils/docs/ld/Builtin-Functions.html#Builtin-Functions

Diff Detail

Event Timeline

abidh created this revision.Jul 14 2020, 3:28 AM

This is correct, however, can you just add a test to linkerscript/defined.test?

abidh updated this revision to Diff 278250.Jul 15 2020, 11:07 AM

Moved test to linkerscript/define.test as advised.

MaskRay accepted this revision.Jul 16 2020, 8:50 AM

Looks great!

This revision is now accepted and ready to land.Jul 16 2020, 8:50 AM
This revision was automatically updated to reflect the committed changes.