Refactoring the extld related logic (#3400)

2 files changed