MCPcopy Create free account
hub / github.com/catboost/catboost / main

Function main

tools/fix_elf/patch.cpp:222–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222int main(int argc, char* argv[]) {
223 bool verbose = false;
224 bool rewrite_unique = false;
225
226 using namespace NLastGetopt;
227
228 TOpts opts = NLastGetopt::TOpts::Default();
229 opts.AddHelpOption();
230
231 opts.AddLongOption('v', "verbose").NoArgument().StoreValue(&verbose, true);
232 opts.AddLongOption('u', "rewrite-gnu-unique", "Change STB_GNU_UNIQUE to STB_GLOBAL").NoArgument().StoreValue(&rewrite_unique, true);
233
234 opts.SetFreeArgsMin(1);
235 opts.SetFreeArgTitle(0, "<file>", "File");
236
237 TOptsParseResult res(&opts, argc, argv);
238 TVector<TString> files = res.GetFreeArgs();
239
240 IOutputStream& verboseOut = verbose ? Cout : Cnull;
241
242 bool first = true;
243 for (auto path : files) {
244
245 if (!IsElf(path)) {
246 continue;
247 }
248
249 if (!first) {
250 verboseOut << Endl;
251 }
252 first = false;
253
254 verboseOut << "Patching " << path << Endl;
255
256 try {
257 if (rewrite_unique) {
258 PatchGnuUnique(path, verboseOut);
259 } else {
260 Patch(path, "libc.so.6", verboseOut);
261 Patch(path, "libm.so.6", verboseOut);
262 }
263 } catch (const yexception& e) {
264 Cerr << "Patching failed: " << e.what() << Endl;
265 }
266 }
267
268 return 0;
269}

Callers

nothing calls this directly

Calls 9

DefaultFunction · 0.85
IsElfFunction · 0.85
PatchGnuUniqueFunction · 0.85
SetFreeArgsMinMethod · 0.80
SetFreeArgTitleMethod · 0.80
PatchFunction · 0.70
StoreValueMethod · 0.45
GetFreeArgsMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected