xref: /aosp_15_r20/external/perfetto/gn/standalone/toolchain/llvm-strip.py (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1#!/usr/bin/env python3
2# Copyright (C) 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15"""This is really a wrapper around exec() for llvm-objcopy.
16
17It is used to execute llvm-objcopy passing "llvm-strip" as argv0. This is
18because llvm-objcopy frontend behaves differently and emulates the "strip"
19binary when its argv0 is set as llvm-strip.
20"""
21
22import os
23import sys
24
25
26def main():
27  if (len(sys.argv) < 3):
28    sys.stderr.write('Usage: %s /path/to/llvm-objcopy [args]\n' % (__file__))
29    return 1
30  os.execlp(sys.argv[1], "llvm-strip", *sys.argv[2:])
31
32
33if __name__ == '__main__':
34  sys.exit(main())
35