This is an archive of the discontinued LLVM Phabricator instance.

[ELF2] - Implemented -e flag
ClosedPublic

Authored by grimar on Sep 28 2015, 6:33 AM.

Details

Reviewers
ruiu
rafael
Summary

Implemented -e flag ("Use entry as the explicit symbol for beginning execution of your program, rather than the default entry point.");
Actually docs also says that:

"If there is no symbol named entry, the linker will try to parse entry as a number, and use that as the entry address (the number will be interpreted in base 10; you may use a leading 0x for base 16, or a leading 0 for base 8)."

But I doubt that it is a real usecase and not sure if it should be implemented or not ?

Diff Detail

Event Timeline

grimar updated this revision to Diff 35861.Sep 28 2015, 6:33 AM
grimar retitled this revision from to [ELF2] - Implemented -e flag.
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: grimar, llvm-commits.
ruiu added inline comments.Sep 28 2015, 6:42 AM
ELF/Config.h
32

Member variable names in this class are consistent with their corresponding command line options. s/EntryPoint/Entry/.

ELF/Driver.cpp
142

We don't have comments for other options above.

test/elf2/entry.s
8

Remove blank trailing lines.

grimar added inline comments.Sep 28 2015, 6:56 AM
ELF/Config.h
32

Ok. That was not obvious though.

ELF/Driver.cpp
142

I`ll remove if you wish. Other are self-explaining, I thought at least reference to "-e" makes it more clear.

ruiu added inline comments.Sep 28 2015, 7:06 AM
ELF/Driver.cpp
142

This is also self-explanatory since the name of the variable is OPT_e (thus this is for -e). Can you add both --entry and -e to Options.td and use OPT_entry instead?

grimar added inline comments.Sep 28 2015, 7:12 AM
ELF/Driver.cpp
142

Sure. Will be added in next patch.

grimar added inline comments.Sep 28 2015, 7:40 AM
ELF/Config.h
32

Also can suggest to sort them alphabetically then.

emaste added a subscriber: emaste.Sep 28 2015, 8:45 AM
grimar updated this revision to Diff 35978.Sep 29 2015, 7:59 AM

Review comments addressed.

denis-protivensky added inline comments.
ELF/SymbolTable.cpp
76–79

Did you rebase your changes? This code looks outdated.

grimar updated this revision to Diff 35992.Sep 29 2015, 9:32 AM

Updated patch to match latest revision.

ELF/SymbolTable.cpp
76–79

Updated the patch.

ruiu accepted this revision.Sep 29 2015, 9:35 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 29 2015, 9:35 AM

Could please anyone commit it ?
Going to request writing access today :)

ruiu added a subscriber: ruiu.Sep 29 2015, 9:42 AM

Submitted as r248806.

grimar closed this revision.Sep 29 2015, 9:46 AM

Thanks a lot Rui !