[BACKPORT,FOR,4.14] libtraceevent: Fix build with binutils 2.35

Message ID c4629a12d4a2a21ff131624d3ef1d9f8b5fd64ad.1670954579.git.christophe.leroy@csgroup.eu
State New
Headers
Series [BACKPORT,FOR,4.14] libtraceevent: Fix build with binutils 2.35 |

Commit Message

Christophe Leroy Dec. 13, 2022, 6:03 p.m. UTC
  From: Ben Hutchings <ben@decadent.org.uk>

[upstream commit 39efdd94e314336f4acbac4c07e0f37bdc3bef71]

In binutils 2.35, 'nm -D' changed to show symbol versions along with
symbol names, with the usual @@ separator.  When generating
libtraceevent-dynamic-list we need just the names, so strip off the
version suffix if present.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Salvatore Bonaccorso <carnil@debian.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 tools/lib/traceevent/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Segher Boessenkool Dec. 13, 2022, 8:25 p.m. UTC | #1
On Tue, Dec 13, 2022 at 07:03:07PM +0100, Christophe Leroy wrote:
> In binutils 2.35, 'nm -D' changed to show symbol versions along with
> symbol names, with the usual @@ separator.

2.37 instead?  And --without-symbol-versions is there to restore the
old behaviour.  The script is parsing the output already so this patch
is simpler maybe, but :-)


Segher
  
Christophe Leroy Dec. 14, 2022, 3:33 p.m. UTC | #2
Le 13/12/2022 à 21:25, Segher Boessenkool a écrit :
> On Tue, Dec 13, 2022 at 07:03:07PM +0100, Christophe Leroy wrote:
>> In binutils 2.35, 'nm -D' changed to show symbol versions along with
>> symbol names, with the usual @@ separator.
> 
> 2.37 instead?  And --without-symbol-versions is there to restore the
> old behaviour.  The script is parsing the output already so this patch
> is simpler maybe, but :-)
> 

Do you mean that the original commit from Ben should have done it 
differently ?

My patch is only a backport of original commit 39efdd94e314 
("libtraceevent: Fix build with binutils 2.35") due to Makefile being at 
a different place in 4.14.

Christophe
  
Segher Boessenkool Dec. 14, 2022, 7:01 p.m. UTC | #3
On Wed, Dec 14, 2022 at 03:33:24PM +0000, Christophe Leroy wrote:
> Le 13/12/2022 à 21:25, Segher Boessenkool a écrit :
> > On Tue, Dec 13, 2022 at 07:03:07PM +0100, Christophe Leroy wrote:
> >> In binutils 2.35, 'nm -D' changed to show symbol versions along with
> >> symbol names, with the usual @@ separator.
> > 
> > 2.37 instead?  And --without-symbol-versions is there to restore the
> > old behaviour.  The script is parsing the output already so this patch
> > is simpler maybe, but :-)
> 
> Do you mean that the original commit from Ben should have done it 
> differently ?

Probably.

> My patch is only a backport of original commit 39efdd94e314 
> ("libtraceevent: Fix build with binutils 2.35") due to Makefile being at 
> a different place in 4.14.

<shrug>.  It's not such a great idea to spread misinformation further,
imo.  Maybe the mailing list archives will help dampen that already now.

Thanks,


Segher
  

Patch

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index a0ac01c647f5..2d6989f8a87c 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -263,7 +263,7 @@  define do_generate_dynamic_list_file
 	xargs echo "U w W" | tr 'w ' 'W\n' | sort -u | xargs echo`;\
 	if [ "$$symbol_type" = "U W" ];then				\
 		(echo '{';						\
-		$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
+		$(NM) -u -D $1 | awk 'NF>1 {sub("@.*", "", $$2); print "\t"$$2";"}' | sort -u;\
 		echo '};';						\
 		) > $2;							\
 	else								\