Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363104

Summary: Add gnu alignment support to obj.$$alloc
Product: [Technology] RTSC Reporter: Scott Gary <sg>
Component: CoreAssignee: Dave Russo <d-russo>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: karl
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: target:3.23

Description Scott Gary CLA 2011-11-07 17:01:46 EST
Currently gnu targets are built with ITarget.alignDirectiveSupported as the default of "false". This requires runtime fix ups of statically allocated buffers.  For example, SYS/BIOS's HeapBuf and Task use Memory.staticPlace, which calls obj.$$alloc().  Currently obj.$$alloc() only supports TI alignment, so alignment fix-up at runtime is needed for gnu. 

Request that obj.$$alloc() be enhanced to support alignment for gnu too.  There is no pragma comparable to TI's for this, but "attribute" can be used.  From the description of the "aligned" attribute in the gcc docs:

aligned (alignment)

This attribute specifies a minimum alignment for the variable or structure field,
measured in bytes. For example, the declaration:

int x __attribute__ ((aligned (16))) = 0;

causes the compiler to allocate the global variable x on a 16-byte boundary.
Comment 1 Dave Russo CLA 2011-11-07 18:20:09 EST
in xdc/services/intern/gen/Config.java we generate GNU attributes for section placement but not alignment.  It looks like we can simply add alignment in the same way.
Comment 2 Dave Russo CLA 2011-11-07 20:01:19 EST
"fixed" in xdc-y09 by adding GCC alignment directives when alignment is non-zero and GCC version is > 4.  See xdc/services/internal/gen/Config.java
Comment 3 Scott Gary CLA 2011-11-14 19:23:34 EST
Verified new attribute alignment directives generated with new gnu builds.  Looked at xdc/services/intern/gen/Config.java.
Comment 4 Dave Russo CLA 2011-11-24 13:10:25 EST
shipped in XDCtools 3.23 (http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/3_23_00_32)