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