WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: filetool.sh TC 10.1 trivial display bug: trailing slash in output  (Read 14800 times)

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: filetool.sh TC 10.1 trivial display bug: trailing slash in output
« Reply #15 on: August 14, 2019, 08:58:54 PM »
Hi jazzbiker
It seems everytime  Class  transitions between  Read Only Data (R or r)  and  Code (T or t)  a large block of padding gets
added. The column to the right of  Section  is the number of bytes between the current line and the previous line. You can
see that number spikes at each transition:
Code: [Select]
"tc@E310:~/rotdash$ nm -n -S -t d -a -f sysv rotdash"                                                   
                                                                                                       
                                                                                                       
"Symbols from rotdash:"                                                                                 
                                                                                                       
Name                                                       Value  Class    Type  Size      Section     
                                                                                                       
__gmon_start__                                                    w      NOTYPE              *UND*     
__libc_start_main@@GLIBC_2.0                                      U        FUNC              *UND*     
access@@GLIBC_2.0                                                 U        FUNC              *UND*     
chdir@@GLIBC_2.0                                                  U        FUNC              *UND*     
fflush@@GLIBC_2.0                                                 U        FUNC              *UND*     
printf@@GLIBC_2.0                                                 U        FUNC              *UND*     
usleep@@GLIBC_2.0                                                 U        FUNC              *UND*     
                                                               0  a        FILE              *ABS*     
.comment                                                       0  n                                     
crtstuff.c                                                     0  a        FILE              *ABS*     
crtstuff.c                                                     0  a        FILE              *ABS*     
init.c                                                         0  a        FILE              *ABS*     
rotdash.c                                                      0  a        FILE              *ABS*     
static-reloc.c                                                 0  a        FILE              *ABS*     
.interp                                                134513012  r                                     
.note.ABI-tag                                          134513032  r                                   20
.hash                                                  134513064  r                                   32
.gnu.hash                                              134513124  r                                   60
.dynsym                                                134513160  r                                   36
.dynstr                                                134513320  r                                  160
.gnu.version                                           134513430  r                                  110
.gnu.version_r                                         134513452  r                                   22
.rel.dyn                                               134513484  r                                   32
.rel.plt                                               134513500  r                                   16
.init                                                  134516736  t                                 3236
_init                                                  134516736  T        FUNC              .init     0
.plt                                                   134516768  t                                   32
.text                                                  134516880  t                                  112
main                                                   134516880  T        FUNC   140        .text     0
_start                                                 134517020  T        FUNC              .text   140
__x86.get_pc_thunk.bx                                  134517056  T        FUNC     4        .text    36
deregister_tm_clones                                   134517060  t        FUNC              .text     4
register_tm_clones                                     134517100  t        FUNC              .text    40
__do_global_dtors_aux                                  134517154  t        FUNC              .text    54
frame_dummy                                            134517184  t        FUNC              .text    30
__libc_csu_init                                        134517186  T        FUNC    79        .text     2
__libc_csu_fini                                        134517265  T        FUNC     1        .text    79
.fini                                                  134517268  t                                    3
_fini                                                  134517268  T        FUNC              .fini     0
.rodata                                                134520832  r                                 3564
_fp_hw                                                 134520832  R      OBJECT     4      .rodata     0
_IO_stdin_used                                         134520836  R      OBJECT     4      .rodata     4
.eh_frame                                              134520852  r                                   16
__FRAME_END__                                          134520852  r      OBJECT          .eh_frame     0
.init_array                                            134528772  t                                 7920
__frame_dummy_init_array_entry                         134528772  t      OBJECT        .init_array     0
__init_array_start                                     134528772  t      NOTYPE        .init_array     0
.fini_array                                            134528776  t                                    4
__do_global_dtors_aux_fini_array_entry                 134528776  t      OBJECT        .fini_array     0
__init_array_end                                       134528776  t      NOTYPE        .init_array     0
.dynamic                                               134528780  d                                    4
_DYNAMIC                                               134528780  d      OBJECT           .dynamic     0
.got                                                   134529020  d                                  240
.got.plt                                               134529024  d                                    4
_GLOBAL_OFFSET_TABLE_                                  134529024  d      OBJECT           .got.plt     0
.data                                                  134529060  d                                   36
__data_start                                           134529060  D      NOTYPE              .data     0
data_start                                             134529060  W      NOTYPE              .data     0
__dso_handle                                           134529064  D      OBJECT              .data     4
.bss                                                   134529068  b                                    4
__TMC_END__                                            134529068  D      OBJECT              .data     0
__bss_start                                            134529068  B      NOTYPE               .bss     0
_edata                                                 134529068  D      NOTYPE              .data     0
stdout@@GLIBC_2.0                                      134529068  B      OBJECT     4         .bss     0
completed.6835                                         134529072  b      OBJECT     1         .bss     4
_end                                                   134529076  B      NOTYPE               .bss     4

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: filetool.sh TC 10.1 trivial display bug: trailing slash in output
« Reply #16 on: August 15, 2019, 08:31:42 AM »
Hi, Rich!
This gaps grows along with the gcc version numbers. I tried the same test with gcc 5.4 and found this gaps in the same places, but being smaller ones.
Gcc is so powerfull and versatile, using it for tiny programs is like stirring the sugar in a tea with the drill )
Your case opened my eyes on tcc, thanks!

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 933
Re: filetool.sh TC 10.1 trivial display bug: trailing slash in output
« Reply #17 on: August 15, 2019, 10:59:17 PM »
Stirring sugar again
Code: [Select]
tc@box:/tmp$ gcc -c rotdash.c
tc@box:/tmp$ tcc -o rotdash rotdash.o
tc@box:/tmp$ sstrip rotdash
tc@box:/tmp$ ls -l rotdash*
-rwxr-xr-x    1 tc       staff         1280 Aug 16 08:54 rotdash
-rw-------    1 tc       staff          317 Aug 16 08:53 rotdash.c
-rw-r--r--    1 tc       staff         1156 Aug 16 08:54 rotdash.o

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: filetool.sh TC 10.1 trivial display bug: trailing slash in output
« Reply #18 on: August 17, 2019, 11:26:22 PM »
Hi jazzbiker
I did a little digging and I think I figured out some of the reasons for the larger executables. The default linker script changed.
From:
elf_i386.xc      # Combines and sorts relocatable sections.
To:
elf_i386.xce    # Combines and sorts relocatable sections with a separate code segment.

