[PATCH v4 5/5] AArch64 variant PCS tests: remove RWX permissions on segments

Richard Earnshaw Richard.Earnshaw@arm.com
Tue Jun 10 16:51:45 GMT 2025


On 22/05/2025 15:35, Matthieu Longo wrote:
> The symbols of variant PCS functions require special handling. The variant PCS
> tests check both the relocation information and the markings in the symbol table.
> Those tests dump a lot of addresses, so a custom linker script, variant_pcs.ld
> was used to control reliably the addresses of the sections.
> 
> However, the linker script does not provide information enough to the linker to
> assess the right set of permisssions on segments (i.e. Read/Write/Execute).
> This insufficiency caused the linker to bundle all the sections in a same segment
> with the union of all the required permissions, i.e. RWX.
> A segment with such lax permissions constitutes a security hole, so the linker
> emits the following warning message:
>      <ELF file> has a LOAD segment with RWX permissions.
> This warning message is noisy in the tests, and has no reason to exist.
> 
> This issue can be addressed in two ways:
> - either by providing the right set of permissions on a section so that the
>    linker assigns them to a segment with compatible permissions.
> - or by providing alignment constraints so that the linker can move the sections
>    automatically to a new segment and set the right permission for non-executable
>    data.
> 
> The second option seems to be the preferred approach, even if not explicitly
> recommended. Examples of linker scripts for AArch64 are available at [1].
> This patch reorganizes the linker script to eliminate RWX segments by changing
> the order of the sections and their offset. The tests needed to be amended to
> match the new addresses.
> 
> [1]: https://developer.arm.com/documentation/dui0474/m/gnu-ld-script-support-in
>       -armlink/default-gnu-ld-scripts-used-by-armlink/default-ld-script-when
>       -building-an-executable?lang=en
> ---
>   ld/testsuite/ld-aarch64/variant_pcs-now.d    | 98 ++++++++++----------
>   ld/testsuite/ld-aarch64/variant_pcs-r.d      | 10 +-
>   ld/testsuite/ld-aarch64/variant_pcs-shared.d | 98 ++++++++++----------
>   ld/testsuite/ld-aarch64/variant_pcs.ld       | 32 ++++---
>   4 files changed, 124 insertions(+), 114 deletions(-)
> 
> diff --git a/ld/testsuite/ld-aarch64/variant_pcs-now.d b/ld/testsuite/ld-aarch64/variant_pcs-now.d
> index 50076322f7a..1add2bb6058 100644
> --- a/ld/testsuite/ld-aarch64/variant_pcs-now.d
> +++ b/ld/testsuite/ld-aarch64/variant_pcs-now.d
> @@ -4,65 +4,65 @@
>   #ld: -shared --hash-style=sysv -T variant_pcs.ld -z now
>   #readelf: -rsW
>   
> -Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
> +Relocation section '\.rela\.plt' at offset 0x[[:xdigit:]]+ contains 12 entries:
>       Offset             Info             Type               Symbol's Value  Symbol's Name \+ Addend
> -0000000000009020  0000000100000402 R_AARCH64_JUMP_SLOT    0000000000000000 f_base_global_default_undef \+ 0
> -0000000000009028  0000000200000402 R_AARCH64_JUMP_SLOT    0000000000000000 f_spec_global_default_undef \+ 0
> -0000000000009030  0000000400000402 R_AARCH64_JUMP_SLOT    0000000000008000 f_base_global_default_def \+ 0
> -0000000000009038  0000000500000402 R_AARCH64_JUMP_SLOT    0000000000008000 f_spec_global_default_def \+ 0
> -0000000000009040  0000000000000408 R_AARCH64_IRELATIVE                       8000
> -0000000000009048  0000000300000402 R_AARCH64_JUMP_SLOT    f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
> -0000000000009050  0000000000000408 R_AARCH64_IRELATIVE                       8000
> -0000000000009058  0000000600000402 R_AARCH64_JUMP_SLOT    f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
> -0000000000009060  0000000000000408 R_AARCH64_IRELATIVE                       8038
> -0000000000009068  0000000000000408 R_AARCH64_IRELATIVE                       8000
> -0000000000009070  0000000000000408 R_AARCH64_IRELATIVE                       8000
> -0000000000009078  0000000000000408 R_AARCH64_IRELATIVE                       8038
> +00000000000[[:xdigit:]]{2}020  0000000100000402 R_AARCH64_JUMP_SLOT    0000000000000000 f_base_global_default_undef \+ 0
> +00000000000[[:xdigit:]]{2}028  0000000200000402 R_AARCH64_JUMP_SLOT    0000000000000000 f_spec_global_default_undef \+ 0
> +00000000000[[:xdigit:]]{2}030  0000000400000402 R_AARCH64_JUMP_SLOT    0000000000011000 f_base_global_default_def \+ 0
> +00000000000[[:xdigit:]]{2}038  0000000500000402 R_AARCH64_JUMP_SLOT    0000000000011000 f_spec_global_default_def \+ 0
> +00000000000[[:xdigit:]]{2}040  0000000000000408 R_AARCH64_IRELATIVE                       11000
> +00000000000[[:xdigit:]]{2}048  0000000300000402 R_AARCH64_JUMP_SLOT    f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
> +00000000000[[:xdigit:]]{2}050  0000000000000408 R_AARCH64_IRELATIVE                       11000
> +00000000000[[:xdigit:]]{2}058  0000000600000402 R_AARCH64_JUMP_SLOT    f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
> +00000000000[[:xdigit:]]{2}060  0000000000000408 R_AARCH64_IRELATIVE                       11038
> +00000000000[[:xdigit:]]{2}068  0000000000000408 R_AARCH64_IRELATIVE                       11000
> +00000000000[[:xdigit:]]{2}070  0000000000000408 R_AARCH64_IRELATIVE                       11000
> +00000000000[[:xdigit:]]{2}078  0000000000000408 R_AARCH64_IRELATIVE                       11038
>   
>   Symbol table '\.dynsym' contains 7 entries:
>      Num:    Value          Size Type    Bind   Vis      Ndx Name
> -     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
> +     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND\s
>        1: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND f_base_global_default_undef
>        2: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]   UND f_spec_global_default_undef
> -     3: 0000000000008000     0 IFUNC   GLOBAL DEFAULT \[VARIANT_PCS\]     1 f_spec_global_default_ifunc
> -     4: 0000000000008000     0 NOTYPE  GLOBAL DEFAULT    1 f_base_global_default_def
> -     5: 0000000000008000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]     1 f_spec_global_default_def
> -     6: 0000000000008000     0 IFUNC   GLOBAL DEFAULT    1 f_base_global_default_ifunc
> +     3: 0000000000011000     0 IFUNC   GLOBAL DEFAULT \[VARIANT_PCS\]     6 f_spec_global_default_ifunc
> +     4: 0000000000011000     0 NOTYPE  GLOBAL DEFAULT    6 f_base_global_default_def
> +     5: 0000000000011000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]     6 f_spec_global_default_def
> +     6: 0000000000011000     0 IFUNC   GLOBAL DEFAULT    6 f_base_global_default_ifunc
>   
>   Symbol table '\.symtab' contains 35 entries:
>      Num:    Value          Size Type    Bind   Vis      Ndx Name
> -     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
> -     1: 0000000000008000     0 SECTION LOCAL  DEFAULT    1.*
> -     2: 0000000000008070     0 SECTION LOCAL  DEFAULT    2.*
> -     3: 0000000000009000     0 SECTION LOCAL  DEFAULT    3.*
> -     4: 0000000000009080     0 SECTION LOCAL  DEFAULT    4.*
> -     5: 0000000000011000     0 SECTION LOCAL  DEFAULT    5.*
> -     6: 0000000000011120     0 SECTION LOCAL  DEFAULT    6.*
> -     7: 00000000000111c8     0 SECTION LOCAL  DEFAULT    7.*
> -     8: 0000000000011270     0 SECTION LOCAL  DEFAULT    8.*
> +     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND\s
> +     1: 00000000000080e8     0 SECTION LOCAL  DEFAULT    1 \.hash
> +     2: 0000000000008118     0 SECTION LOCAL  DEFAULT    2 \.dynsym
> +     3: 00000000000081c0     0 SECTION LOCAL  DEFAULT    3 \.dynstr
> +     4: 0000000000009000     0 SECTION LOCAL  DEFAULT    4 \.rela\.plt
> +     5: 0000000000010000     0 SECTION LOCAL  DEFAULT    5 \.plt
> +     6: 0000000000011000     0 SECTION LOCAL  DEFAULT    6 \.text
> +     7: 0000000000020000     0 SECTION LOCAL  DEFAULT    7 \.dynamic
> +     8: 0000000000021000     0 SECTION LOCAL  DEFAULT    8 \.got
>        9: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS .*variant_pcs-1\.o
> -    10: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local
> -    11: 0000000000008000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local_ifunc
> -    12: 0000000000008000     0 IFUNC   LOCAL  DEFAULT    1 f_base_local_ifunc
> -    13: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT    1 f_base_local
> -    14: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT    1 \$x
> +    10: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_local
> +    11: 0000000000011000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_local_ifunc
> +    12: 0000000000011000     0 IFUNC   LOCAL  DEFAULT    6 f_base_local_ifunc
> +    13: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT    6 f_base_local
> +    14: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT    6 \$x
>       15: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS .*variant_pcs-2\.o
> -    16: 0000000000008038     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local2
> -    17: 0000000000008038     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local2_ifunc
> -    18: 0000000000008038     0 IFUNC   LOCAL  DEFAULT    1 f_base_local2_ifunc
> -    19: 0000000000008038     0 NOTYPE  LOCAL  DEFAULT    1 f_base_local2
> -    20: 0000000000008038     0 NOTYPE  LOCAL  DEFAULT    1 \$x
> -    21: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS
> -    22: 0000000000009080     0 OBJECT  LOCAL  DEFAULT  ABS _DYNAMIC
> -    23: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_global_hidden_def
> -    24: 0000000000008000     0 IFUNC   LOCAL  DEFAULT    1 f_base_global_hidden_ifunc
> -    25: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT    1 f_base_global_hidden_def
> -    26: 0000000000009000     0 OBJECT  LOCAL  DEFAULT  ABS _GLOBAL_OFFSET_TABLE_
> -    27: 0000000000008000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_global_hidden_ifunc
> -    28: 0000000000008070     0 NOTYPE  LOCAL  DEFAULT    2 \$x
> +    16: 0000000000011038     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_local2
> +    17: 0000000000011038     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_local2_ifunc
> +    18: 0000000000011038     0 IFUNC   LOCAL  DEFAULT    6 f_base_local2_ifunc
> +    19: 0000000000011038     0 NOTYPE  LOCAL  DEFAULT    6 f_base_local2
> +    20: 0000000000011038     0 NOTYPE  LOCAL  DEFAULT    6 \$x
> +    21: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS\s
> +    22: 0000000000020000     0 OBJECT  LOCAL  DEFAULT  ABS _DYNAMIC
> +    23: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_global_hidden_def
> +    24: 0000000000011000     0 IFUNC   LOCAL  DEFAULT    6 f_base_global_hidden_ifunc
> +    25: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT    6 f_base_global_hidden_def
> +    26: 0000000000021000     0 OBJECT  LOCAL  DEFAULT  ABS _GLOBAL_OFFSET_TABLE_
> +    27: 0000000000011000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_global_hidden_ifunc
> +    28: 0000000000010000     0 NOTYPE  LOCAL  DEFAULT    5 \$x
>       29: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND f_base_global_default_undef
>       30: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]   UND f_spec_global_default_undef
> -    31: 0000000000008000     0 IFUNC   GLOBAL DEFAULT \[VARIANT_PCS\]     1 f_spec_global_default_ifunc
> -    32: 0000000000008000     0 NOTYPE  GLOBAL DEFAULT    1 f_base_global_default_def
> -    33: 0000000000008000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]     1 f_spec_global_default_def
> -    34: 0000000000008000     0 IFUNC   GLOBAL DEFAULT    1 f_base_global_default_ifunc
> +    31: 0000000000011000     0 IFUNC   GLOBAL DEFAULT \[VARIANT_PCS\]     6 f_spec_global_default_ifunc
> +    32: 0000000000011000     0 NOTYPE  GLOBAL DEFAULT    6 f_base_global_default_def
> +    33: 0000000000011000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]     6 f_spec_global_default_def
> +    34: 0000000000011000     0 IFUNC   GLOBAL DEFAULT    6 f_base_global_default_ifunc
> diff --git a/ld/testsuite/ld-aarch64/variant_pcs-r.d b/ld/testsuite/ld-aarch64/variant_pcs-r.d
> index 2651a68c935..65849e125c9 100644
> --- a/ld/testsuite/ld-aarch64/variant_pcs-r.d
> +++ b/ld/testsuite/ld-aarch64/variant_pcs-r.d
> @@ -3,7 +3,7 @@
>   #ld: -r
>   #readelf: -rsW
>   
> -Relocation section '\.rela\.text' at offset .* contains 24 entries:
> +Relocation section '\.rela\.text' at offset 0x[[:xdigit:]]+ contains 24 entries:
>       Offset             Info             Type               Symbol's Value  Symbol's Name \+ Addend
>   0000000000000000  000000180000011b R_AARCH64_CALL26       0000000000000000 f_spec_global_default_def \+ 0
>   0000000000000004  000000110000011b R_AARCH64_CALL26       0000000000000000 f_spec_global_default_undef \+ 0
> @@ -32,10 +32,10 @@ Relocation section '\.rela\.text' at offset .* contains 24 entries:
>   
>   Symbol table '\.symtab' contains 26 entries:
>      Num:    Value          Size Type    Bind   Vis      Ndx Name
> -     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
> -     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1.*
> -     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3.*
> -     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4.*
> +     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND\s
> +     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 \.text
> +     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 \.data
> +     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 \.bss
>        4: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS .*variant_pcs-1\.o
>        5: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local
>        6: 0000000000000000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local_ifunc
> diff --git a/ld/testsuite/ld-aarch64/variant_pcs-shared.d b/ld/testsuite/ld-aarch64/variant_pcs-shared.d
> index e0217999fd1..3a39d8cc6a1 100644
> --- a/ld/testsuite/ld-aarch64/variant_pcs-shared.d
> +++ b/ld/testsuite/ld-aarch64/variant_pcs-shared.d
> @@ -4,65 +4,65 @@
>   #ld: -shared --hash-style=sysv -T variant_pcs.ld
>   #readelf: -rsW
>   
> -Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
> +Relocation section '\.rela\.plt' at offset 0x[[:xdigit:]]+ contains 12 entries:
>       Offset             Info             Type               Symbol's Value  Symbol's Name \+ Addend
> -0000000000009020  0000000100000402 R_AARCH64_JUMP_SLOT    0000000000000000 f_base_global_default_undef \+ 0
> -0000000000009028  0000000200000402 R_AARCH64_JUMP_SLOT    0000000000000000 f_spec_global_default_undef \+ 0
> -0000000000009030  0000000400000402 R_AARCH64_JUMP_SLOT    0000000000008000 f_base_global_default_def \+ 0
> -0000000000009038  0000000500000402 R_AARCH64_JUMP_SLOT    0000000000008000 f_spec_global_default_def \+ 0
> -0000000000009040  0000000000000408 R_AARCH64_IRELATIVE                       8000
> -0000000000009048  0000000300000402 R_AARCH64_JUMP_SLOT    f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
> -0000000000009050  0000000000000408 R_AARCH64_IRELATIVE                       8000
> -0000000000009058  0000000600000402 R_AARCH64_JUMP_SLOT    f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
> -0000000000009060  0000000000000408 R_AARCH64_IRELATIVE                       8038
> -0000000000009068  0000000000000408 R_AARCH64_IRELATIVE                       8000
> -0000000000009070  0000000000000408 R_AARCH64_IRELATIVE                       8000
> -0000000000009078  0000000000000408 R_AARCH64_IRELATIVE                       8038
> +00000000000[[:xdigit:]]{2}020  0000000100000402 R_AARCH64_JUMP_SLOT    0000000000000000 f_base_global_default_undef \+ 0
> +00000000000[[:xdigit:]]{2}028  0000000200000402 R_AARCH64_JUMP_SLOT    0000000000000000 f_spec_global_default_undef \+ 0
> +00000000000[[:xdigit:]]{2}030  0000000400000402 R_AARCH64_JUMP_SLOT    0000000000011000 f_base_global_default_def \+ 0
> +00000000000[[:xdigit:]]{2}038  0000000500000402 R_AARCH64_JUMP_SLOT    0000000000011000 f_spec_global_default_def \+ 0
> +00000000000[[:xdigit:]]{2}040  0000000000000408 R_AARCH64_IRELATIVE                       11000
> +00000000000[[:xdigit:]]{2}048  0000000300000402 R_AARCH64_JUMP_SLOT    f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
> +00000000000[[:xdigit:]]{2}050  0000000000000408 R_AARCH64_IRELATIVE                       11000
> +00000000000[[:xdigit:]]{2}058  0000000600000402 R_AARCH64_JUMP_SLOT    f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
> +00000000000[[:xdigit:]]{2}060  0000000000000408 R_AARCH64_IRELATIVE                       11038
> +00000000000[[:xdigit:]]{2}068  0000000000000408 R_AARCH64_IRELATIVE                       11000
> +00000000000[[:xdigit:]]{2}070  0000000000000408 R_AARCH64_IRELATIVE                       11000
> +00000000000[[:xdigit:]]{2}078  0000000000000408 R_AARCH64_IRELATIVE                       11038
>   
>   Symbol table '\.dynsym' contains 7 entries:
>      Num:    Value          Size Type    Bind   Vis      Ndx Name
> -     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
> +     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND\s
>        1: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND f_base_global_default_undef
>        2: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]   UND f_spec_global_default_undef
> -     3: 0000000000008000     0 IFUNC   GLOBAL DEFAULT \[VARIANT_PCS\]     1 f_spec_global_default_ifunc
> -     4: 0000000000008000     0 NOTYPE  GLOBAL DEFAULT    1 f_base_global_default_def
> -     5: 0000000000008000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]     1 f_spec_global_default_def
> -     6: 0000000000008000     0 IFUNC   GLOBAL DEFAULT    1 f_base_global_default_ifunc
> +     3: 0000000000011000     0 IFUNC   GLOBAL DEFAULT \[VARIANT_PCS\]     6 f_spec_global_default_ifunc
> +     4: 0000000000011000     0 NOTYPE  GLOBAL DEFAULT    6 f_base_global_default_def
> +     5: 0000000000011000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]     6 f_spec_global_default_def
> +     6: 0000000000011000     0 IFUNC   GLOBAL DEFAULT    6 f_base_global_default_ifunc
>   
>   Symbol table '\.symtab' contains 35 entries:
>      Num:    Value          Size Type    Bind   Vis      Ndx Name
> -     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
> -     1: 0000000000008000     0 SECTION LOCAL  DEFAULT    1.*
> -     2: 0000000000008070     0 SECTION LOCAL  DEFAULT    2.*
> -     3: 0000000000009000     0 SECTION LOCAL  DEFAULT    3.*
> -     4: 0000000000009080     0 SECTION LOCAL  DEFAULT    4.*
> -     5: 0000000000011000     0 SECTION LOCAL  DEFAULT    5.*
> -     6: 0000000000011120     0 SECTION LOCAL  DEFAULT    6.*
> -     7: 00000000000111c8     0 SECTION LOCAL  DEFAULT    7.*
> -     8: 0000000000011270     0 SECTION LOCAL  DEFAULT    8.*
> +     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND\s
> +     1: 00000000000080e8     0 SECTION LOCAL  DEFAULT    1 \.hash
> +     2: 0000000000008118     0 SECTION LOCAL  DEFAULT    2 \.dynsym
> +     3: 00000000000081c0     0 SECTION LOCAL  DEFAULT    3 \.dynstr
> +     4: 0000000000009000     0 SECTION LOCAL  DEFAULT    4 \.rela\.plt
> +     5: 0000000000010000     0 SECTION LOCAL  DEFAULT    5 \.plt
> +     6: 0000000000011000     0 SECTION LOCAL  DEFAULT    6 \.text
> +     7: 0000000000020000     0 SECTION LOCAL  DEFAULT    7 \.dynamic
> +     8: 0000000000021000     0 SECTION LOCAL  DEFAULT    8 \.got
>        9: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS .*variant_pcs-1\.o
> -    10: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local
> -    11: 0000000000008000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local_ifunc
> -    12: 0000000000008000     0 IFUNC   LOCAL  DEFAULT    1 f_base_local_ifunc
> -    13: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT    1 f_base_local
> -    14: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT    1 \$x
> +    10: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_local
> +    11: 0000000000011000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_local_ifunc
> +    12: 0000000000011000     0 IFUNC   LOCAL  DEFAULT    6 f_base_local_ifunc
> +    13: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT    6 f_base_local
> +    14: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT    6 \$x
>       15: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS .*variant_pcs-2\.o
> -    16: 0000000000008038     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local2
> -    17: 0000000000008038     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_local2_ifunc
> -    18: 0000000000008038     0 IFUNC   LOCAL  DEFAULT    1 f_base_local2_ifunc
> -    19: 0000000000008038     0 NOTYPE  LOCAL  DEFAULT    1 f_base_local2
> -    20: 0000000000008038     0 NOTYPE  LOCAL  DEFAULT    1 \$x
> -    21: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS
> -    22: 0000000000009080     0 OBJECT  LOCAL  DEFAULT  ABS _DYNAMIC
> -    23: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_global_hidden_def
> -    24: 0000000000008000     0 IFUNC   LOCAL  DEFAULT    1 f_base_global_hidden_ifunc
> -    25: 0000000000008000     0 NOTYPE  LOCAL  DEFAULT    1 f_base_global_hidden_def
> -    26: 0000000000009000     0 OBJECT  LOCAL  DEFAULT  ABS _GLOBAL_OFFSET_TABLE_
> -    27: 0000000000008000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     1 f_spec_global_hidden_ifunc
> -    28: 0000000000008070     0 NOTYPE  LOCAL  DEFAULT    2 \$x
> +    16: 0000000000011038     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_local2
> +    17: 0000000000011038     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_local2_ifunc
> +    18: 0000000000011038     0 IFUNC   LOCAL  DEFAULT    6 f_base_local2_ifunc
> +    19: 0000000000011038     0 NOTYPE  LOCAL  DEFAULT    6 f_base_local2
> +    20: 0000000000011038     0 NOTYPE  LOCAL  DEFAULT    6 \$x
> +    21: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS\s
> +    22: 0000000000020000     0 OBJECT  LOCAL  DEFAULT  ABS _DYNAMIC
> +    23: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_global_hidden_def
> +    24: 0000000000011000     0 IFUNC   LOCAL  DEFAULT    6 f_base_global_hidden_ifunc
> +    25: 0000000000011000     0 NOTYPE  LOCAL  DEFAULT    6 f_base_global_hidden_def
> +    26: 0000000000021000     0 OBJECT  LOCAL  DEFAULT  ABS _GLOBAL_OFFSET_TABLE_
> +    27: 0000000000011000     0 IFUNC   LOCAL  DEFAULT \[VARIANT_PCS\]     6 f_spec_global_hidden_ifunc
> +    28: 0000000000010000     0 NOTYPE  LOCAL  DEFAULT    5 \$x
>       29: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND f_base_global_default_undef
>       30: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]   UND f_spec_global_default_undef
> -    31: 0000000000008000     0 IFUNC   GLOBAL DEFAULT \[VARIANT_PCS\]     1 f_spec_global_default_ifunc
> -    32: 0000000000008000     0 NOTYPE  GLOBAL DEFAULT    1 f_base_global_default_def
> -    33: 0000000000008000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]     1 f_spec_global_default_def
> -    34: 0000000000008000     0 IFUNC   GLOBAL DEFAULT    1 f_base_global_default_ifunc
> +    31: 0000000000011000     0 IFUNC   GLOBAL DEFAULT \[VARIANT_PCS\]     6 f_spec_global_default_ifunc
> +    32: 0000000000011000     0 NOTYPE  GLOBAL DEFAULT    6 f_base_global_default_def
> +    33: 0000000000011000     0 NOTYPE  GLOBAL DEFAULT \[VARIANT_PCS\]     6 f_spec_global_default_def
> +    34: 0000000000011000     0 IFUNC   GLOBAL DEFAULT    6 f_base_global_default_ifunc
> diff --git a/ld/testsuite/ld-aarch64/variant_pcs.ld b/ld/testsuite/ld-aarch64/variant_pcs.ld
> index 0f515324814..a4c551b4562 100644
> --- a/ld/testsuite/ld-aarch64/variant_pcs.ld
> +++ b/ld/testsuite/ld-aarch64/variant_pcs.ld
> @@ -3,21 +3,31 @@ OUTPUT_ARCH(aarch64)
>   ENTRY(_start)
>   SECTIONS
>   {
> -  /* Read-only sections, merged into text segment: */
> -  PROVIDE (__executable_start = 0x8000); . = 0x8000;
> +  PROVIDE(__executable_start = 0x8000);
> +  . = SEGMENT_START("text-segment", 0x8000) + SIZEOF_HEADERS;
> +  /* Start of the executable code region.  */
> +  .hash              : { *(.hash) }
> +  .gnu.hash          : { *(.gnu.hash) }
> +  .dynsym            : { *(.dynsym) }
> +  .dynstr            : { *(.dynstr) }
> +  . = 0x9000;
> +  .rela.plt       : { *(.rela.plt) *(.rela.iplt) }
> +  . = 0x10000;
> +  .plt            : { *(.plt) }
> +  . = 0x11000;
>     .text           :
>     {
>       *(.before)
>       *(.text)
>       *(.after)
> -  } =0
> -  . = 0x9000;
> +  }
> +
> +  /* Start of the Read Write Data region.  */
> +  . = ALIGN (CONSTANT (MAXPAGESIZE));
> +  .dynamic        : { *(.dynamic) }
> +  . = ALIGN(4K);
>     .got            : { *(.got) *(.got.plt)}
> -  . = 0x10000;
> -  .rela.dyn       : { *(.rela.ifunc) }
> -  . = 0x11000;
> -  .rela.plt       : { *(.rela.plt) *(.rela.iplt) }
> -  . = 0x12340000;
> -  .far : { *(.far) }
> -  .ARM.attributes 0 : { *(.ARM.attributes) }
> +
> +  /* Start of the metadata region.  */
> +  .ARM.attributes 0 : { KEEP (*(.ARM.atttributes)) }
>   }

As with the other patches, re-introduces the typo.

Otherwise OK

R.


More information about the Binutils mailing list