This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Add support for --just-symbols flag.
AbandonedPublic

Authored by grimar on Nov 28 2017, 4:56 AM.

Details

Reviewers
ruiu
rafael
Summary

This is "Bug 35067 - support --just-symbols (-R)" (https://bugs.llvm.org//show_bug.cgi?id=35067)

Description of feature:
--just-symbols=filename
Read symbol names and their addresses from filename, but do not relocate it or include it in the output.
This allows your output file to refer symbolically to absolute locations of memory defined in other programs.
You may use this option more than once.
(ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html)

Patch implements --just-symbols flag. Behavior is to read symbols from file and
add all of them as absolute symbols except undefined symbols, which are kept as undefined.

Only executable and relocatable files are supported as arguments. Both gnu linkers does not support
adding DSO files. Behavior of GNU linkers restricting DSO inputs is probably reasonable, though that looks
like artifical limitation. I can imagine DSO with absolute symbols and see no problems to extract
and use such symbols. This implementation follows GNU linkers behavior mostly for simplicity and consistency
of our implementation.

Diff Detail

Event Timeline

grimar created this revision.Nov 28 2017, 4:56 AM
phosek added a subscriber: phosek.Nov 28 2017, 11:48 AM

FYI @ruiu has already wrote a similar patch in D39348.

FYI @ruiu has already wrote a similar patch in D39348.

I did not see it :( Thanks.

grimar abandoned this revision.Dec 3 2017, 11:09 PM

Abdndoned in favor of D39348.