The formula used to compute gap sizes between code and data changed.

This is the result if you specify the  elf_i386.xbn  script (Mix code & data on same page; don't align data):
Code: [Select]
tc@E310:~/rotdash$ gcc  -march=i486 -mtune=i686 -Os -pipe -Wall rotdash.c -o rotdash -Wl,-T/usr/local/lib/ldscripts/elf_i386.xbn
tc@E310:~/rotdash$ ls -l rotdash
-rwxr-xr-x 1 tc staff 4704 Aug 18 01:48 rotdash
tc@E310:~/rotdash$ sstrip rotdash
tc@E310:~/rotdash$ ls -l rotdash
-rwxr-xr-x 1 tc staff 1656 Aug 18 01:48 rotdash
tc@E310:~/rotdash$

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: filetool.sh TC 10.1 trivial display bug: trailing slash in output
« Reply #19 on: August 18, 2019, 05:32:57 AM »
Interesting - there's something I was not aware of..

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: filetool.sh TC 10.1 trivial display bug: trailing slash in output
« Reply #20 on: March 15, 2020, 10:58:50 PM »
Hi Juanito and jazzbiker
I did a further writeup on executable sizes here if anyones interested:
http://forum.tinycorelinux.net/index.php/topic,23623.0.html

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: filetool.sh TC 10.1 trivial display bug: trailing slash in output
« Reply #21 on: March 16, 2020, 12:31:44 AM »
Thanks for that - I recompiled rotdash for CorePure between tc-10.x and tc-11.x - there was a small reduction in size, presumably because the original was from 4.x..