Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 1 | From 93c51144c3f664d4e9709da75a1d0fa00ea0fe95 Mon Sep 17 00:00:00 2001 |
| 2 | From: Mark Wielaard <mark@klomp.org> |
| 3 | Date: Sun, 12 Feb 2017 21:51:34 +0100 |
| 4 | Subject: [PATCH] libasm: Fix one GCC7 -Wformat-truncation=2 warning. |
| 5 | |
| 6 | Make sure that if we have really lots of labels the tempsym doesn't get |
| 7 | truncated because it is too small to hold the whole name. |
| 8 | |
| 9 | This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed |
| 10 | out by enabling this warning because there are currently some issues |
| 11 | with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448 |
| 12 | |
| 13 | Signed-off-by: Mark Wielaard <mark@klomp.org> |
| 14 | |
| 15 | Upstream-Status: Backport (https://sourceware.org/git/?p=elfutils.git;a=commit;h=93c51144c3f664d4e9709da75a1d0fa00ea0fe95) |
| 16 | Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> |
| 17 | |
| 18 | --- |
| 19 | libasm/ChangeLog | 6 +++++- |
| 20 | libasm/asm_newsym.c | 6 ++++-- |
| 21 | 2 files changed, 9 insertions(+), 3 deletions(-) |
| 22 | |
| 23 | Index: elfutils-0.168/libasm/asm_newsym.c |
| 24 | =================================================================== |
| 25 | --- elfutils-0.168.orig/libasm/asm_newsym.c |
| 26 | +++ elfutils-0.168/libasm/asm_newsym.c |
| 27 | @@ -1,5 +1,5 @@ |
| 28 | /* Define new symbol for current position in given section. |
| 29 | - Copyright (C) 2002, 2005, 2016 Red Hat, Inc. |
| 30 | + Copyright (C) 2002, 2005, 2016, 2017 Red Hat, Inc. |
| 31 | This file is part of elfutils. |
| 32 | Written by Ulrich Drepper <drepper@redhat.com>, 2002. |
| 33 | |
| 34 | @@ -44,7 +44,9 @@ AsmSym_t * |
| 35 | asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size, |
| 36 | int type, int binding) |
| 37 | { |
| 38 | -#define TEMPSYMLEN 10 |
| 39 | +/* We don't really expect labels with many digits, but in theory it could |
| 40 | + be 10 digits (plus ".L" and a zero terminator). */ |
| 41 | +#define TEMPSYMLEN 13 |
| 42 | char tempsym[TEMPSYMLEN]; |
| 43 | AsmSym_t *result; |
| 44 | |