1 /* Copyright (C) 2008 Tim Abbott <tabbott@mit.edu>,
2 * Anders Kaseorg <andersk@mit.edu>,
3 * Jeffrey Brian Arnold <jbarnold@mit.edu>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
20 #include "objcommon.h"
23 static void print_section(struct superbfd
*sbfd
, const char *fieldname
,
26 asection
*sect
= bfd_get_section_by_name(sbfd
->abfd
, sectname
);
28 struct supersect
*ss
= fetch_supersect(sbfd
, sect
);
29 printf("%s: %s\n", fieldname
, read_string(ss
, ss
->contents
.data
));
32 int main(int argc
, char *argv
[])
38 ibfd
= bfd_openr(argv
[1], NULL
);
42 assert(bfd_check_format_matches(ibfd
, bfd_object
, &matching
));
44 struct superbfd
*sbfd
= fetch_superbfd(ibfd
);
46 print_section(sbfd
, "Sysname", ".uts_sysname");
47 print_section(sbfd
, "Machine", ".uts_machine");
48 print_section(sbfd
, "Release", ".uts_release");
49 print_section(sbfd
, "Version", ".uts_version");