[LLVMdev] __used__ attributes in llvm-gcc's crtstuff.c

Woongsik Choi
Wed, 15 Dec 2010 06:06:29 -0000

I have submitted the patch in the following llvm-commits article
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20101213/113762.html

Best regards,
Woongsik Choi

2010/12/15 Anton Korobeynikov <anton at korobeynikov.info>

> Hello,
>
> > __used__ attributes in llvm-gcc/gcc/crtstuff.c.
> > GCC compiles crtstuff.c with -fno-toplevel-reorder option, which
ensures
> > that
> > unused static globals are not removed during optimization. However,
since
> > LLVM does not support that option,
> The problem is not that LLVM does not support this option. Though,
> this is indeed so due to certain reason.
> All the code is transformed into IR and transformations are performed
> on it. It will be really bad for the
> transformations to depend on some magic command line options. Even
> more, consider e.g. you tried
> to link two IR files - one with the code with -fno-toplevev-reorder
> and one - without. What should be done
> in such case?
>
> > I presume __used__ attribute is used instead.
> This is correct, because this is what in fact the code should do here.
>
> > My question is that why some global static variables, such as
> > __frame_dummy_init_array_entry
> > and __do_global_dtors_aux_fini_array_entry, are not given __used__
> > attributes.
> Just bug.
>
> > it caused no problem for me so far.
> > Would it be any problem in doing so?
> Please prepare the patch and submit to llvm-commit. Thanks!
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20101215/96f6fd3f/attachment.html>