Added flags_before_libraries to linker

Added flags_before_libraries to linker
Revert some code what's overrode by other pull-request.