diff options
author | Alan Modra <amodra@gmail.com> | 2021-08-11 10:09:02 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-08-11 10:09:02 +0930 |
commit | 303eea67cc303d076a2606a21d1bccd3d5caf713 (patch) | |
tree | aa2b30b5487d1a69000e4fc49ada2b86f7b28509 /ld | |
parent | 1b1676bffb1f20cf4a14df8348e8869ac52e05b3 (diff) | |
download | gdb-303eea67cc303d076a2606a21d1bccd3d5caf713.zip gdb-303eea67cc303d076a2606a21d1bccd3d5caf713.tar.gz gdb-303eea67cc303d076a2606a21d1bccd3d5caf713.tar.bz2 |
Revert "Re: ld script expression parsing"
This reverts commit 6afc66a7772e69ac3888b496e12d3c8f257c693c.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ldgram.y | 38 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/overlay.s | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/overlay.t | 6 |
3 files changed, 16 insertions, 32 deletions
diff --git a/ld/ldgram.y b/ld/ldgram.y index acfa274..dd911f4 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -96,7 +96,8 @@ static int error_index; %type <wildcard_list> section_name_list %type <flag_info_list> sect_flag_list %type <flag_info> sect_flags -%type <name> memspec_opt memspec_at_opt paren_script_name casesymlist +%type <name> memspec_opt casesymlist +%type <name> memspec_at_opt %type <cname> wildcard_name %type <wildcard> section_name_spec filename_spec wildcard_maybe_exclude %token <bigint> INT @@ -904,10 +905,6 @@ nocrossref_list: } ; -paren_script_name: - { ldlex_script (); } '(' NAME { ldlex_popstate (); } ')' - { $$ = $3; } - mustbe_exp: { ldlex_expression (); } exp { ldlex_popstate (); $$=$2;} @@ -972,14 +969,14 @@ exp : | SIZEOF_HEADERS { $$ = exp_nameop (SIZEOF_HEADERS,0); } - | ALIGNOF paren_script_name - { $$ = exp_nameop (ALIGNOF, $2); } - | SIZEOF paren_script_name - { $$ = exp_nameop (SIZEOF, $2); } - | ADDR paren_script_name - { $$ = exp_nameop (ADDR, $2); } - | LOADADDR paren_script_name - { $$ = exp_nameop (LOADADDR, $2); } + | ALIGNOF '(' NAME ')' + { $$ = exp_nameop (ALIGNOF,$3); } + | SIZEOF '(' NAME ')' + { $$ = exp_nameop (SIZEOF,$3); } + | ADDR '(' NAME ')' + { $$ = exp_nameop (ADDR,$3); } + | LOADADDR '(' NAME ')' + { $$ = exp_nameop (LOADADDR,$3); } | CONSTANT '(' NAME ')' { $$ = exp_nameop (CONSTANT,$3); } | ABSOLUTE '(' exp ')' @@ -994,16 +991,15 @@ exp : { $$ = exp_binop (DATA_SEGMENT_RELRO_END, $5, $3); } | DATA_SEGMENT_END '(' exp ')' { $$ = exp_unop (DATA_SEGMENT_END, $3); } - | SEGMENT_START { ldlex_script (); } '(' NAME - { ldlex_popstate (); } ',' exp ')' + | SEGMENT_START '(' NAME ',' exp ')' { /* The operands to the expression node are placed in the opposite order from the way in which they appear in the script as that allows us to reuse more code in fold_binary. */ $$ = exp_binop (SEGMENT_START, - $7, - exp_nameop (NAME, $4)); } + $5, + exp_nameop (NAME, $3)); } | BLOCK '(' exp ')' { $$ = exp_unop (ALIGN_K,$3); } | NAME @@ -1188,17 +1184,13 @@ overlay_section: | overlay_section NAME { + ldlex_script (); lang_enter_overlay_section ($2); } '{' statement_list_opt '}' - { ldlex_expression (); } + { ldlex_popstate (); ldlex_expression (); } phdr_opt fill_opt { - if (yychar == NAME) - { - yyclearin; - ldlex_backup (); - } ldlex_popstate (); lang_leave_overlay_section ($9, $8); } diff --git a/ld/testsuite/ld-elf/overlay.s b/ld/testsuite/ld-elf/overlay.s index 20d8f41..f153044 100644 --- a/ld/testsuite/ld-elf/overlay.s +++ b/ld/testsuite/ld-elf/overlay.s @@ -2,9 +2,5 @@ .space 0x10 .section .text2,"ax",%progbits .space 0x20 - .section .silly-name1,"ax",%progbits - .space 0x10 - .section .silly-name2,"ax",%progbits - .space 0x20 .text .space 0x30 diff --git a/ld/testsuite/ld-elf/overlay.t b/ld/testsuite/ld-elf/overlay.t index 2c50a6b..dd374bb 100644 --- a/ld/testsuite/ld-elf/overlay.t +++ b/ld/testsuite/ld-elf/overlay.t @@ -6,10 +6,6 @@ SECTIONS { .text1 {*(.text1)} .text2 {*(.text2)} - .silly-name1 { *(.silly-name1) } - .silly-name2 { *(.silly-name2) } - } + } /DISCARD/ : { *(.*) } - ASSERT(ADDR(.text1)==ADDR(.text2), "overlay error") - ASSERT(ADDR(.silly-name1)==ADDR(.silly-name2), "silly overlay error") } |