gas-first-frag.xtensa 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From a35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1 Mon Sep 17 00:00:00 2001
  2. From: Max Filippov <jcmvbkbc@gmail.com>
  3. Date: Tue, 15 Apr 2014 19:12:46 +0400
  4. Subject: [PATCH] Fix alignment for the first section frag on xtensa
  5. Linking object files produced by partial linking with link-time
  6. relaxation enabled sometimes fails with the following error message:
  7. dangerous relocation: call8: misaligned call target: (.text.unlikely+0x63)
  8. This happens because no basic block with an XTENSA_PROP_ALIGN flag in the
  9. property table is generated for the first basic block, even if the
  10. .align directive is present.
  11. It was believed that the first frag alignment could be derived from the
  12. section alignment, but this was not implemented for the partial linking
  13. case: after partial linking first frag of a section may become not
  14. first, but no additional alignment frag is inserted before it.
  15. Basic block for such frag may be merged with previous basic block into
  16. extended basic block during relaxation pass losing its alignment
  17. restrictions.
  18. Fix this by always recording alignment for the first section frag.
  19. 2014-04-22 Max Filippov <jcmvbkbc@gmail.com>
  20. gas/
  21. * config/tc-xtensa.c (xtensa_handle_align): record alignment for the
  22. first section frag.
  23. ---
  24. Backported from: a35d5e823fdfe8a6e7e05ca8e3fb8bb5697335b1
  25. Changes to Changelog files and tests are dropped.
  26. gas/config/tc-xtensa.c | 1 -
  27. 1 file changed, 1 deletion(-)
  28. diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
  29. index ea23c96..58ace38 100644
  30. --- a/gas/config/tc-xtensa.c
  31. +++ b/gas/config/tc-xtensa.c
  32. @@ -5609,7 +5609,6 @@ xtensa_handle_align (fragS *fragP)
  33. && ! fragP->tc_frag_data.is_literal
  34. && (fragP->fr_type == rs_align
  35. || fragP->fr_type == rs_align_code)
  36. - && fragP->fr_address + fragP->fr_fix > 0
  37. && fragP->fr_offset > 0
  38. && now_seg != bss_section)
  39. {
  40. --
  41. 1.8.1.4