diff options
author | Fangrui Song <maskray@google.com> | 2021-08-22 16:29:16 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2021-08-22 16:29:16 -0700 |
commit | 5544862ebedb02e75b6b333c2d44ad9eb51ea36e (patch) | |
tree | b0232a628501d4028e0469ed1152df837d086a8d /elf/dl-tls_init_tp.c | |
parent | bca0f5cbc9257c13322b99e55235c4f21ba0bd82 (diff) | |
download | glibc-5544862ebedb02e75b6b333c2d44ad9eb51ea36e.tar.gz |
elf: Avoid nested functions in the loader (aarch64, x86-64) [BZ #27220]maskray/nesting
dynamic-link.h is included more than once in some elf/ files (rtld.c,
dl-conflict.c, dl-reloc.c, dl-reloc-static-pie.c) and uses GCC nested
functions. This harms readability and the nested functions usage
is the biggest obstacle prevents CC=clang (which doesn't support the
feature).
To un-nest elf_machine_rela, the key idea is to pass the variable in
the containing scope as an extra argument.
Stan Shebs implemented this in the google/grte/v5-2.27/master branch.
This patch squashes and cleans up the commits.
This patch just fixes aarch64 and x86-64: they use the `#ifndef NESTING`
branch to avoid nested functions. The `#ifdef NESTING` branch is used by
all other ports whose dl-machine.h files haven't been migrated.
For the time being, there is some duplicated code. `#ifdef NESTING`
dispatches can be removed in the future when all arches are migrated.
I can fix powerpc64, riscv, and other arches subsequently.
Migrating all ports at once is just too risky. Also, appreciate help
from arch maintainers.
Tested on {aarch64,x86_64}-linux-gnu (!NESTING) and
powerpc64le-linux-gnu (NESTING).
Diffstat (limited to 'elf/dl-tls_init_tp.c')
0 files changed, 0 insertions, 0 deletions