| Thread overview | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 05, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 Johannes Pfau <johannespfau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|ibuclaw@gdcproject.org |johannespfau@gmail.com --- Comment #1 from Johannes Pfau <johannespfau@gmail.com> --- Created attachment 64 --> http://bugzilla.gdcproject.org/attachment.cgi?id=64&action=edit Patch to add @attribute("naked") Can you test this patch please? (I was kinda surprised it didn't have an effect on x86 till I read that it's only supported on some architectures and not on x86...) @Iain Do you think we should include such system-specific attributes? Naked is also special in that dmd already has a 'generic' syntax for it, but it's tied to DMD-style inline asm. I also had to add a noclone attribute because naked automatically sets noclone. Do you think we should somehow hide 'noclone' from @attribute / user code? -- You are receiving this mail because: You are watching all bug changes. | |||
April 05, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 --- Comment #2 from Mike <slavo5150@yahoo.com> --- Thank you for addressing this. I had trouble applying this patch... ----------------------------------------------------- patching file gcc/d/d-lang.cc Hunk #2 FAILED at 58. 1 out of 3 hunks FAILED -- saving rejects to file gcc/d/d-lang.cc.rej ----------------------------------------------------- ... so I edited the d-lang.cc directly. GDC built without any problems using the latest 4.8.2 branch and these instructions on the wiki: http://wiki.dlang.org/Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler. However, when compiling my program, I get the following error: ----------------------------------------------------- <built-in>:0: internal compiler error: in register_scoped_attribute, at attribs.c:291 0x6325b4 register_scoped_attribute ../../gcc-4.8.2/gcc/attribs.c:291 0x632645 register_scoped_attributes(attribute_spec const*, char const*) ../../gcc-4.8.2/gcc/attribs.c:149 0x6329a8 init_attributes() ../../gcc-4.8.2/gcc/attribs.c:254 0x6331bc decl_attributes(tree_node**, tree_node*, int) ../../gcc-4.8.2/gcc/attribs.c:356 0x805dce add_builtin_function_common ../../gcc-4.8.2/gcc/langhooks.c:557 0x8065f3 add_builtin_function(char const*, tree_node*, int, built_in_class, char const*, tree_node*) ../../gcc-4.8.2/gcc/langhooks.c:577 0x650def do_build_builtin_fn ../../gcc-4.8.2/gcc/d/d-builtins.c:1055 0x657138 d_init_builtins() ../../gcc-4.8.2/gcc/builtins.def:195 0x664c66 d_backend_init() ../../gcc-4.8.2/gcc/d/d-builtins.c:1765 0x633ef4 d_init ../../gcc-4.8.2/gcc/d/d-lang.cc:257 0x8ee1d6 lang_dependent_init ../../gcc-4.8.2/gcc/toplev.c:1688 0x8ee1d6 do_compile ../../gcc-4.8.2/gcc/toplev.c:1850 ----------------------------------------------------- This occurs regardless of whether I use any attributes or not. -- You are receiving this mail because: You are watching all bug changes. | |||
April 05, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 --- Comment #3 from Johannes Pfau <johannespfau@gmail.com> --- strange, it applies just fine here. patch -p1 -i naked.patch tested on revision fdf0c614b8aef10b846689bef39030c482692b5f The error could be caused by failed/incorrect patching? -- You are receiving this mail because: You are watching all bug changes. | |||
April 05, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 --- Comment #4 from Mike <slavo5150@yahoo.com> --- I got the patch applied by downloading it from a different computer (had a line ending problem, I think). Nevertheless, the error is the same. I'm using the same revision (fdf0c614b8aef10b846689bef39030c482692b5f). My program builds fine without this patch. Have you tried this patch on one of the ARM cross-compilers? -- You are receiving this mail because: You are watching all bug changes. | |||
April 06, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 --- Comment #8 from Mike <slavo5150@yahoo.com> --- The latest patch seems to work well. /**** void OnReset() ****/ 8000024: b580 push {r7, lr} 8000026: af00 add r7, sp, #0 8000028: 2003 movs r0, #3 800002a: f000 f885 bl 8000138 800002e: f8df 2004 ldr.w r2, [pc, #4] ; 8000034 8000032: 4710 bx r2 /**** @attribute("naked") void OnReset() ****/ _D5start7OnResetFZv(): 8000024: 2003 movs r0, #3 8000026: f000 f883 bl 8000130 800002a: f8df 2004 ldr.w r2, [pc, #4] ; 8000030 800002e: 4710 bx r2 -- You are receiving this mail because: You are watching all bug changes. | |||
April 06, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 --- Comment #7 from Johannes Pfau <johannespfau@gmail.com> --- @Iain there's TARGET_ATTRIBUTE_TABLE but I don't know if/how I could access that? -- You are receiving this mail because: You are watching all bug changes. | |||
April 06, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 Johannes Pfau <johannespfau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #64 is|0 |1 obsolete| | --- Comment #6 from Johannes Pfau <johannespfau@gmail.com> --- Created attachment 65 --> http://bugzilla.gdcproject.org/attachment.cgi?id=65&action=edit Patch to add @attribute("naked") Updated patch. Naked is a 'target attribute' and needs to be handled in a special way. This should work now, @Iain can you review this? (AFAICS we can't access the list of available target attributes, so @attribute("naked") will always compile but you'll get a warning from the backend if naked is not supported on this architecture) -- You are receiving this mail because: You are watching all bug changes. | |||
April 06, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw@gdcproject.org --- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> --- If memory serves, there's a target hook which you can test if an attribute is handled by the backend. Use this instead of making naked a frontend attribute. -- You are receiving this mail because: You are watching all bug changes. | |||
April 06, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 --- Comment #9 from Iain Buclaw <ibuclaw@gdcproject.org> --- targetm.attribute_table - when we initialise our string table of attributes, load them in too. -- You are receiving this mail because: You are watching all bug changes. | |||
April 07, 2014 [Bug 114] Add support for the GCC 'naked' attribute | ||||
|---|---|---|---|---|
| ||||
Attachments:
| http://bugzilla.gdcproject.org/show_bug.cgi?id=114 --- Comment #10 from Iain Buclaw <ibuclaw@gdcproject.org> --- Created attachment 66 --> http://bugzilla.gdcproject.org/attachment.cgi?id=66&action=edit Patch to add target attributes into lookup table Added patch which describes what I was talking about. There used to be a TARGET_OPTION_VALID_ATTRIBUTE_P hook, but it seems to have been removed. -- You are receiving this mail because: You are watching all bug changes. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply