x86: Use hehdr_start for __ehdr_start
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
Use hehdr_start for __ehdr_start instead of elf_link_hash_lookup.
* elfxx-x86.c (elf_x86_linker_defined): Use hehdr_start if name
is NULL.
(_bfd_x86_elf_link_check_relocs): Pass NULL as __ehdr_start to
elf_x86_linker_defined.
Comments
On Tue, Feb 4, 2025 at 1:09 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Use hehdr_start for __ehdr_start instead of elf_link_hash_lookup.
>
> * elfxx-x86.c (elf_x86_linker_defined): Use hehdr_start if name
> is NULL.
> (_bfd_x86_elf_link_check_relocs): Pass NULL as __ehdr_start to
> elf_x86_linker_defined.
>
> --
> H.J.
I am checking it in.
From 8d66149917e1fbab7fc0b29986038e0a5c5fd63e Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 4 Feb 2025 06:16:28 +0800
Subject: [PATCH] x86: Use hehdr_start for __ehdr_start
Use hehdr_start for __ehdr_start instead of elf_link_hash_lookup.
* elfxx-x86.c (elf_x86_linker_defined): Use hehdr_start if name
is NULL.
(_bfd_x86_elf_link_check_relocs): Pass NULL as __ehdr_start to
elf_x86_linker_defined.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
bfd/elfxx-x86.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
@@ -826,8 +826,12 @@ elf_x86_linker_defined (struct bfd_link_info *info, const char *name)
{
struct elf_link_hash_entry *h;
- h = elf_link_hash_lookup (elf_hash_table (info), name,
- false, false, false);
+ /* NULL indicates __ehdr_start. */
+ if (name == NULL)
+ h = elf_hash_table (info)->hehdr_start;
+ else
+ h = elf_link_hash_lookup (elf_hash_table (info), name,
+ false, false, false);
if (h == NULL)
return;
@@ -894,9 +898,10 @@ _bfd_x86_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info)
}
}
- /* "__ehdr_start" will be defined by linker as a hidden symbol
- later if it is referenced and not defined. */
- elf_x86_linker_defined (info, "__ehdr_start");
+ /* Pass NULL for __ehdr_start which will be defined by
+ linker as a hidden symbol later if it is referenced and
+ not defined. */
+ elf_x86_linker_defined (info, NULL);
if (bfd_link_executable (info))
{
--
2.48.1