mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 04:00:07 +08:00
If the LMA for a segment is known, use it for matching sections to segments.
Use the LMA when adjusting for inter-section alignment padding.
This commit is contained in:
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
* elf.c (_bfd_elf_make_section_from_shdr): Set the LMA based on the
|
* elf.c (_bfd_elf_make_section_from_shdr): Set the LMA based on the
|
||||||
p_paddr of the segment that contains it.
|
p_paddr of the segment that contains it.
|
||||||
|
(copy_private_bfd_data): If the LMA for a segment is known, use it
|
||||||
|
for matching sections to segments.
|
||||||
|
(assign_file_positions_for_segments): Use the LMA when adjusting
|
||||||
|
for inter-section alignment padding.
|
||||||
|
|
||||||
2001-10-29 Kazu Hirata <kazu@hxi.com>
|
2001-10-29 Kazu Hirata <kazu@hxi.com>
|
||||||
|
|
||||||
|
23
bfd/elf.c
23
bfd/elf.c
@ -3262,10 +3262,10 @@ assign_file_positions_for_segments (abfd)
|
|||||||
|
|
||||||
/* The section may have artificial alignment forced by a
|
/* The section may have artificial alignment forced by a
|
||||||
link script. Notice this case by the gap between the
|
link script. Notice this case by the gap between the
|
||||||
cumulative phdr vma and the section's vma. */
|
cumulative phdr lma and the section's lma. */
|
||||||
if (p->p_vaddr + p->p_memsz < sec->vma)
|
if (p->p_paddr + p->p_memsz < sec->lma)
|
||||||
{
|
{
|
||||||
bfd_vma adjust = sec->vma - (p->p_vaddr + p->p_memsz);
|
bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
|
||||||
|
|
||||||
p->p_memsz += adjust;
|
p->p_memsz += adjust;
|
||||||
off += adjust;
|
off += adjust;
|
||||||
@ -3994,16 +3994,19 @@ copy_private_bfd_data (ibfd, obfd)
|
|||||||
|
|
||||||
/* Decide if the given section should be included in the given segment.
|
/* Decide if the given section should be included in the given segment.
|
||||||
A section will be included if:
|
A section will be included if:
|
||||||
1. It is within the address space of the segment,
|
1. It is within the address space of the segment -- we use the LMA
|
||||||
|
if that is set for the segment and the VMA otherwise,
|
||||||
2. It is an allocated segment,
|
2. It is an allocated segment,
|
||||||
3. There is an output section associated with it,
|
3. There is an output section associated with it,
|
||||||
4. The section has not already been allocated to a previous segment. */
|
4. The section has not already been allocated to a previous segment. */
|
||||||
#define INCLUDE_SECTION_IN_SEGMENT(section, segment) \
|
#define INCLUDE_SECTION_IN_SEGMENT(section, segment) \
|
||||||
((((IS_CONTAINED_BY_VMA (section, segment) \
|
(((((segment->p_paddr \
|
||||||
|| IS_SOLARIS_PT_INTERP (segment, section)) \
|
? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
|
||||||
&& (section->flags & SEC_ALLOC) != 0) \
|
: IS_CONTAINED_BY_VMA (section, segment)) \
|
||||||
|| IS_COREFILE_NOTE (segment, section)) \
|
|| IS_SOLARIS_PT_INTERP (segment, section)) \
|
||||||
&& section->output_section != NULL \
|
&& (section->flags & SEC_ALLOC) != 0) \
|
||||||
|
|| IS_COREFILE_NOTE (segment, section)) \
|
||||||
|
&& section->output_section != NULL \
|
||||||
&& section->segment_mark == false)
|
&& section->segment_mark == false)
|
||||||
|
|
||||||
/* Returns true iff seg1 starts after the end of seg2. */
|
/* Returns true iff seg1 starts after the end of seg2. */
|
||||||
|
Reference in New Issue
Block a user