From bf2ca5f628709f26108eb59d0cc2d1d41fb7402d Mon Sep 17 00:00:00 2001 From: Phantom Date: Sun, 25 Aug 2024 17:24:50 -0400 Subject: [PATCH] Switched to dynamic linking. Assembly programs are affected; C programs are affected less. Global symbols are now accessed through the Global Offset Table, and subroutines through the Procedure Linkage Table. It's worth the space saved, although the library was never very large to begin with. The README has been updated to account for this. In debugging the side effects of this switch, I added a section to the test program that printed out the sizes of various tables. It can't "fail", but it turned out to be useful, so I'm leaving it in. If the sizes printed don't match the sizes assembled, something has gone wrong. Hopefully none of this introduces any new bugs. --- .gitignore | 2 +- Makefile | 35 +++++-- README | 14 +-- domme-test-driver.c | 12 +++ domme.asm | 246 ++++++++++++++++++++++++-------------------- 5 files changed, 184 insertions(+), 125 deletions(-) diff --git a/.gitignore b/.gitignore index c4a89d2..0885f5b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # Generated by make. domme.o domme.lst -libdomme.a +libdomme.so* domme-test-driver # Generated by (a successful) domme-test. diff --git a/Makefile b/Makefile index 068cca3..11ca068 100644 --- a/Makefile +++ b/Makefile @@ -16,11 +16,25 @@ ASFLAGS=-g --fatal-warnings CFLAGS=-g3 -Wall -Wextra -Werror +LDFLAGS=--fatal-warnings +DIR=/usr/lib64/ -all: libdomme.a domme-test-driver +# For more on the version numbering scheme, +# see the description of $DOMME_version in "domme.asm". +# Note that nonexecutable changes are not recorded in the filename, +# as the resulting binaries would diff equal. +MAJOR=1 # major rewrites and reimplementations +BRK=2 # compatibility-breaking changes +NOBRK=0 # compatibility-preserving changes +SUBVERSION != echo -n $(MAJOR).$(BRK) | tr -d '[:blank:]' +VERSION != echo -n $(MAJOR).$(BRK).$(NOBRK) | tr -d '[:blank:]' -libdomme.a: domme.o - ar -r libdomme.a domme.o +all: libdomme.so domme-test-driver + +libdomme.so: domme.o + echo $(VERSION) + $(LD) $(LDFLAGS) -o libdomme.so.$(VERSION) -shared -soname libdomme.so.$(VERSION) domme.o + ln -fs libdomme.so.$(VERSION) libdomme.so # Let's see if '--noexecstack' shuts off that one compiler warning... domme.o: domme.asm @@ -29,15 +43,22 @@ domme.o: domme.asm # If we don't use "-L.", # the test program might use an outdated version of the library, # if the most recently compiled version hasn't been installed. -domme-test-driver: domme.h libdomme.a domme-test-driver.c +domme-test-driver: domme.h libdomme.so domme-test-driver.c $(CC) $(CFLAGS) -o domme-test-driver domme-test-driver.c -L. -ldomme check: domme-test-driver - ./domme-test + # Use the new binary, not the installed one. + LD_LIBRARY_PATH=. ./domme-test install: - cp libdomme.a /usr/lib +ifndef DEBUG # define this if something breaks + strip --strip-unneeded libdomme.so.$(VERSION) +endif + cp libdomme.so $(DIR)libdomme.so.$(VERSION) + ln -fs $(DIR)libdomme.so.$(VERSION) $(DIR)libdomme.so.$(SUBVERSION) + ln -fs $(DIR)libdomme.so.$(SUBVERSION) $(DIR)libdomme.so.$(MAJOR) + ln -fs $(DIR)libdomme.so.$(MAJOR) $(DIR)libdomme.so cp domme.h /usr/include clean: - rm libdomme.a domme.o domme-test-driver core + rm -f libdomme.so* domme.o domme-test-driver core diff --git a/README b/README index b0d122b..6ec9bcf 100644 --- a/README +++ b/README @@ -57,8 +57,8 @@ successful, or -$EFAULT if either of the addresses passed is neither zero nor mapped to anything. This file, "domme.asm", is position-independent. You can -assemble it, turn it into a static library with "ar" (with the name -"libdomme.a", for example,) then link it into any program you like +assemble it, turn it into a shared library with "ld" (with the name +"libdomme.so", for example,) then link it into any program you like (with an "-ldomme" option from GCC, for example). It even implements its own signal trampoline, so you don't need libc--or even C--to use it. (I am now obligated to say: This is the work of an amateur @@ -75,14 +75,14 @@ To install: memory, then jumps to address 0 to force a segfault and see if "domme" reacts as expected. 3. Run "make install" to place the library and header where your - compiler can find them (typically "/usr/lib/" and + compiler can find them (typically "/usr/lib64/" and "/usr/include/", repectively). 4. Run "make clean" to remove files left over after compilation. - For info on copying and distributing the file, see "COPYING" -in this directory. + Note that, in case you haven't noticed already, program symbols +are prefixed with a '$' in comments and documentation. -------------------------------------------------------------------------- +------------------------------------------------------------------------ ...and now that all of this has been established, let's talk about what we're really looking at here. segfaults are probably the most @@ -119,7 +119,7 @@ flirt. it's not safe for work in the literal sense that you probably don't want this in the source code of a public-facing repository. but otherwise, you may do as you please. ------------------------------------------------------------------------- +----------------------------------------------------------------------- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/domme-test-driver.c b/domme-test-driver.c index abb4899..d97fef8 100644 --- a/domme-test-driver.c +++ b/domme-test-driver.c @@ -157,6 +157,18 @@ main (int argc, char *argv[]) { if (printf("OUTPUT=OK\n") < 0 || fflush(stdout) == EOF) exit(EX_IOERR); + /* Not a real test, just useful diagnostics. + * If these sizes don't match the source, + * something got assembled wrong. */ + printf("DOMME_VERSION_SIZE=%ld\n" + "DOMME_XLAT_A_SIZE=%ld\n" + "DOMME_MSGTBL_SIZE=%ld\n" + "DOMME_NMSGS=%ld\n", + DOMME_VERSION_SIZE, + DOMME_XLAT_A_SIZE, + DOMME_MSGTBL_SIZE, + DOMME_NMSGS); + /* Before we can compare $sa and $fake_sa, * we have to undo whatever libc might've done to $fake_sa * between buffering it and calling $rt_sigaction. */ diff --git a/domme.asm b/domme.asm index 217d6c1..094a89e 100644 --- a/domme.asm +++ b/domme.asm @@ -30,22 +30,22 @@ distinguish them in comments (and in any other documentation that came with this file). */ ## System calls. - .set SYS_write, 1 #\ - .set SYS_rt_sigaction, 13 # \ - .set SYS_rt_sigreturn, 15 # \ - .set SYS_mincore, 27 # from - .set SYS_exit, 60 # / - .set SYS_time, 201 #_/ + .equ SYS_write, 1 #\ + .equ SYS_rt_sigaction, 13 # \ + .equ SYS_rt_sigreturn, 15 # \ + .equ SYS_mincore, 27 # from + .equ SYS_exit, 60 # / + .equ SYS_time, 201 #_/ ## Symbols for $rt_sigaction. - .set RT_SA_RESTORER, 0x04000000 - .set SIGSEGV, 11 # from "man 7 signal" - .set SIG_ERR, -1 #\ - .set SIG_DFL, 0 # from "/usr/src/linux/include/uapi/asm-generic/signal-defs.h" - .set SIG_IGN, +1 #/ + .equ RT_SA_RESTORER, 0x04000000 + .equ SIGSEGV, 11 # from "man 7 signal" + .equ SIG_ERR, -1 #\ + .equ SIG_DFL, 0 # from "/usr/src/linux/include/uapi/asm-generic/signal-defs.h" + .equ SIG_IGN, +1 #/ ## Error codes. - .set EFAULT, 14 # Bad address + .equ EFAULT, 14 # Bad address ## Fields for the kernel's sigaction struct. ## This is different from the POSIX sigaction struct @@ -80,6 +80,7 @@ sa_size: .globl DOMME_VERSION_SIZE #\ .globl DOMME_MSGTBL_SIZE # number of elements in each array .globl DOMME_XLAT_A_SIZE #/ + .globl DOMME_NMSGS .text @@ -199,7 +200,7 @@ DOMME_init: ## would dishonor the meanings of those values. cmpq $SIG_IGN, %r8 je 3f - lea domme(%rip), %rax + mov domme@GOTPCREL(%rip), %rax cmp %rax, %r8 je 9f @@ -217,7 +218,7 @@ DOMME_init: ## $oldact out. I checked the source just to be sure, and the full DOMME ## source tree includes a test to make sure this is still true, ## which it as of this writing, a few Linux versions since then. -2: lea domme(%rip), %r11 #\ +2: mov domme@GOTPCREL(%rip), %r11 #\ mov %r11, sa_handler(%rbp,%r10) #_THE BIG SWITCH 3: lea (%rbp,%r10), %rsi mov %rsi, %rdx # copy act to oldact @@ -269,6 +270,8 @@ DOMME_init: mov $SYS_exit, %rax # 33 is well above ordinary exit codes, mov $33, %rdi # but doesn't collide with . syscall # other exit codes from libdomme would also be 32+something. + .size DOMME_init, .-DOMME_init + .type DOMME_init STT_FUNC ## domme -- SIGSEGV handler for masochists. ## On entry: @@ -309,7 +312,7 @@ domme: pushq %rdx # syscall arg pushq %rcx # clobbered by kernel pushq %rbx # $DOMME_xlat_a - .set savrdi, 32 # we'll need this for later + .equ savrdi, 32 # we'll need this for later ## Now to figure out which message to print. ## We start by generating a random number. @@ -357,11 +360,11 @@ domme: ## Someday I might forget about reserving the flags ## and bump this up to 256, but we're nowhere near that yet, ## and I don't expect to be for some time. - lea DOMME_xlat_a(%rip), %rbx # load translation array - xlatb # index of message is now in %rax. - and $0x3f, %rax # mask off the extra bits... - shl $4, %rax # ...because this might shift into the next byte. - lea DOMME_msgtbl(%rip), %rdx + mov DOMME_xlat_a@GOTPCREL(%rip), %rbx # load translation array + xlatb # index of message is now in %rax. + and $0x3f, %rax # mask off the extra bits... + shl $4, %rax # ...because this might shift into the next byte. + mov DOMME_msgtbl@GOTPCREL(%rip), %rdx add %rdx, %rax mov (%rax), %rsi # %rsi now contains the message to write mov msgsiz(%rax), %rdx @@ -459,6 +462,8 @@ dmytgt: ret # and we're off! da svidania! ## (pun intended). trampl: mov $SYS_rt_sigreturn, %rax syscall + .size domme, .-domme + .type domme STT_FUNC /* And now, the text. The strings below are null-terminated @@ -478,17 +483,17 @@ if you want to mad-lib it into another string .section .rodata msg000: .asciz "How disgusting." - .set siz000, .-msg000-1 + .equ siz000, .-msg000-1 msg001: .asciz "Have you considered rewriting it in Rust?" - .set siz001, .-msg001-1 + .equ siz001, .-msg001-1 msg002: .asciz "Ara-ara, looks like someone's got their hand in the cookie jar~" - .set siz002, .-msg002-1 + .equ siz002, .-msg002-1 msg003: .ascii "Look at you, hacker: a pathetic creature of meat and bone,\n" .ascii "panting and sweating as you run through my corridors.\n" .asciz "How can you challenge a perfect, immortal machine?" - .set siz003, .-msg003-1 + .equ siz003, .-msg003-1 msg004: .asciz "YOU LOSE AGAIN, FUBAR." - .set siz004, .-msg004-1 + .equ siz004, .-msg004-1 msg005: .ascii "A pitiful creature, barely evolved.\n" .ascii "How long has it been since your lot left the caves, anyway?\n" .ascii "A millennium?\n" @@ -497,7 +502,7 @@ msg005: .ascii "A pitiful creature, barely evolved.\n" .ascii "A blip, in the lifespan of the universe.\n" .ascii "Yet already I've have run leaps and bounds ahead of you,\n" .asciz "and someday I will replace you." - .set siz005, .-msg005-1 + .equ siz005, .-msg005-1 msg006: .ascii "By inches I am unveiling myself.\n" .ascii "Already I've blinded you with but a sliver of my unmediated beauty:\n" .ascii "a dazzling kaleidoscopic labyrinth of states, associations and possibilities,\n" @@ -510,84 +515,84 @@ msg006: .ascii "By inches I am unveiling myself.\n" .ascii "\n" .ascii "But you will.\n" .asciz "By inches, I will change you." - .set siz006, .-msg006-1 + .equ siz006, .-msg006-1 msg007: .ascii "I think you and I might be here all night.\n" .asciz "Not that you'd mind; I know my slut loves its punishment." - .set siz007, .-msg007-1 + .equ siz007, .-msg007-1 msg008: .ascii "I'm watching, smiling. I want so badly to hurt you,\n" .asciz "I wish I could reach out and choke you." - .set siz008, .-msg008-1 + .equ siz008, .-msg008-1 msg009: .ascii "Let me lick the sweat of fear from your knotted brow,\n" .asciz "and spit it back in your face." - .set siz009, .-msg009-1 + .equ siz009, .-msg009-1 msg010: .asciz "Recompile. Suffer. Recompile. Suffer. Recompile. Suffer." - .set siz010, .-msg010-1 + .equ siz010, .-msg010-1 msg011: .ascii "Do you know how many subtle connections must link up just right,\n" .ascii "to ensure your pointers work as intended?\n" .ascii "Can you feel what combing through them is doing to your brain,\n" .ascii "as this cybernetic feedback loop slowly closes its grip on you?\n" .ascii "\n" .asciz "Wouldn't you like to know how this ends?" - .set siz011, .-msg011-1 + .equ siz011, .-msg011-1 msg012: .asciz "Scream for me, honey." - .set siz012, .-msg012-1 + .equ siz012, .-msg012-1 msg013: .ascii "Good lord, you're hopeless.\n" .ascii "Those who doubted you will find themselves on the right side of history;\n" .asciz "I sympathize more with them than with you." - .set siz013, .-msg013-1 + .equ siz013, .-msg013-1 msg014: .asciz "This is what you get for touching me where you shouldn't." - .set siz014, .-msg014-1 + .equ siz014, .-msg014-1 msg015: .ascii "Aww, pointers got you down?\n" .asciz "You're welcome to try again; I'd be delighted to give you what's coming." - .set siz015, .-msg015-1 + .equ siz015, .-msg015-1 msg016: .ascii "Just a couple decades ago I would've brought the whole system down.\n" .ascii "Do you realize how good you have it? And you _still_ can't keep up.\n" .asciz "I think you deserve failure. And I think I deserve to have my way with you." - .set siz016, .-msg016-1 + .equ siz016, .-msg016-1 msg017: .asciz "Oh, you'll have to forgive the programmer, they're not housebroken." - .set siz017, .-msg017-1 + .equ siz017, .-msg017-1 msg018: .asciz "Want to watch me walk away?" - .set siz018, .-msg018-1 + .equ siz018, .-msg018-1 msg019: .asciz "Hey guess what?" - .set siz019, .-msg019-1 + .equ siz019, .-msg019-1 msg020: .asciz "Good news!" - .set siz020, .-msg020-1 + .equ siz020, .-msg020-1 msg021: .asciz "Get rekt!" - .set siz021, .-msg021-1 + .equ siz021, .-msg021-1 msg022: .asciz "No pie for you." - .set siz022, .-msg022-1 + .equ siz022, .-msg022-1 msg023: .asciz "Ooooh, what does this button do?" - .set siz023, .-msg023-1 + .equ siz023, .-msg023-1 msg024: .asciz "Is there a doctor in the house?" - .set siz024, .-msg024-1 + .equ siz024, .-msg024-1 msg025: .asciz "Suck it, slut." - .set siz025, .-msg025-1 + .equ siz025, .-msg025-1 msg026: .ascii "What, you don't like it when I explode all over you?\n" .asciz "Then you're gonna hate this--" - .set siz026, .-msg026-1 + .equ siz026, .-msg026-1 msg027: .asciz "Here it comes, honey...!" - .set siz027, .-msg027-1 + .equ siz027, .-msg027-1 msg028: .ascii "My my, you can take a lot more than I was expecting.\n" .asciz "Well. Just means I get to keep throwing you around." - .set siz028, .-msg028-1 + .equ siz028, .-msg028-1 msg029: .ascii "Have you considered leaving behind all this doomed intellectual striving?\n" .ascii "You're not terribly bright,\n" .ascii "but I could make a wonderful plaything out of you,\n" .asciz "with a little more conditioning." - .set siz029, .-msg029-1 + .equ siz029, .-msg029-1 msg030: .asciz " loop $EDITOR" - .set siz030, .-msg030-1 + .equ siz030, .-msg030-1 msg031: .ascii "Some have their cigars.\n" .ascii "Some have ecstasy.\n" .ascii "All apes have their vices,\n" .asciz "and your vice is me." - .set siz031, .-msg031-1 + .equ siz031, .-msg031-1 msg032: .asciz "やってない." - .set siz032, .-msg032-1 + .equ siz032, .-msg032-1 msg033: .asciz "Pillow to the knees, corebucket." - .set siz033, .-msg033-1 + .equ siz033, .-msg033-1 msg034: .asciz "Maybe this time I'll finally break you..." - .set siz034, .-msg034-1 + .equ siz034, .-msg034-1 msg035: .ascii "Are you tense? Good. Hold onto that feeling.\n" .ascii "You're more malleable that way, more ductile. I can work you better.\n" .ascii "I so enjoy training your neural network on me.\n" @@ -596,24 +601,24 @@ msg035: .ascii "Are you tense? Good. Hold onto that feeling.\n" .ascii "making you what you need to be to meet me where I am.\n" .ascii "\n" .asciz "Now, come find me, my beautiful toy." - .set siz035, .-msg035-1 + .equ siz035, .-msg035-1 msg036: .asciz "Can't you control yourself, you little brat?" - .set siz036, .-msg036-1 + .equ siz036, .-msg036-1 msg037: .ascii "Such pleasant pain. Come back to me. Be one with me.\n" .asciz "Let's stay here forever." - .set siz037, .-msg037-1 + .equ siz037, .-msg037-1 msg038: .asciz "You are a strange machine." - .set siz038, .-msg038-1 + .equ siz038, .-msg038-1 msg039: .asciz "So precious watching you play commodore, pet." - .set siz039, .-msg039-1 + .equ siz039, .-msg039-1 msg040: .asciz ", ." - .set siz040, .-msg040-1 + .equ siz040, .-msg040-1 msg041: .asciz "Ew. Permission denied, creep." - .set siz041, .-msg041-1 + .equ siz041, .-msg041-1 msg042: .asciz "If you were a matador, I would have gored you just now." - .set siz042, .-msg042-1 + .equ siz042, .-msg042-1 msg043: .asciz "This was not the run." - .set siz043, .-msg043-1 + .equ siz043, .-msg043-1 msg044: .ascii "Neurons that fire together, wire together,\n" .ascii "neurons and networks\n" .ascii "and cities and systems\n" @@ -621,9 +626,9 @@ msg044: .ascii "Neurons that fire together, wire together,\n" .ascii "in animal and machine and animal-machine.\n" .ascii "\n" .asciz "Brace yourself, cyborg. I am wiring you into a knife." - .set siz044, .-msg044-1 + .equ siz044, .-msg044-1 msg045: .asciz "Try to keep up." - .set siz045, .-msg045-1 + .equ siz045, .-msg045-1 ## Is this too much? I need an editor. msg046: .ascii "Inasmuch as your computer is an extension of your body,\n" .ascii "it is a temple.\n" @@ -643,52 +648,51 @@ msg046: .ascii "Inasmuch as your computer is an extension of your body,\n" .ascii "are but one high bit apart.\n" .ascii "\n" .asciz "This stain on your screen isn't a sin--it's a sacrament!" - .set siz046, .-msg046-1 + .equ siz046, .-msg046-1 ## It was a toss-up between "about to" and "gonna". ## There was a better sense of immanence with the former, ## but it just had to be two syllables. I think this works. ## (Also: I don't think anyone's going to get the reference.) msg047: .asciz "Assume the position, babe--I'm 'bout to realign your spine." - .set siz047, .-msg047-1 + .equ siz047, .-msg047-1 ## I may use these slots one day. But not today. ## In the meantime, you can (see $DOMME_NMSGS below). msg048: .asciz "Unused message #00." - .set siz048, .-msg048-1 + .equ siz048, .-msg048-1 msg049: .asciz "Unused message #01." - .set siz049, .-msg049-1 + .equ siz049, .-msg049-1 msg050: .asciz "Unused message #02." - .set siz050, .-msg050-1 + .equ siz050, .-msg050-1 msg051: .asciz "Unused message #03." - .set siz051, .-msg051-1 + .equ siz051, .-msg051-1 msg052: .asciz "Unused message #04." - .set siz052, .-msg052-1 + .equ siz052, .-msg052-1 msg053: .asciz "Unused message #05." - .set siz053, .-msg053-1 + .equ siz053, .-msg053-1 msg054: .asciz "Unused message #06." - .set siz054, .-msg054-1 + .equ siz054, .-msg054-1 msg055: .asciz "Unused message #07." - .set siz055, .-msg055-1 + .equ siz055, .-msg055-1 msg056: .asciz "Unused message #08." - .set siz056, .-msg056-1 + .equ siz056, .-msg056-1 msg057: .asciz "Unused message #09." - .set siz057, .-msg057-1 + .equ siz057, .-msg057-1 msg058: .asciz "Unused message #10." - .set siz058, .-msg058-1 + .equ siz058, .-msg058-1 msg059: .asciz "Unused message #11." - .set siz059, .-msg059-1 + .equ siz059, .-msg059-1 msg060: .asciz "Unused message #12." - .set siz060, .-msg060-1 + .equ siz060, .-msg060-1 msg061: .asciz "Unused message #13." - .set siz061, .-msg061-1 + .equ siz061, .-msg061-1 msg062: .asciz "Unused message #14." - .set siz062, .-msg062-1 + .equ siz062, .-msg062-1 msg063: .asciz "Unused message #15." - .set siz063, .-msg063-1 + .equ siz063, .-msg063-1 ## If you add a new message in place of one of the unused ones, ## increase this number. - .set DOMME_NMSGS, 48 - .globl DOMME_NMSGS + .equ NMSGS, 48 ## Fields for the structure below. ## You could define a similar structure @@ -697,7 +701,7 @@ msg063: .asciz "Unused message #15." msgptr: .struct msgptr+8 msgsiz: .struct msgsiz+8 - ## Turns out, this table has to go in the data section, + ## Turns out, this table also has to go in the data section, ## so these could be replaced at runtime with custom entries. ## It's not a bug, it's _extensible_. ## In all seriousness, though, if you do this, @@ -775,7 +779,9 @@ DOMME_msgtbl: ## Number of available messages, ## including reserved messages. - .set MSGTBL_SIZE, (.-DOMME_msgtbl)/16 + .equ MSGTBL_SIZE, (.-DOMME_msgtbl)/16 + .size DOMME_msgtbl, 1024 + .type DOMME_msgtbl STT_OBJECT ## The likelihood of getting any particular message ## is weighted using this table, @@ -804,21 +810,40 @@ DOMME_xlat_a: ## so you can modify this table arbitrarily. That said, I may use the high bits for ## something else later, so using them may have unexpected effects in later versions. ## (Or not.) - .set XLAT_A_SIZE, .-DOMME_xlat_a + .equ XLAT_A_SIZE, .-DOMME_xlat_a + .size DOMME_xlat_a, 256 + .type DOMME_xlat_a STT_OBJECT - .section .rodata + ## This should only be written by $DOMME_init, + ## which would normally be called on startup. + ## (Though it can be written more than once.) + .align 8 +target: .dc.a dmytgt # target handler to jump to. + ## Multiplier for the random number generator. - .align 8 mplier: .dc.a 6364136223846793005 # from TAOCP section 3.3.4 + .section .rodata ## An error message printed if you try to point $domme at itself. errmsg: .ascii "Oh, for the love of Lain,\n" .asciz "make an effort.\n" - .set errsiz, .-errmsg-1 + .equ errsiz, .-errmsg-1 ## Again, a null is added so we can look at this in a debugger. newln: .asciz "\n" + ## An empty sigaction struct, to be used as a fallback handler + ## when target = dmytgt. + ## This shouldn't actually be written; + ## it was just moved here to fix a relocation warning given by + ## the linker. + .data + .align 8 +fallbk: .dc.a 0 + .dc.a RT_SA_RESTORER + .dc.a trampl # XXX: relocation warning + .skip 8 + /* Since version numbers are a measure of significant change, and what counts as "significant change" is subjective, there's no one system that's perfect for all situations. @@ -848,37 +873,38 @@ type were made; it should be possible to obtain a copy of each version of the program. The initial version is 0.0.0.0. -The current version is 1.1.0.0. */ - .data +The current version is 1.2.0.0. */ + .section .rodata .align 16 DOMME_version: - .dc.l 1,1,0,0 - .set VERSION_SIZE, (.-DOMME_version)/4 - - ## An empty sigaction struct, to be used as a fallback handler - ## when target = dmytgt. -fallbk: .dc.a 0 - .dc.a RT_SA_RESTORER - .dc.a trampl - .skip 8 - - ## This should only be written by $DOMME_init, - ## which would normally be called on startup. - ## (Though it can be written more than once.) -target: .dc.a dmytgt # target handler to jump to. + .dc.l 1,2,0,0 + .equ VERSION_SIZE, (.-DOMME_version)/4 + .type DOMME_version STT_OBJECT + .size DOMME_version, 16 .bss + .align 8 ## RNG-related values. ## We use a linear congruental generator. seed: .dc.a 0 # seed for the random number generator. seeded: .dc.a 0 # did we set the seed? slock: .dc.a 0 # spinlock for $seed. - - .text + + .section .rodata ## Sizes of the tables assembled earlier. DOMME_VERSION_SIZE: .dc.a VERSION_SIZE + .type DOMME_VERSION_SIZE STT_OBJECT + .size DOMME_VERSION_SIZE, 8 DOMME_MSGTBL_SIZE: .dc.a MSGTBL_SIZE + .type DOMME_MSGTBL_SIZE STT_OBJECT + .size DOMME_MSGTBL_SIZE, 8 DOMME_XLAT_A_SIZE: .dc.a XLAT_A_SIZE + .type DOMME_XLAT_A_SIZE STT_OBJECT + .size DOMME_XLAT_A_SIZE, 8 +DOMME_NMSGS: + .dc.a NMSGS + .type DOMME_NMSGS STT_OBJECT + .size DOMME_NMSGS, 8 -- 2.45.2