llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

"error: expected string in directive" on ARM

Open jcai19 opened this issue 7 years ago • 6 comments

Bugzilla Link 43759
Resolution FIXED
Resolved on Jan 27, 2020 15:41
Version trunk
OS All
CC @nickdesaulniers,@smithp35

Extended Description

$ cat foo.s .section ".foo", #alloc $ arm-linux-gnueabihf-gcc -c foo.s $ echo $? 0 $ ~/storage/llvm-project/build/release/bin/clang -target arm-linux-gnueabihf -c foo.s foo.s:1:18: error: expected string in directive .section ".foo", #alloc

jcai19 avatar Oct 22 '19 04:10 jcai19

Fixed linux upstream: https://git.kernel.org/linus/790756c7e0229dedc83bf058ac69633045b1000e

jcai19 avatar Jan 27 '20 23:01 jcai19

https://reviews.llvm.org/rG03de2f84fc4acf06c719cd007b5459c9d4d0a20c

nickdesaulniers avatar Oct 25 '19 20:10 nickdesaulniers

Ignore my last comment, I misinterpreted the test case. This is support for Solaris style switching.

.section "name"[, flags...]

It is also worth noting: https://reviews.llvm.org/D69296

Yes, and thanks for the posting the differential link here.

$ cat foo.s .section ".foo", #alloc $ arm-linux-gnueabihf-gcc -c foo.s $ echo $? 0 $ ~/storage/llvm-project/build/release/bin/clang -target arm-linux-gnueabihf -c foo.s foo.s:1:18: error: expected string in directive .section ".foo", #alloc

jcai19 avatar Oct 23 '19 04:10 jcai19

Ignore my last comment, I misinterpreted the test case. This is support for Solaris style switching.

.section "name"[, flags...]

It is also worth noting: https://reviews.llvm.org/D69296

smithp35 avatar Oct 22 '19 09:10 smithp35

Reassigning to MC as this is not ARM specific.

The .section directive described in: https://sourceware.org/binutils/docs/as/Section.html has the form: .section name [, "flags"[, @​type[,flag_specific_arguments]]] Where "flags" and "@type" are described as optional.

MC permits: .section name .section name , "flags" .section name , "flags", @​type but not: .section name , @​type

It looks like MC is missing the case where "flags" is optional but @​type is not.

Probably not a common occurrence as not setting the flags with a non-recognised section name results in a non SHF_ALLOC non-writeable, non-executable section which is usually not what is wanted, but still a difference in behaviour.

smithp35 avatar Oct 22 '19 08:10 smithp35

assigned to @jcai19

jcai19 avatar Oct 22 '19 04:10 jcai19