This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gcc@gcc.gnu.org
- To: gcc at gcc dot gnu dot org
- Subject: gcc@gcc.gnu.org
- From: Frank Klemm <pfk at fuchs dot offl dot uni-jena dot de>
- Date: Sat, 25 Aug 2001 20:51:22 +0200
- >Received: (from pfk@localhost)by fuchs.offl.uni-jena.de (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id UAA14093for gcc@gcc.gnu.org; Sat, 25 Aug 2001 20:51:23 +0200
How to avoid the silly string alignment:
char string1 [] = "Hello";
char string2 [] = "world";
Hex dump of the binary:
H e l l o . . . . . . . . . . .
. . . . . . . . . . . . . . . .
w o r l d . . . . . . . . . . .
. . . . . . . . . . . . . . . .
A real world example follows below (compiled with -Os, and IMHO 's' stands
for' small', not for 'bloat'.
On the Pentium 4 the fastest code I often get with '-Os', I have some examples
where '-O3' generates code with 40% of the performance than the '-Os' code.
--------------------------------------------------------------------------
const char *const sys_errlist [] = {
"Success", /* 0 */
"Operation not permitted", /* EPERM */
"No such file or directory", /* ENOENT */
"No such process", /* ESRCH */
"Interrupted system call", /* EINTR */
"I/O error", /* EIO */
"No such device or address", /* ENXIO */
"Arg list too long", /* E2BIG */
"Exec format error", /* ENOEXEC */
"Bad file number", /* EBADF */
"No child processes", /* ECHILD */
"Try again", /* EAGAIN */
"Out of memory", /* ENOMEM */
"Permission denied", /* EACCES */
"Bad address", /* EFAULT */
"Block device required", /* ENOTBLK */
"Device or resource busy", /* EBUSY */
"File exists", /* EEXIST */
"Cross-device link", /* EXDEV */
"No such device", /* ENODEV */
"Not a directory", /* ENOTDIR */
"Is a directory", /* EISDIR */
"Invalid argument", /* EINVAL */
"File table overflow", /* ENFILE */
"Too many open files", /* EMFILE */
"Not a typewriter", /* ENOTTY */
"Text file busy", /* ETXTBSY */
"File too large", /* EFBIG */
"No space left on device", /* ENOSPC */
"Illegal seek", /* ESPIPE */
"Read-only file system", /* EROFS */
"Too many links", /* EMLINK */
"Broken pipe", /* EPIPE */
"Math argument out of domain of func", /* EDOM */
"Math result not representable", /* ERANGE */
"Resource deadlock would occur", /* EDEADLK */
"File name too long", /* ENAMETOOLONG */
"No record locks available", /* ENOLCK */
"Function not implemented", /* ENOSYS */
"Directory not empty", /* ENOTEMPTY */
"Too many symbolic links encountered", /* ELOOP */
"Operation would block", /* EWOULDBLOCK */
"No message of desired type", /* ENOMSG */
"Identifier removed", /* EIDRM */
"Channel number out of range", /* ECHRNG */
"Level 2 not synchronized", /* EL2NSYNC */
"Level 3 halted", /* EL3HLT */
"Level 3 reset", /* EL3RST */
"Link number out of range", /* ELNRNG */
"Protocol driver not attached", /* EUNATCH */
"No CSI structure available", /* ENOCSI */
"Level 2 halted", /* EL2HLT */
"Invalid exchange", /* EBADE */
"Invalid request descriptor", /* EBADR */
"Exchange full", /* EXFULL */
"No anode", /* ENOANO */
"Invalid request code", /* EBADRQC */
"Invalid slot", /* EBADSLT */
"File locking deadlock error", /* EDEADLOCK */
"Bad font file format", /* EBFONT */
"Device not a stream", /* ENOSTR */
"No data available", /* ENODATA */
"Timer expired", /* ETIME */
"Out of streams resources", /* ENOSR */
"Machine is not on the network", /* ENONET */
"Package not installed", /* ENOPKG */
"Object is remote", /* EREMOTE */
"Link has been severed", /* ENOLINK */
"Advertise error", /* EADV */
"Srmount error", /* ESRMNT */
"Communication error on send", /* ECOMM */
"Protocol error", /* EPROTO */
"Multihop attempted", /* EMULTIHOP */
"RFS specific error", /* EDOTDOT */
"Not a data message", /* EBADMSG */
"Value too large for defined data type", /* EOVERFLOW */
"Name not unique on network", /* ENOTUNIQ */
"File descriptor in bad state", /* EBADFD */
"Remote address changed", /* EREMCHG */
"Can not access a needed shared library", /* ELIBACC */
"Accessing a corrupted shared library", /* ELIBBAD */
".lib section in a.out corrupted", /* ELIBSCN */
"Attempting to link in too many shared libraries", /* ELIBMAX */
"Cannot exec a shared library directly", /* ELIBEXEC */
"Illegal byte sequence", /* EILSEQ */
"Interrupted system call should be restarted", /* ERESTART */
"Streams pipe error", /* ESTRPIPE */
"Too many users", /* EUSERS */
"Socket operation on non-socket", /* ENOTSOCK */
"Destination address required", /* EDESTADDRREQ */
"Message too long", /* EMSGSIZE */
"Protocol wrong type for socket", /* EPROTOTYPE */
"Protocol not available", /* ENOPROTOOPT */
"Protocol not supported", /* EPROTONOSUPPORT */
"Socket type not supported", /* ESOCKTNOSUPPORT */
"Operation not supported on transport endpoint", /* EOPNOTSUPP */
"Protocol family not supported", /* EPFNOSUPPORT */
"Address family not supported by protocol", /* EAFNOSUPPORT */
"Address already in use", /* EADDRINUSE */
"Cannot assign requested address", /* EADDRNOTAVAIL */
"Network is down", /* ENETDOWN */
"Network is unreachable", /* ENETUNREACH */
"Network dropped connection because of reset", /* ENETRESET */
"Software caused connection abort", /* ECONNABORTED */
"Connection reset by peer", /* ECONNRESET */
"No buffer space available", /* ENOBUFS */
"Transport endpoint is already connected", /* EISCONN */
"Transport endpoint is not connected", /* ENOTCONN */
"Cannot send after transport endpoint shutdown", /* ESHUTDOWN */
"Too many references: cannot splice", /* ETOOMANYREFS */
"Connection timed out", /* ETIMEDOUT */
"Connection refused", /* ECONNREFUSED */
"Host is down", /* EHOSTDOWN */
"No route to host", /* EHOSTUNREACH */
"Operation already in progress", /* EALREADY */
"Operation now in progress", /* EINPROGRESS */
"Stale NFS file handle", /* ESTALE */
"Structure needs cleaning", /* EUCLEAN */
"Not a XENIX named type file", /* ENOTNAM */
"No XENIX semaphores available", /* ENAVAIL */
"Is a named type file", /* EISNAM */
"Remote I/O error", /* EREMOTEIO */
"Quota exceeded", /* EDQUOT */
"No medium found", /* ENOMEDIUM */
"Wrong medium type", /* EMEDIUMTYPE */
(const char*)0
};
errlist.o: file format elf32-i386
Contents of section .text:
Contents of section .data:
Contents of section .rodata:
0000 53756363 65737300 4f706572 6174696f Success.Operatio
0010 6e206e6f 74207065 726d6974 74656400 n not permitted.
0020 4e6f2073 75636820 66696c65 206f7220 No such file or
0030 64697265 63746f72 79004e6f 20737563 directory.No suc
0040 68207072 6f636573 7300496e 74657272 h process.Interr
0050 75707465 64207379 7374656d 2063616c upted system cal
0060 6c00492f 4f206572 726f7200 4e6f2073 l.I/O error.No s
0070 75636820 64657669 6365206f 72206164 uch device or ad
0080 64726573 73004172 67206c69 73742074 dress.Arg list t
0090 6f6f206c 6f6e6700 45786563 20666f72 oo long.Exec for
00a0 6d617420 6572726f 72004261 64206669 mat error.Bad fi
00b0 6c65206e 756d6265 72004e6f 20636869 le number.No chi
00c0 6c642070 726f6365 73736573 00547279 ld processes.Try
00d0 20616761 696e004f 7574206f 66206d65 again.Out of me
00e0 6d6f7279 00506572 6d697373 696f6e20 mory.Permission
00f0 64656e69 65640042 61642061 64647265 denied.Bad addre
0100 73730042 6c6f636b 20646576 69636520 ss.Block device
0110 72657175 69726564 00446576 69636520 required.Device
0120 6f722072 65736f75 72636520 62757379 or resource busy
0130 0046696c 65206578 69737473 0043726f .File exists.Cro
0140 73732d64 65766963 65206c69 6e6b004e ss-device link.N
0150 6f207375 63682064 65766963 65004e6f o such device.No
0160 74206120 64697265 63746f72 79004973 t a directory.Is
0170 20612064 69726563 746f7279 00496e76 a directory.Inv
0180 616c6964 20617267 756d656e 74004669 alid argument.Fi
0190 6c652074 61626c65 206f7665 72666c6f le table overflo
01a0 7700546f 6f206d61 6e79206f 70656e20 w.Too many open
01b0 66696c65 73004e6f 74206120 74797065 files.Not a type
01c0 77726974 65720054 65787420 66696c65 writer.Text file
01d0 20627573 79004669 6c652074 6f6f206c busy.File too l
01e0 61726765 004e6f20 73706163 65206c65 arge.No space le
01f0 6674206f 6e206465 76696365 00496c6c ft on device.Ill
0200 6567616c 20736565 6b005265 61642d6f egal seek.Read-o
0210 6e6c7920 66696c65 20737973 74656d00 nly file system.
0220 546f6f20 6d616e79 206c696e 6b730042 Too many links.B
0230 726f6b65 6e207069 70650000 00000000 roken pipe......
0240 4d617468 20617267 756d656e 74206f75 Math argument ou
0250 74206f66 20646f6d 61696e20 6f662066 t of domain of f
0260 756e6300 4d617468 20726573 756c7420 unc.Math result
0270 6e6f7420 72657072 6573656e 7461626c not representabl
0280 65005265 736f7572 63652064 6561646c e.Resource deadl
0290 6f636b20 776f756c 64206f63 63757200 ock would occur.
02a0 46696c65 206e616d 6520746f 6f206c6f File name too lo
02b0 6e67004e 6f207265 636f7264 206c6f63 ng.No record loc
02c0 6b732061 7661696c 61626c65 0046756e ks available.Fun
02d0 6374696f 6e206e6f 7420696d 706c656d ction not implem
02e0 656e7465 64004469 72656374 6f727920 ented.Directory
02f0 6e6f7420 656d7074 79000000 00000000 not empty.......
0300 546f6f20 6d616e79 2073796d 626f6c69 Too many symboli
0310 63206c69 6e6b7320 656e636f 756e7465 c links encounte
0320 72656400 4f706572 6174696f 6e20776f red.Operation wo
0330 756c6420 626c6f63 6b004e6f 206d6573 uld block.No mes
0340 73616765 206f6620 64657369 72656420 sage of desired
0350 74797065 00496465 6e746966 69657220 type.Identifier
0360 72656d6f 76656400 4368616e 6e656c20 removed.Channel
0370 6e756d62 6572206f 7574206f 66207261 number out of ra
0380 6e676500 4c657665 6c203220 6e6f7420 nge.Level 2 not
0390 73796e63 68726f6e 697a6564 004c6576 synchronized.Lev
03a0 656c2033 2068616c 74656400 4c657665 el 3 halted.Leve
03b0 6c203320 72657365 74004c69 6e6b206e l 3 reset.Link n
03c0 756d6265 72206f75 74206f66 2072616e umber out of ran
03d0 67650050 726f746f 636f6c20 64726976 ge.Protocol driv
03e0 6572206e 6f742061 74746163 68656400 er not attached.
03f0 4e6f2043 53492073 74727563 74757265 No CSI structure
0400 20617661 696c6162 6c65004c 6576656c available.Level
0410 20322068 616c7465 6400496e 76616c69 2 halted.Invali
0420 64206578 6368616e 67650049 6e76616c d exchange.Inval
0430 69642072 65717565 73742064 65736372 id request descr
0440 6970746f 72004578 6368616e 67652066 iptor.Exchange f
0450 756c6c00 4e6f2061 6e6f6465 00496e76 ull.No anode.Inv
0460 616c6964 20726571 75657374 20636f64 alid request cod
0470 6500496e 76616c69 6420736c 6f740046 e.Invalid slot.F
0480 696c6520 6c6f636b 696e6720 64656164 ile locking dead
0490 6c6f636b 20657272 6f720042 61642066 lock error.Bad f
04a0 6f6e7420 66696c65 20666f72 6d617400 ont file format.
04b0 44657669 6365206e 6f742061 20737472 Device not a str
04c0 65616d00 4e6f2064 61746120 61766169 eam.No data avai
04d0 6c61626c 65005469 6d657220 65787069 lable.Timer expi
04e0 72656400 4f757420 6f662073 74726561 red.Out of strea
04f0 6d732072 65736f75 72636573 004d6163 ms resources.Mac
0500 68696e65 20697320 6e6f7420 6f6e2074 hine is not on t
0510 6865206e 6574776f 726b0050 61636b61 he network.Packa
0520 6765206e 6f742069 6e737461 6c6c6564 ge not installed
0530 004f626a 65637420 69732072 656d6f74 .Object is remot
0540 65004c69 6e6b2068 61732062 65656e20 e.Link has been
0550 73657665 72656400 41647665 72746973 severed.Advertis
0560 65206572 726f7200 53726d6f 756e7420 e error.Srmount
0570 6572726f 7200436f 6d6d756e 69636174 error.Communicat
0580 696f6e20 6572726f 72206f6e 2073656e ion error on sen
0590 64005072 6f746f63 6f6c2065 72726f72 d.Protocol error
05a0 004d756c 7469686f 70206174 74656d70 .Multihop attemp
05b0 74656400 52465320 73706563 69666963 ted.RFS specific
05c0 20657272 6f72004e 6f742061 20646174 error.Not a dat
05d0 61206d65 73736167 65000000 00000000 a message....... <------------
05e0 56616c75 6520746f 6f206c61 72676520 Value too large
05f0 666f7220 64656669 6e656420 64617461 for defined data
0600 20747970 65004e61 6d65206e 6f742075 type.Name not u
0610 6e697175 65206f6e 206e6574 776f726b nique on network
0620 0046696c 65206465 73637269 70746f72 .File descriptor
0630 20696e20 62616420 73746174 65005265 in bad state.Re
0640 6d6f7465 20616464 72657373 20636861 mote address cha
0650 6e676564 00000000 00000000 00000000 nged............ <------------
0660 43616e20 6e6f7420 61636365 73732061 Can not access a
0670 206e6565 64656420 73686172 6564206c needed shared l
0680 69627261 72790000 00000000 00000000 ibrary.......... <------------
0690 00000000 00000000 00000000 00000000 ................ <------------
06a0 41636365 7373696e 67206120 636f7272 Accessing a corr
06b0 75707465 64207368 61726564 206c6962 upted shared lib
06c0 72617279 00000000 00000000 00000000 rary............ <------------
06d0 00000000 00000000 00000000 00000000 ................ <------------
06e0 2e6c6962 20736563 74696f6e 20696e20 .lib section in
06f0 612e6f75 7420636f 72727570 74656400 a.out corrupted.
0700 41747465 6d707469 6e672074 6f206c69 Attempting to li
0710 6e6b2069 6e20746f 6f206d61 6e792073 nk in too many s
0720 68617265 64206c69 62726172 69657300 hared libraries.
0730 00000000 00000000 00000000 00000000 ................ <------------
0740 43616e6e 6f742065 78656320 61207368 Cannot exec a sh
0750 61726564 206c6962 72617279 20646972 ared library dir
0760 6563746c 7900496c 6c656761 6c206279 ectly.Illegal by
0770 74652073 65717565 6e636500 00000000 te sequence..... <------------
0780 496e7465 72727570 74656420 73797374 Interrupted syst
0790 656d2063 616c6c20 73686f75 6c642062 em call should b
07a0 65207265 73746172 74656400 53747265 e restarted.Stre
07b0 616d7320 70697065 20657272 6f720054 ams pipe error.T
07c0 6f6f206d 616e7920 75736572 73000000 oo many users... <------------
07d0 00000000 00000000 00000000 00000000 ................ <------------
07e0 536f636b 6574206f 70657261 74696f6e Socket operation
07f0 206f6e20 6e6f6e2d 736f636b 65740044 on non-socket.D
0800 65737469 6e617469 6f6e2061 64647265 estination addre
0810 73732072 65717569 72656400 4d657373 ss required.Mess
0820 61676520 746f6f20 6c6f6e67 00000000 age too long.... <------------
0830 00000000 00000000 00000000 00000000 ................ <------------
0840 50726f74 6f636f6c 2077726f 6e672074 Protocol wrong t
0850 79706520 666f7220 736f636b 65740050 ype for socket.P
0860 726f746f 636f6c20 6e6f7420 61766169 rotocol not avai
0870 6c61626c 65005072 6f746f63 6f6c206e lable.Protocol n
0880 6f742073 7570706f 72746564 00536f63 ot supported.Soc
0890 6b657420 74797065 206e6f74 20737570 ket type not sup
08a0 706f7274 65640000 00000000 00000000 ported.......... <------------
08b0 00000000 00000000 00000000 00000000 ................ <------------
08c0 4f706572 6174696f 6e206e6f 74207375 Operation not su
08d0 70706f72 74656420 6f6e2074 72616e73 pported on trans
08e0 706f7274 20656e64 706f696e 74005072 port endpoint.Pr
08f0 6f746f63 6f6c2066 616d696c 79206e6f otocol family no
0900 74207375 70706f72 74656400 00000000 t supported..... <------------
0910 00000000 00000000 00000000 00000000 ................ <------------
0920 41646472 65737320 66616d69 6c79206e Address family n
0930 6f742073 7570706f 72746564 20627920 ot supported by
0940 70726f74 6f636f6c 00416464 72657373 protocol.Address
0950 20616c72 65616479 20696e20 75736500 already in use.
0960 43616e6e 6f742061 73736967 6e207265 Cannot assign re
0970 71756573 74656420 61646472 65737300 quested address.
0980 4e657477 6f726b20 69732064 6f776e00 Network is down.
0990 4e657477 6f726b20 69732075 6e726561 Network is unrea
09a0 63686162 6c650000 00000000 00000000 chable.......... <------------
09b0 00000000 00000000 00000000 00000000 ................ <------------
09c0 4e657477 6f726b20 64726f70 70656420 Network dropped
09d0 636f6e6e 65637469 6f6e2062 65636175 connection becau
09e0 7365206f 66207265 73657400 00000000 se of reset..... <------------
09f0 00000000 00000000 00000000 00000000 ................ <------------
0a00 536f6674 77617265 20636175 73656420 Software caused
0a10 636f6e6e 65637469 6f6e2061 626f7274 connection abort
0a20 00436f6e 6e656374 696f6e20 72657365 .Connection rese
0a30 74206279 20706565 72004e6f 20627566 t by peer.No buf
0a40 66657220 73706163 65206176 61696c61 fer space availa
0a50 626c6500 00000000 00000000 00000000 ble............. <------------
0a60 5472616e 73706f72 7420656e 64706f69 Transport endpoi
0a70 6e742069 7320616c 72656164 7920636f nt is already co
0a80 6e6e6563 74656400 00000000 00000000 nnected......... <------------
0a90 00000000 00000000 00000000 00000000 ................ <------------
0aa0 5472616e 73706f72 7420656e 64706f69 Transport endpoi
0ab0 6e742069 73206e6f 7420636f 6e6e6563 nt is not connec
0ac0 74656400 00000000 00000000 00000000 ted............. <------------
0ad0 00000000 00000000 00000000 00000000 ................ <------------
0ae0 43616e6e 6f742073 656e6420 61667465 Cannot send afte
0af0 72207472 616e7370 6f727420 656e6470 r transport endp
0b00 6f696e74 20736875 74646f77 6e000000 oint shutdown... <------------
0b10 00000000 00000000 00000000 00000000 ................ <------------
0b20 546f6f20 6d616e79 20726566 6572656e Too many referen
0b30 6365733a 2063616e 6e6f7420 73706c69 ces: cannot spli
0b40 63650043 6f6e6e65 6374696f 6e207469 ce.Connection ti
0b50 6d656420 6f757400 436f6e6e 65637469 med out.Connecti
0b60 6f6e2072 65667573 65640048 6f737420 on refused.Host
0b70 69732064 6f776e00 4e6f2072 6f757465 is down.No route
0b80 20746f20 686f7374 004f7065 72617469 to host.Operati
0b90 6f6e2061 6c726561 64792069 6e207072 on already in pr
0ba0 6f677265 7373004f 70657261 74696f6e ogress.Operation
0bb0 206e6f77 20696e20 70726f67 72657373 now in progress
0bc0 00537461 6c65204e 46532066 696c6520 .Stale NFS file
0bd0 68616e64 6c650053 74727563 74757265 handle.Structure
0be0 206e6565 64732063 6c65616e 696e6700 needs cleaning.
0bf0 4e6f7420 61205845 4e495820 6e616d65 Not a XENIX name
0c00 64207479 70652066 696c6500 4e6f2058 d type file.No X
0c10 454e4958 2073656d 6170686f 72657320 ENIX semaphores
0c20 61766169 6c61626c 65004973 2061206e available.Is a n
0c30 616d6564 20747970 65206669 6c650052 amed type file.R
0c40 656d6f74 6520492f 4f206572 726f7200 emote I/O error.
0c50 51756f74 61206578 63656564 6564004e Quota exceeded.N
0c60 6f206d65 6469756d 20666f75 6e640057 o medium found.W
0c70 726f6e67 206d6564 69756d20 74797065 rong medium type
0c80 00000000 00000000 00000000 00000000 ................
0c90 00000000 00000000 00000000 00000000 ................
0ca0 00000000 08000000 20000000 3a000000 ........ ...:...
0cb0 4a000000 62000000 6c000000 86000000 J...b...l.......
0cc0 98000000 aa000000 ba000000 cd000000 ................
0cd0 d7000000 e5000000 f7000000 03010000 ................
0ce0 19010000 31010000 3d010000 4f010000 ....1...=...O...
0cf0 5e010000 6e010000 7d010000 8e010000 ^...n...}.......
0d00 a2010000 b6010000 c7010000 d6010000 ................
0d10 e5010000 fd010000 0a020000 20020000 ............ ...
0d20 2f020000 40020000 64020000 82020000 /...@...d.......
0d30 a0020000 b3020000 cd020000 e6020000 ................
0d40 00030000 24030000 3a030000 55030000 ....$...:...U...
0d50 68030000 84030000 9d030000 ac030000 h...............
0d60 ba030000 d3030000 f0030000 0b040000 ................
0d70 1a040000 2b040000 46040000 54040000 ....+...F...T...
0d80 5d040000 72040000 7f040000 9b040000 ]...r...........
0d90 b0040000 c4040000 d6040000 e4040000 ................
0da0 fd040000 1b050000 31050000 42050000 ........1...B...
0db0 58050000 68050000 76050000 92050000 X...h...v.......
0dc0 a1050000 b4050000 c7050000 e0050000 ................
0dd0 06060000 21060000 3e060000 60060000 ....!...>...`...
0de0 a0060000 e0060000 00070000 40070000 ............@...
0df0 66070000 80070000 ac070000 bf070000 f...............
0e00 e0070000 ff070000 1c080000 40080000 ............@...
0e10 5f080000 76080000 8d080000 c0080000 _...v...........
0e20 ee080000 20090000 49090000 60090000 .... ...I...`...
0e30 80090000 90090000 c0090000 000a0000 ................
0e40 210a0000 3a0a0000 600a0000 a00a0000 !...:...`.......
0e50 e00a0000 200b0000 430b0000 580b0000 .... ...C...X...
0e60 6b0b0000 780b0000 890b0000 a70b0000 k...x...........
0e70 c10b0000 d70b0000 f00b0000 0c0c0000 ................
0e80 2a0c0000 3f0c0000 500c0000 5f0c0000 *...?...P..._...
0e90 6f0c0000 00000000 7d000000 o.......}...
Contents of section .comment:
0000 00474343 3a202847 4e552920 332e3000 .GCC: (GNU) 3.0.
Disassembly of section .text: