blob: d88f4ebd0c03107d93445ad1cd7c33470df58986 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From 93c51144c3f664d4e9709da75a1d0fa00ea0fe95 Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Sun, 12 Feb 2017 21:51:34 +0100
4Subject: [PATCH] libasm: Fix one GCC7 -Wformat-truncation=2 warning.
5
6Make sure that if we have really lots of labels the tempsym doesn't get
7truncated because it is too small to hold the whole name.
8
9This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed
10out by enabling this warning because there are currently some issues
11with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448
12
13Signed-off-by: Mark Wielaard <mark@klomp.org>
14
15Upstream-Status: Backport (https://sourceware.org/git/?p=elfutils.git;a=commit;h=93c51144c3f664d4e9709da75a1d0fa00ea0fe95)
16Signed-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
23Index: 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