Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Webassemly asm text parser/generator doesn't handle custom data section. #44993

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR46023
Status NEW
Importance P enhancement
Reported by Sam Clegg (sbc@chromium.org)
Reported on 2020-05-21 12:04:09 -0700
Last modified on 2020-05-21 12:51:13 -0700
Version trunk
Hardware PC Linux
CC aardappel@gmail.com, dschuff@google.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

Currently I can write the following llvm code and it will generate a working working object file:

@foo = global i32 42, section "mysection", align 4

However if I output to assembly I get:

$ llc --mtriple=wasm32 --asm-verbose=false test.ll -o -

.type foo,@object
  .section  mysection,"aw",@
  .globl  foo
  .p2align 2
foo:
  .int32  42
  .size foo, 4

Which the assembly reader rejects:

$ llvm-mc -triple=wasm32-unknown-unknown test.s
test.s:2:23: error: unknown section kind: mysection
  .section  mysection,"",@
Quuxplusone commented 4 years ago

I guess we need to somehow mark the section as data in the .s we output (we could add the .data prefix maybe?).

We we have to have some heuristic about detecting the sections types when reading .s input.