From b3b9f8d3e99cf46c2f85445cc5189db4c4f47407 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Fri, 5 Jan 2018 22:41:55 +0000 Subject: [PATCH] ld: In map file use '=' in PROVIDE statements Currently when recording a PROVIDE statement in a linker map file we display something like: PROVIDE (SYMBOL, VALUE) However, in a linker script we write these statements like this: PROVIDE (SYMBOL = VALUE); This commit changes the output in the map file to be closer to linker script format, the map file now contains: PROVIDE (SYMBOL = VALUE) The ';' is still missing from the end, but map files are not intended to be valid linker script input, so adding the ';' just seems like clutter. ld/ChangeLog: * ldexp.c (exp_print_tree): Use '=' instead of ',' when printing PROVIDE statements. * testsuite/ld-scripts/provide-4.map: Update expected output. * testsuite/ld-scripts/provide-5.map: Likewise. --- ld/ChangeLog | 7 +++++++ ld/ldexp.c | 2 +- ld/testsuite/ld-scripts/provide-4-map.d | 12 ++++++------ ld/testsuite/ld-scripts/provide-5-map.d | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index c5085b179b..1357b89175 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2018-01-11 Andrew Burgess + + * ldexp.c (exp_print_tree): Use '=' instead of ',' when printing + PROVIDE statements. + * testsuite/ld-scripts/provide-4.map: Update expected output. + * testsuite/ld-scripts/provide-5.map: Likewise. + 2018-01-11 H.J. Lu PR ld/22696 diff --git a/ld/ldexp.c b/ld/ldexp.c index 9fbc892e4b..800c7f8085 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -1423,7 +1423,7 @@ exp_print_tree (etree_type *tree) break; case etree_provide: case etree_provided: - fprintf (config.map_file, "PROVIDE (%s, ", tree->assign.dst); + fprintf (config.map_file, "PROVIDE (%s = ", tree->assign.dst); exp_print_tree (tree->assign.src); fputc (')', config.map_file); break; diff --git a/ld/testsuite/ld-scripts/provide-4-map.d b/ld/testsuite/ld-scripts/provide-4-map.d index 189d1d04bc..6ef936c859 100644 --- a/ld/testsuite/ld-scripts/provide-4-map.d +++ b/ld/testsuite/ld-scripts/provide-4-map.d @@ -1,13 +1,13 @@ #... Linker script and memory map #... - \[!provide\] +PROVIDE \(foo, 0x1\) - \[!provide\] +PROVIDE \(bar, 0x2\) - 0x0+3 +PROVIDE \(baz, 0x3\) + \[!provide\] +PROVIDE \(foo = 0x1\) + \[!provide\] +PROVIDE \(bar = 0x2\) + 0x0+3 +PROVIDE \(baz = 0x3\) #... 0x0+2000 +foo - \[!provide\] +PROVIDE \(loc1, ALIGN \(\., 0x10\)\) - 0x0+2010 +PROVIDE \(loc2, ALIGN \(\., 0x10\)\) - \[!provide\] +PROVIDE \(loc3, \(loc1 \+ 0x20\)\) + \[!provide\] +PROVIDE \(loc1 = ALIGN \(\., 0x10\)\) + 0x0+2010 +PROVIDE \(loc2 = ALIGN \(\., 0x10\)\) + \[!provide\] +PROVIDE \(loc3 = \(loc1 \+ 0x20\)\) 0x0+2030 +loc4 = \(loc2 \+ 0x20\) #... diff --git a/ld/testsuite/ld-scripts/provide-5-map.d b/ld/testsuite/ld-scripts/provide-5-map.d index a75e4aa73c..78b0bcbbdd 100644 --- a/ld/testsuite/ld-scripts/provide-5-map.d +++ b/ld/testsuite/ld-scripts/provide-5-map.d @@ -2,5 +2,5 @@ Linker script and memory map #... 0x0+10 +foo = 0x10 - \[!provide\] +PROVIDE \(foo, bar\) + \[!provide\] +PROVIDE \(foo = bar\) #... -- 2.34.1