mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
3d9c8f6b3f
git commit 702d16713
broke expressions using CONSTANT(COMMONPAGESIZE)
in ALIGN or SUBALIGN of output section statements, because these
optional fields were evaluated at script parse time and the patch in
question delayed setting of config.commonpagesize. The right thing to
do is keep the tree representation of those fields for later
evaluation.
PR 23571
* ldlang.h (section_alignment): Make it an expression tree.
(subsection_alignment): Likewise.
* ldlang.c (topower): Delete.
(output_section_statement_newfunc): Adjust initialization.
(init_os): Evaluate section_alignment.
(lang_size_sections_1): Likewise.
(size_input_section): Evaluate subsection_alignment.
(lang_enter_output_section_statement): Don't evaluate here.
(lang_new_phdr): Use exp_get_vma rather than exp_get_value_int.
* ldexp.h (exp_get_value_int): Delete.
(exp_get_power): Declare.
* ldexp.c (exp_get_value_int): Delete.
(exp_get_power): New function.
* emultempl/pe.em (place_orphan): Build expression for section
alignment.
* emultempl/pep.em (place_orphan): Likewise.
* testsuite/ld-scripts/pr23571.d,
* testsuite/ld-scripts/pr23571.t: New test.
* testsuite/ld-scripts/align.exp: Run it.
11 lines
262 B
Makefile
11 lines
262 B
Makefile
#source: align2a.s
|
|
#ld: -T pr23571.t -z common-page-size=0x1000
|
|
#objdump: -h -w
|
|
|
|
.*: +file format .*
|
|
|
|
Sections:
|
|
Idx Name +Size +VMA +LMA +File off +Algn +Flags
|
|
+0 \.text +[0-9a-f]* +0+1000 +0+1000 .*
|
|
+1 \.data +[0-9a-f]* +0+2000 +0+2000 +[0-9a-f]* +2\*\*12 .*
|