[PATCH] D74687: [LLD][ELF] - Linker script: do not fail parsing when "/DISCARD/" follows the fill expression.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 16 14:16:41 PST 2020
MaskRay added a comment.
Documentation: https://sourceware.org/binutils/docs-2.33.1/ld/Output-Section-Fill.html
https://bugs.llvm.org/show_bug.cgi?id=44903 is related to D64130 <https://reviews.llvm.org/D64130> . The problem is parsing ambiguity.
`llvm-mc -filetype=obj linkerscript/sections-padding.s -o a.o`
GNU ld's behavior is strange:
% ld.bfd -T =(printf 'SECTIONS { .mysec : { *(.mysec*) } =0x1100 }') a.o -o a
% readelf -Wx .mysec a
Hex dump of section '.mysec':
0x00000000 66110011 00110011 00110011 00110011 f...............
0x00000010 6690 f.
% ld.bfd -T =(printf 'SECTIONS { .mysec : { *(.mysec*) } =0x1100+2+3 }') a.o -o a
% readelf -Wx .mysec a
Hex dump of section '.mysec':
0x00000000 66000011 05000011 05000011 05000011 f...............
0x00000010 6690 f.
Do we have a more elegant fix:) ?
================
Comment at: lld/test/ELF/linkerscript/fill-with-discard.test:3
+# RUN: llvm-mc /dev/null -o %t.o -filetype=obj -triple=x86_64-unknown-linux
+# RUN: ld.lld -o %t --script %s %t.o
+
----------------
`-o /dev/null`
Consider merging this test into `sections-padding.s`
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74687/new/
https://reviews.llvm.org/D74687
More information about the llvm-commits
mailing list