diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-30 10:32:42 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-30 10:32:42 +0000 |
| commit | d04f2fc7a28c67d3016ba49c18437f6744b8998c (patch) | |
| tree | b6dfbb5e9b686bd9375a1ef7684fda2d4a1b76ba /ext/dl/lib | |
| parent | 28840d0c957d1df55f23002f29e54ca1cfc367b6 (diff) | |
merges r21177 and r21182 from trunk into ruby_1_9_1.
* ext/dl/test/test_base.rb: add x86_64-linux's case again. #932
--
* ext/dl/test/test_base.rb: add libc search logic.
this patch is written by Takehiro Kubo.
[ruby-core:20963] [Bug #932]
* ext/dl/dl.h: Add ",..." as the last argument.
this patch is written by Takehiro Kubo.
Bug #633 [ruby-core:19289]
* ext/dl/lib/dl/stack.rb: add add_padding() to calculate
alignment. this patch is written by Takehiro Kubo.
Bug #633 [ruby-core:19289]
* ext/dl/test/test_func.rb: atof()'s return value is double.
this patch is written by Takehiro Kubo.
Bug #633 [ruby-core:19289]
* ext/dl/test/test_import.rb:
- atof()'s return value is double.
- The types of qsort's second and third argument are size_t.
- fprintf()'s return value is int.
this patch is written by Takehiro Kubo.
Bug #633 [ruby-core:19289]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/lib')
| -rw-r--r-- | ext/dl/lib/dl/stack.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ext/dl/lib/dl/stack.rb b/ext/dl/lib/dl/stack.rb index 9daf08977..99a24bc1b 100644 --- a/ext/dl/lib/dl/stack.rb +++ b/ext/dl/lib/dl/stack.rb @@ -121,20 +121,26 @@ end @template = "" addr = 0 types.each{|t| - orig_addr = addr - addr = align(orig_addr, ALIGN_MAP[t]) - d = addr - orig_addr - if( d > 0 ) - @template << "x#{d}" - end + addr = add_padding(addr, ALIGN_MAP[t]) @template << PACK_MAP[t] addr += SIZE_MAP[t] } + addr = add_padding(addr, ALIGN_MAP[SIZEOF_VOIDP]) if( addr % SIZEOF_VOIDP == 0 ) @size = addr / SIZEOF_VOIDP else @size = (addr / SIZEOF_VOIDP) + 1 end end + + def add_padding(addr, align) + orig_addr = addr + addr = align(orig_addr, align) + d = addr - orig_addr + if( d > 0 ) + @template << "x#{d}" + end + addr + end end end |
