[LLVMdev] Ambiguity in LLVM IR for global variable sections

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Oct 7 07:45:51 PDT 2013


On 15 September 2013 21:40, David Majnemer <david.majnemer at gmail.com> wrote:
> What do we expect from the following IR?
>
> @i2 = constant i32 30, section "INITDATA", align 4
> @i1 = global i32 0, section "INITDATA", align 4
>
> Currently, we stick them in one section that isn't writable which is
> problematic because @i1 is writable.  If you flip @i1 and @i2 you get one
> section which is writable.
>
> It seems like we should do one of the following:
> 1. Two sections, one writable + one that isn't
> 2. One section that is writable
> 3. Give an error
>
> Personally, I like #1 or #2.

Why not #3? It the frontend wants a constant section it can print @i1
differently. It if wants a writable section it can print @i2
differently.

Cheers,
Rafael



More information about the llvm-dev mailing list