ARM (and other) patches on github

Enrico Scholz <[email protected]> Sun, 13 Feb 2011 13:21:39 +0100
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Hi,

The ARM port of dietlibc suffers from several problems.

To solve them and other issues, I created a git respository[1] which
tracks my fixes and enhancements.  There is a 'master' and a 'rebase'
branch; both should have the same tree but 'master' is mergeable for
foreign repositories while 'rebase' contains the patches.


I solved there:

* ARM-EABI programs crash because some weak functions do not have a
  return[2]

* many syscalls do not exist for ARM-EABI anymore (e.g. mmap, time,
  getrlimit).  Other architectures are affected by this too and have
  their own replacement implementation.  These implementation are
  doing the same things but with different code.  I unified these
  implementations in [3].  This patch affects other architectures too.

* the mmap(2) implementation did not converted the offset and failed to
  set errno [4]

* recvfrom(2) + sendto(2) are wrongly classified as syscall with <5 args
  [5]

* 'swp' instruction is deprecated by modern ARM architectures and
  unavailable in Thumb2 [6].


I did various optimizations there:

* I added helper macros in [7]; '#ifdef <arm-architecture>' at several
  places is redundant and error prone

* on newer ARM architectures 'bx lr' is prefered over 'mov pc, lr' [8]

* never ARM architectures have an 'ldrd' instruction [9] which e.g. saves
  4 bytes per syscall instance when fetching arg 4 + 5

* ASM function declaration were inconsistent (e.g. unneeded .align
  statements) and .size annotations were missing in most cases.  I
  added FUNC_START + FUNC_END macros [10] which unify this

* ARM EABI calls syscalls always with 'swi 0'; this allows to save 4
  bytes per syscall by placing this into the unified syscall tail [11]


Repository contains lot of other enhancements (e.g. PAGESIZE is read from
ELF info now, default $PATH does not contain '.' anymore, first steps to
an automated testsuite) -- to much to list them all.  I suggest to browse
the repository at https://github.com/ensc/dietlibc/commits/rebase


Assume my signed-off on any of these patches and feel free to apply
them.



Enrico

Footnotes: 
[1]  https://github.com/ensc/dietlibc
     https://github.com/ensc/dietlibc/commits/rebase

[2]  https://github.com/ensc/dietlibc/commit/3584363db24b9e317098baa1e937cc3713efe15b

[3]  https://github.com/ensc/dietlibc/commit/cf06b814d058c53156794c914ca44d1ec260f456 (mmap)
     https://github.com/ensc/dietlibc/commit/101c925b270e6ae0684e0e97051e2c4413fb4b91 (getrlimit)
     https://github.com/ensc/dietlibc/commit/bd76252b52830577bbb979490b9351ddec4932fe (time)
     https://github.com/ensc/dietlibc/commit/1ebc7694715c214c58dc42b2f56c0d83b945372c (alarm)

[4]  https://github.com/ensc/dietlibc/commit/0306bc1e611664f4ed6d28a8916d7f8c43f445ca

[4]  https://github.com/ensc/dietlibc/commit/eae2d523911c0f7a16234de18eb486150eb6f4a9

[6]  https://github.com/ensc/dietlibc/commit/41f116ce418643bb75241ba980ef0648421af1d3

[7]  https://github.com/ensc/dietlibc/commit/1885bbb33af9ba12d00d587e2acaaed0a2af410a

[8]  https://github.com/ensc/dietlibc/commit/6a8ce3a4e70ec2524914b89026a7b62646244ce3

[9]  https://github.com/ensc/dietlibc/commit/caac4a75c0529937193a5bf4e61ed6339e19a78a

[10]  https://github.com/ensc/dietlibc/commit/d547436c1a2857719d711161321c4b9b1c8614fd
      https://github.com/ensc/dietlibc/commit/aa73683f271e57157c94b80dff6a0985619cda7e

[11]  https://github.com/ensc/dietlibc/commit/08e43332105b70d9d66f226fbfd7ee3f90c5eabb