Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backported patch for [email protected] #958

Merged
merged 1 commit into from
Nov 17, 2024
Merged

Conversation

ZhongRuoyu
Copy link
Member

@ZhongRuoyu ZhongRuoyu commented Nov 16, 2024

This patch is a backport of 1. Along with 2 (backport of 3), it allows [email protected] to be built with the latest GNU ld.

Without this patch, build fails with:

Build error
gcc-11   -nostdlib -nostartfiles -shared -o /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/ld.so			\
    -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs 	\
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os -Wl,--version-script=/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/ld.map		\
    -Wl,-soname=ld-linux-aarch64.so.1			\
    -Wl,-defsym=_begin=0
/usr/bin/ld: /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: relocation R_AARCH64_ABS32 against `a local symbol' can not be used when making a shared object
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: in function `do_lookup_x':
dl-lookup.c:(.text+0x7ff0): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `free' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
dl-lookup.c:(.text+0x8188): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `free' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: in function `_dl_relocate_object':
(.text+0x9a90): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `_dl_runtime_profile' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
(.text+0xa0e8): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `_dl_runtime_resolve' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: in function `_dl_debug_initialize':
(.text+0xd550): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `_r_debug' defined in .bss section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
(.text+0xd56c): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `_r_debug' defined in .bss section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: in function `_dl_make_tlsdesc_dynamic':
(.text+0x14718): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `free' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
(.text+0x14754): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `free' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x170): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x178): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x180): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x188): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x190): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x198): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x1a0): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x1a8): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x1b0): dangerous relocation: unsupported relocation
/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x1b8): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:334: /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/ld.so] Error 1
make[2]: Leaving directory '/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/elf'
make[1]: *** [Makefile:233: elf/subdir_lib] Error 2
make[1]: Leaving directory '/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17'
make: *** [Makefile:9: all] Error 2

Needed for Homebrew/homebrew-core#197951.

Footnotes

  1. https://sourceware.org/git/?p=glibc.git;a=commit;h=43d06ed218fc8be58987bdfd00e21e5720f0b862

  2. https://git.centos.org/rpms/glibc/raw/ca483cc5b0e3e6a595a2c103755dee4d72f14f25/f/SOURCES/glibc-rh1500908.patch

  3. https://sourceware.org/git/?p=glibc.git;a=commit;h=e9177fba13549a8e2a6232f46080e5c6d3e467b1

This patch is a backport of [1]. Along with [2] (backport of [3]), it
allows [email protected] to be built with the latest GNU ld.

Without this patch, build fails with:

    gcc-11   -nostdlib -nostartfiles -shared -o /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/ld.so			\
        -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs 	\
        /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os -Wl,--version-script=/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/ld.map		\
        -Wl,-soname=ld-linux-aarch64.so.1			\
        -Wl,-defsym=_begin=0
    /usr/bin/ld: /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: relocation R_AARCH64_ABS32 against `a local symbol' can not be used when making a shared object
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: in function `do_lookup_x':
    dl-lookup.c:(.text+0x7ff0): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `free' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    dl-lookup.c:(.text+0x8188): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `free' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: in function `_dl_relocate_object':
    (.text+0x9a90): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `_dl_runtime_profile' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    (.text+0xa0e8): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `_dl_runtime_resolve' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: in function `_dl_debug_initialize':
    (.text+0xd550): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `_r_debug' defined in .bss section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    (.text+0xd56c): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `_r_debug' defined in .bss section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os: in function `_dl_make_tlsdesc_dynamic':
    (.text+0x14718): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `free' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail elfnn-aarch64.c:4852
    (.text+0x14754): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `free' defined in .text section in /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x170): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x178): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x180): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x188): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x190): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x198): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x1a0): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x1a8): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x1b0): dangerous relocation: unsupported relocation
    /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/librtld.os:(.data.rel.ro+0x1b8): dangerous relocation: unsupported relocation
    collect2: error: ld returned 1 exit status
    make[2]: *** [Makefile:334: /tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/build/elf/ld.so] Error 1
    make[2]: Leaving directory '/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17/elf'
    make[1]: *** [Makefile:233: elf/subdir_lib] Error 2
    make[1]: Leaving directory '/tmp/glibcA2.17-20241116-69269-z0jgov/glibc-2.17'
    make: *** [Makefile:9: all] Error 2

[1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=43d06ed218fc8be58987bdfd00e21e5720f0b862
[2]: https://git.centos.org/rpms/glibc/raw/ca483cc5b0e3e6a595a2c103755dee4d72f14f25/f/SOURCES/glibc-rh1500908.patch
[3]: https://sourceware.org/git/?p=glibc.git;a=commit;h=e9177fba13549a8e2a6232f46080e5c6d3e467b1

Signed-off-by: Ruoyu Zhong <[email protected]>
@ZhongRuoyu ZhongRuoyu requested a review from Bo98 November 16, 2024 22:56
@ZhongRuoyu ZhongRuoyu merged commit 41fdb9d into master Nov 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants