def align(sl):
	""" This is the core of the alignment logic
	sl is a list of symbols (same as for orderSymbolsList that should correspond
	to one section
	here is what we do:

	   Arch A           Arch B            Arch C          Arch D
	                                                    (symbol not
	                                                         present)
	+------------+  +-------------+  +--------------+  +-------------+
	| Pad before |  | Pad before  |  | Pad before   |  |  Pad before |
	+------------+  +-------------+  +--------------+  +-------------+
	+------------+  +-------------+  +--------------+  +-------------+
	| Symbol     |  |             |  |     Symbol   |  |             |
	|            |  |             |  |              |  |             |
	|            |  |   Symbol    |  +--------------+  |             |
	+------------+  |             |  +--------------+  | pad after   |
	+------------+  |             |  |              |  |             |
	|Pad after   |  |             |  |  pad after   |  |             |
	|            |  |             |  |              |  |             |
	|            |  |             |  |              |  |             |
	+------------+  +-------------+  +--------------+  +-------------+

	"pad before" automatically added by the linker to satisfy the alignment
	constraint we put on the symobl (we choose the largest alignment constaint
	of all referencing architectures. We need to add it by hand on each
	architecture that is not referencing the symbol, though.
	"pad after" is added by us so that the next symbol to be processed starts at
	the same address on each architecture
	"""
	address = 0

	for symbol in sl:
		padBefore = 0  # padding we'll need to add before that symbol
		# set the alignment for all referencing arch to the largest one
		alignment = symbol.setLargestAlignment()
		while ((address + padBefore) % alignment) != 0:
			padBefore += 1

		# Add padding "before" for architectures not referencing the symbol
		for arch in symbol.getArchitecturesNotReferencing():
			symbol.incrPaddingBefore(padBefore, arch)

		# Now get the largest symbol size among archs to compute paddign to put
		# after the symbol on
		largestSize = symbol.getLargetSizeVal()

		# Add some padding to referencing archs for which the size is smaller
		# than the largest one
		for arch in symbol.getArchitecturesReferencing():
			padAfter = largestSize - symbol.getSize(arch)
			symbol.incrPaddingAfter(padAfter, arch)

		# For the architecture not referencing the symbol, we should add padding
		# equals to the largest size
		for arch in symbol.getArchitecturesNotReferencing():
			symbol.incrPaddingAfter(largestSize, arch)

		# increment our "iterator" so we can compute the padding "before" to
		# add on the next symbol to process
		address += padBefore + largestSize

	return sl