source: rtems-tools/linkers/wscript @ 1318c11

Last change on this file since 1318c11 was 1318c11, checked in by Chris Johns <chrisj@…>, on May 24, 2018 at 6:05:44 AM

linkers: Add an address to line tool.

This tool provides a way to check the DWARF toolkit support for finding
lines from addresses.

  • Property mode set to 100644
File size: 6.0 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2014-2016 Chris Johns (chrisj@rtems.org)
4# All rights reserved.
5#
6# This file is part of the RTEMS Tools package in 'rtems-tools'.
7#
8# Permission to use, copy, modify, and/or distribute this software for any
9# purpose with or without fee is hereby granted, provided that the above
10# copyright notice and this permission notice appear in all copies.
11#
12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19#
20
21#
22# RTEMS Linker build script.
23#
24import sys
25
26def init(ctx):
27    pass
28
29def options(opt):
30    opt.load('compiler_c')
31    opt.load('compiler_cxx')
32
33def configure(conf):
34    conf.load('compiler_c')
35    conf.load('compiler_cxx')
36
37    conf.write_config_header('config.h')
38
39def build(bld):
40    #
41    # Build the doxygen documentation.
42    #
43    if bld.cmd == 'doxy':
44        bld(features = 'doxygen',
45            doxyfile = 'rtl-host.conf')
46        return
47
48    #
49    # The local configuration.
50    #
51    conf = {}
52
53    #
54    # Build flags.
55    #
56    rtemstoolkit = '../rtemstoolkit'
57    conf['includes'] = [rtemstoolkit,
58                        rtemstoolkit + '/elftoolchain/libelf',
59                        rtemstoolkit + '/elftoolchain/libdwarf',
60                        rtemstoolkit + '/elftoolchain/common',
61                        rtemstoolkit + '/elftoolchain/libelftc',
62                        rtemstoolkit + '/libiberty']
63    if bld.env.DEST_OS == 'win32':
64        conf['includes'] += [rtemstoolkit + '/win32']
65    conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic']
66    conf['optflags'] = bld.env.C_OPTS
67    conf['cflags'] = ['-pipe', '-g'] + conf['optflags']
68    conf['cxxflags'] = ['-pipe', '-g', '--std=c++11'] + conf['optflags']
69    conf['linkflags'] = ['-g']
70
71    #
72    # The list of modules.
73    #
74    modules = ['rld', 'elftc', 'dwarf', 'elf', 'iberty']
75
76    #
77    # The list of defines
78    #
79    defines = ['HAVE_CONFIG_H=1',
80               'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION),
81               'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)]
82
83    #
84    # Build the linker.
85    #
86    bld.program(target = 'rtems-ld',
87                source = ['rtems-ld.cpp'],
88                defines = defines,
89                includes = ['.'] + conf['includes'],
90                cflags = conf['cflags'] + conf['warningflags'],
91                cxxflags = conf['cxxflags'] + conf['warningflags'],
92                linkflags = conf['linkflags'],
93                use = modules)
94
95    #
96    # Build the ra linker.
97    #
98    bld.program(target = 'rtems-ra',
99                source = ['rtems-ra.cpp'],
100                defines = defines,
101                includes = ['.'] + conf['includes'],
102                cflags = conf['cflags'] + conf['warningflags'],
103                cxxflags = conf['cxxflags'] + conf['warningflags'],
104                linkflags = conf['linkflags'],
105                use = modules)
106
107    #
108    # Build the trace linker.
109    #
110    bld.program(target = 'rtems-tld',
111                source = ['rtems-tld.cpp'],
112                defines = defines,
113                includes = ['.'] + conf['includes'],
114                cflags = conf['cflags'] + conf['warningflags'],
115                cxxflags = conf['cxxflags'] + conf['warningflags'],
116                linkflags = conf['linkflags'],
117                use = modules)
118    bld.install_files('${PREFIX}/share/rtems/trace-linker',
119                      ['libc.ini',
120                       'libc-heap.ini',
121                       'rtems.ini',
122                       'rtems-api.ini',
123                       'rtems-posix.ini',
124                       'rtems-score.ini',
125                       'rtems-score-object.ini',
126                       'rtems-score-thread.ini',
127                       'rtems-score-threadq.ini',
128                       'rtems-score-heap.ini',
129                       'rtld-base.ini',
130                       'rtld-trace-buffer.ini',
131                       'rtld-print.ini'])
132
133    #
134    # Build the symbols.
135    #
136    bld.program(target = 'rtems-syms',
137                source = ['rtems-syms.cpp'],
138                defines = defines,
139                includes = ['.'] + conf['includes'],
140                cflags = conf['cflags'] + conf['warningflags'],
141                cxxflags = conf['cxxflags'] + conf['warningflags'],
142                linkflags = conf['linkflags'],
143                use = modules)
144
145    #
146    # Build the RAP utility.
147    #
148    bld.program(target = 'rtems-rap',
149                source = ['rtems-rapper.cpp'],
150                defines = defines,
151                includes = ['.'] + conf['includes'],
152                cflags = conf['cflags'] + conf['warningflags'],
153                cxxflags = conf['cxxflags'] + conf['warningflags'],
154                linkflags = conf['linkflags'],
155                use = modules)
156
157    #
158    # Build the EXE information tool.
159    #
160    bld.program(target = 'rtems-exeinfo',
161                source = ['rtems-exeinfo.cpp'],
162                defines = defines,
163                includes = ['.'] + conf['includes'],
164                cflags = conf['cflags'] + conf['warningflags'],
165                cxxflags = conf['cxxflags'] + conf['warningflags'],
166                linkflags = conf['linkflags'],
167                use = modules)
168
169    #
170    # Build the address to line tool.
171    #
172    bld.program(target = 'rtems-addr2line',
173                source = ['rtems-addr2line.cpp'],
174                defines = defines,
175                includes = ['.'] + conf['includes'],
176                cflags = conf['cflags'] + conf['warningflags'],
177                cxxflags = conf['cxxflags'] + conf['warningflags'],
178                linkflags = conf['linkflags'],
179                use = modules)
180
181def tags(ctx):
182    ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
Note: See TracBrowser for help on using the repository browser.