diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2021-06-07 22:37:42 +0100 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2021-06-07 22:02:41 +0000 |
commit | c6e1f664254a8ae16e2e6d726c5159ecb7f27d3b (patch) | |
tree | 9121b35a2e3442dd560094024bcd82f3761adb39 | |
parent | 01747645a490fbe6e120657592954e0e84b4ba69 (diff) | |
download | elfutils-c6e1f664254a8ae16e2e6d726c5159ecb7f27d3b.tar.gz |
elflint: fix undefined 'buffer_left' reference
Link failure is reproducible on gcc-11.1.0 target:
```
$ autoreconf -i -f
$ ./configure --enable-maintainer-mode --disable-debuginfod \
--host=x86_64-pc-linux-gnu \
CFLAGS=-march=znver3 \
CXXFLAGS=-march=znver3 \
LDFLAGS=" "
$ make
CCLD elflint
ld: elflint.o: in function `check_attributes':
elflint.c:(.text+0xdcff): undefined reference to `buffer_left'
ld: elflint.c:(.text+0xe557): undefined reference to `buffer_left'
```
It happens due to possible external linkage of `buffer_left()`.
The change forces local linkage to always use local definition
(either inline or out-of-line).
Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/794601
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Fixes: e95d1fbb ("elflint: Pull left() in file scope")
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/elflint.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2c7be185..698b3c77 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2021-06-06 Sergei Trofimovich <slyfox@gentoo.org> + + * elflint.c (buffer_left): Mark as 'static' to avoid external linkage + failure. + 2021-05-12 Dmitry V. Levin <ldv@altlinux.org> * elfcompress.c (process_file): Return 1 instead of -1 in case of an diff --git a/src/elflint.c b/src/elflint.c index 85cc7833..35b40500 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -3434,7 +3434,7 @@ buffer_pos (Elf_Data *data, const unsigned char *p) return p - (const unsigned char *) data->d_buf; } -inline size_t +static inline size_t buffer_left (Elf_Data *data, const unsigned char *p) { return (const unsigned char *) data->d_buf + data->d_size - p; |