From 2fc767fcbdf14b7866721da767be372034bd4e4b Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 1 Aug 2011 11:27:13 +0000 Subject: [PATCH] PR ld/12974 * config/tc-arm.c (literal_pool): Add locs field. (add_to_lit_pool): Initialise the locs entry for the new literal. (s_ltorg): Generate a DWARF2 line number entry for each emitted literal pool entry. --- gas/ChangeLog | 8 ++++++++ gas/config/tc-arm.c | 21 +++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6af662a1b..8c0e298e9 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2011-08-01 Nick Clifton + + PR ld/12974 + * config/tc-arm.c (literal_pool): Add locs field. + (add_to_lit_pool): Initialise the locs entry for the new literal. + (s_ltorg): Generate a DWARF2 line number entry for each emitted + literal pool entry. + 2011-08-01 Tristan Gingold * write.c (write_relocs): Fix -Wshadow in DEBUG3 and DEBUG4. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 15923228b..b018b4f60 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -759,6 +759,9 @@ typedef struct literal_pool symbolS * symbol; segT section; subsegT sub_section; +#ifdef OBJ_ELF + struct dwarf2_line_info locs [MAX_LITERAL_POOL_SIZE]; +#endif struct literal_pool * next; } literal_pool; @@ -3074,6 +3077,14 @@ add_to_lit_pool (void) } pool->literals[entry] = inst.reloc.exp; +#ifdef OBJ_ELF + /* PR ld/12974: Record the location of the first source line to reference + this entry in the literal pool. If it turns out during linking that the + symbol does not exist we will be able to give an accurate line number for + the (first use of the) missing reference. */ + if (debug_type == DEBUG_DWARF2) + dwarf2_where (pool->locs + entry); +#endif pool->next_free_entry += 1; } @@ -3171,8 +3182,14 @@ s_ltorg (int ignored ATTRIBUTE_UNUSED) #endif for (entry = 0; entry < pool->next_free_entry; entry ++) - /* First output the expression in the instruction to the pool. */ - emit_expr (&(pool->literals[entry]), 4); /* .word */ + { +#ifdef OBJ_ELF + if (debug_type == DEBUG_DWARF2) + dwarf2_gen_line_info (frag_now_fix (), pool->locs + entry); +#endif + /* First output the expression in the instruction to the pool. */ + emit_expr (&(pool->literals[entry]), 4); /* .word */ + } /* Mark the pool as empty. */ pool->next_free_entry = 0; -- 2.11.4.GIT