[LLVMdev] Contants generation - proposal

Demikhovsky, Elena elena.demikhovsky at intel.com
Wed Jun 26 05:38:33 PDT 2013


All compilers do this, gcc, for example
#include <stdio.h>

const char A[] = {"Hello, world"};

int main() {
  printf("%s\n", A);
  return 0;
}

gcc hello.c -o hello

objdump --all hello | grep -w A
00000000004005d8 g     O .rodata        000000000000000d              A

-  Elena


-----Original Message-----
From: Tim Northover [mailto:t.p.northover at gmail.com] 
Sent: Wednesday, June 26, 2013 14:23
To: Demikhovsky, Elena
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] Contants generation - proposal

>> I think that the improved behavior for consts should be acceptable in the large model. But that's just me.

> By default, all constants should be in a special read-only section, and this section may be far from the text section.

Why should they? The only reason I can think of is to support execute-only pages, but isn't that the less common use-case? From what I could tell from a quick search (very non-thorough), none of the mainstream x86 operating systems enable it by default.

Cheers.

Tim.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the llvm-dev mailing list