27
27
28
28
int linker_script_merget::add_linker_script_definitions ()
29
29
{
30
- if (!cmdline.isset (' T' ) || elf_binaries. size ()!= 1 )
30
+ if (!cmdline.isset (' T' ))
31
31
return 0 ;
32
- const std::string &elf_file=*elf_binaries.begin ();
33
- const std::string &goto_file=*goto_binaries.begin ();
34
32
35
33
temporary_filet linker_def_outfile (" goto-cc-linker-info" , " .json" );
36
34
std::list<irep_idt> linker_defined_symbols;
37
35
int fail=
38
36
get_linker_script_data (
39
37
linker_defined_symbols,
40
38
compiler.symbol_table ,
41
- elf_file ,
39
+ elf_binary ,
42
40
linker_def_outfile ());
43
41
// ignore linker script parsing failures until the code is tested more widely
44
42
if (fail!=0 )
@@ -62,8 +60,10 @@ int linker_script_merget::add_linker_script_definitions()
62
60
63
61
symbol_tablet original_st;
64
62
goto_functionst original_gf;
65
- fail=read_goto_binary (goto_file, original_st, original_gf,
63
+
64
+ fail=read_goto_binary (goto_binary, original_st, original_gf,
66
65
get_message_handler ());
66
+
67
67
if (fail!=0 )
68
68
{
69
69
error () << " Unable to read goto binary for linker script merging" << eom;
@@ -100,26 +100,29 @@ int linker_script_merget::add_linker_script_definitions()
100
100
101
101
fail=pointerize_linker_defined_symbols (original_gf, original_st,
102
102
linker_values);
103
+
103
104
if (fail!=0 )
104
105
{
105
106
error () << " Could not pointerize all linker-defined expressions" << eom;
106
107
return fail;
107
108
}
108
109
109
- fail=compiler.write_object_file (goto_file, original_st, original_gf);
110
+ fail=compiler.write_object_file (goto_binary, original_st, original_gf);
111
+
110
112
if (fail!=0 )
111
113
error () << " Could not write linkerscript-augmented binary" << eom;
114
+
112
115
return fail;
113
116
}
114
117
115
118
linker_script_merget::linker_script_merget (
116
119
compilet &compiler,
117
- const std::list<std:: string> &elf_binaries ,
118
- const std::list<std:: string> &goto_binaries ,
120
+ const std::string &elf_binary ,
121
+ const std::string &goto_binary ,
119
122
const cmdlinet &cmdline,
120
123
message_handlert &message_handler) :
121
124
messaget(message_handler), compiler(compiler),
122
- elf_binaries(elf_binaries ), goto_binaries(goto_binaries ),
125
+ elf_binary(elf_binary ), goto_binary(goto_binary ),
123
126
cmdline(cmdline),
124
127
replacement_predicates(
125
128
{
0 commit comments