Fixed some bugs.
This commit is contained in:
parent
301dfc71d4
commit
ac00487023
14
ld/ldexp.c
14
ld/ldexp.c
|
@ -314,11 +314,23 @@ bfd_vma dot;
|
|||
}
|
||||
else {
|
||||
lang_output_section_statement_type *os =
|
||||
lang_output_section_statement_lookup( sdef->section->output_section->name);
|
||||
lang_output_section_statement_lookup(
|
||||
sdef->section->output_section->name);
|
||||
/* If the symbol is from a file which we are not
|
||||
relocating (-R) then return an absolute for its
|
||||
value */
|
||||
if (sdef->the_bfd->usrdata &&
|
||||
((lang_input_statement_type*)(sdef->the_bfd->usrdata))->just_syms_flag == true)
|
||||
{
|
||||
result = new_abs(sdef->value + sdef->section ?
|
||||
sdef->section->vma : 0);
|
||||
}
|
||||
else {
|
||||
result = new_rel(sdef->value, os);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.valid == false) {
|
||||
info("%F%S: undefined symbol `%s' referenced in expression.\n",
|
||||
tree->name.name);
|
||||
|
|
|
@ -151,7 +151,11 @@ command_line:
|
|||
;
|
||||
|
||||
command_line_option:
|
||||
SCRIPT ifile_list ENDSCRIPT
|
||||
SCRIPT
|
||||
{ ldgram_in_script = true; }
|
||||
ifile_list
|
||||
{ ldgram_in_script = false; }
|
||||
ENDSCRIPT
|
||||
| OPTION_v
|
||||
{
|
||||
ldversion();
|
||||
|
@ -318,7 +322,7 @@ ifile_p1:
|
|||
| high_level_library
|
||||
| low_level_library
|
||||
| floating_point_support
|
||||
| assignment end
|
||||
| statement_anywhere
|
||||
| TARGET_K '(' NAME ')'
|
||||
{ lang_add_target($3); }
|
||||
| SEARCH_DIR '(' filename ')'
|
||||
|
|
12
ld/ldlang.c
12
ld/ldlang.c
|
@ -1257,13 +1257,18 @@ DEFUN(size_input_section, (this_ptr, output_section_statement, fill, dot),
|
|||
}
|
||||
|
||||
/* Remember where in the output section this input section goes */
|
||||
|
||||
i->output_offset = dot - output_section_statement->bfd_section->vma;
|
||||
|
||||
/* Mark how big the output section must be to contain this now */
|
||||
dot += i->size;
|
||||
output_section_statement->bfd_section->size =
|
||||
dot - output_section_statement->bfd_section->vma;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i->output_offset = i->vma - output_section_statement->bfd_section->vma;
|
||||
}
|
||||
|
||||
return dot ;
|
||||
}
|
||||
|
@ -1718,8 +1723,10 @@ DEFUN_VOID(lang_common)
|
|||
com->section->alignment_power = power_of_two;
|
||||
}
|
||||
|
||||
/* Symbol stops being common and starts being global, but
|
||||
we remember that it was common once. */
|
||||
|
||||
com->flags = BSF_EXPORT | BSF_GLOBAL ;
|
||||
com->flags = BSF_EXPORT | BSF_GLOBAL | BSF_OLD_COMMON;
|
||||
|
||||
|
||||
if (write_map)
|
||||
|
@ -1731,7 +1738,6 @@ DEFUN_VOID(lang_common)
|
|||
}
|
||||
com->value = com->section->size;
|
||||
com->section->size += size;
|
||||
com->the_bfd = output_bfd;
|
||||
|
||||
|
||||
}
|
||||
|
|
58
ld/ldlex.l
58
ld/ldlex.l
|
@ -383,27 +383,6 @@ WHITE [ \t]+
|
|||
yylval.name[yyleng-2] = 0; /* Fry final quote */
|
||||
return NAME;
|
||||
}
|
||||
[0][0-7KM]* {
|
||||
|
||||
yylval.integer = number(yytext+1, 8);
|
||||
return INT;
|
||||
}
|
||||
|
||||
[0-9]+[KM]? {
|
||||
if (hex_mode == true || ldgram_in_defsym == true) {
|
||||
yylval.integer = number(yytext, 16);
|
||||
}
|
||||
else {
|
||||
yylval.integer = number(yytext, 10);
|
||||
}
|
||||
return INT;
|
||||
}
|
||||
|
||||
0[Xx][0-9a-fA-FKM]+ {
|
||||
|
||||
yylval.integer = number(yytext+2,16);
|
||||
return INT;
|
||||
}
|
||||
|
||||
"\#"{WHITE}*{FILENAMECHAR}+ {
|
||||
char *p = yytext+1;
|
||||
|
@ -439,17 +418,34 @@ WHITE [ \t]+
|
|||
int ch;
|
||||
keyword_type *k;
|
||||
|
||||
if (hex_mode) {
|
||||
ch = yytext[0];
|
||||
/* Then always read a number */
|
||||
while (isxdigit(ch)) {
|
||||
if ((hex_mode && isxdigit(yytext[0]))
|
||||
||
|
||||
(isdigit(yytext[0]) && (ldgram_in_expression == true || ldgram_in_script == true))) {
|
||||
char *start = yytext;
|
||||
unsigned int base = 10;
|
||||
if (hex_mode == true) base = 16;
|
||||
if (yytext[0] == '0') {
|
||||
base = 8;
|
||||
}
|
||||
ch = input();
|
||||
while (isxdigit(ch)
|
||||
|| ch == 'x'
|
||||
|| ch == 'X'
|
||||
|| ch == 'M'
|
||||
)
|
||||
{
|
||||
if (ch == 'x' || ch == 'X') {
|
||||
base = 16;
|
||||
start = yytext + yyleng;
|
||||
}
|
||||
else {
|
||||
yytext[yyleng++] = ch;
|
||||
}
|
||||
ch = input();
|
||||
}
|
||||
yytext[yyleng] = 0;
|
||||
unput(ch);
|
||||
|
||||
yylval.integer = number(yytext,16);
|
||||
yylval.integer = number(start, base);
|
||||
return INT;
|
||||
}
|
||||
|
||||
|
@ -482,10 +478,10 @@ WHITE [ \t]+
|
|||
if (isalpha(ch) || isdigit(ch) || ch == '.' || ch == '_' ) {
|
||||
yytext[yyleng++] = ch;
|
||||
}
|
||||
else if (ch == '=' && ldgram_in_script) {
|
||||
/* An = within a script is always taken to be an operator */
|
||||
break;
|
||||
}
|
||||
else if (ch == '=' && ldgram_in_script) {
|
||||
/* An = within a script is always taken to be an operator */
|
||||
break;
|
||||
}
|
||||
else if (ch == '+' || ch == '-' || ch == '/' || ch == '=') {
|
||||
if (ldgram_in_expression) break;
|
||||
yytext[yyleng++] = ch;
|
||||
|
|
Loading…
Reference in New Issue