-
Geron
New Member
- Публикаций:
-
0
- Регистрация:
- 16 сен 2005
- Сообщения:
- 5
Здравствуйте.
Используя иду получил asm-листинг программы, отредактировал и подправил. В результате, компилируется нормально но при линковке выдает ошибку: fatal error LNK1190: invalid fixup found, type 0x0001. Все библиотеки указаны верно, API так же определены. Поиск по форуму ничего не дал. Не помог и MSDN. Кто-нибудь встречался с подобным? При компиляции использовались MASM и link из 6’ой, 7’ой и 8’ой студий — результат один.
-
scf
Member
- Публикаций:
-
0
- Регистрация:
- 12 сен 2005
- Сообщения:
- 385
Я встречался
))
Вижу, понравилась идея?
MSDN не поможет — это баг MASM
Способ только один — комментить код, пока не найдёшь глючную строчку
-
Geron
New Member
- Публикаций:
-
0
- Регистрация:
- 16 сен 2005
- Сообщения:
- 5
Ух… 7,5 метров не просто комментировать… Если это компилятора ошибка, может TASM поможет? Попробую. В любом случае, спасибо.
-
Geron
New Member
- Публикаций:
-
0
- Регистрация:
- 16 сен 2005
- Сообщения:
- 5
В сети ответ так и не нашел, так что, если кто набредет, сможет сей совет помочь возможно: внимательно (поиском по листингу) посмотрите как и где ваш дизассемблер расставил assume’ы. В неожиданных местах оказаться они могут… Из-за них эта страшная ошибка при линковке, именно из-за них.
-
А потом не забудьте три раза обернуться, плюнув через плечо и… возьмите лучше фасм!
-
q_q
New Member
- Публикаций:
-
0
- Регистрация:
- 5 окт 2003
- Сообщения:
- 1.706
Geron
Огласи:
<ol type=1><li>тип собираемого приложения — dos, win, и т.д.;<li>версии компиляторов и параметры их запуска;<li>версии редакторов связей и параметры их запуска.</ol>
-
(C) Master Yoda from far, far away galaxy
Я валялся просто — это не вы Джорджу Лукасу сценарий писали?
))
-
Geron
New Member
- Публикаций:
-
0
- Регистрация:
- 16 сен 2005
- Сообщения:
- 5
IceStudent, трудно отказываться от привычного…
q_q
Тип приложения: Windows GUI.
Компиляторы: MS Macro Assembler Version 6.14.8444, MS Macro Assembler Version 7.10.3077, MS Macro Assembler Version 8.00.40809.
Командная строка:
%PATHBIN2%Ml.exe /c /Cx /coff /nologo /I%MASMLIB% /Fo»OBJ/» /Zm /Ta ASMCode.asm >%ERRFOLDER%AsmErrs.Txt
Линкеры: MS Incremental Linker Version 5.12.8078, Incremental Linker Version 7.10.3077, MS Incremental Linker Version 8.00.40809.
Командная строка:
%PATHBIN%Link.exe /SUBSYSTEM:WINDOWS /LIBPATH:%LIB2PATH% /LIBPATH:%LIB3PATH% /OUT:»Clnt301.exe» «OBJ*.obj» >%ERRFOLDER%LinkErrs.Txt
Переменные на пути указывают, соответственно.
masquer, не так все плохо — после трех суток без сна, бывало и Шекспиром говорил…
-
q_q
New Member
- Публикаций:
-
0
- Регистрация:
- 5 окт 2003
- Сообщения:
- 1.706
Geron
В папке obj нет лишних объектников?
Не пробовал указать конкретный объектник?
-
Geron
New Member
- Публикаций:
-
0
- Регистрация:
- 16 сен 2005
- Сообщения:
- 5
Да разобрался уже — регистр DS не с тем сегментом связан был. Поправил, теперь работает все. Спасибо всем откликнулся кто…
Содержание
- Fatal error lnk1190 invalid fixup found type 0x0001
- Answered by:
- Question
- Answers
- All replies
- Fatal error lnk1190 invalid fixup found type 0x0001
Fatal error lnk1190 invalid fixup found type 0x0001
This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Answered by:
Question
Hi.
I have MS VS2005 Professional, which has Masm v.8 (OS MS Windows XP SP2)
I recently started learning assembly language. And I have no problems compiling 32-bit code.
There’s only something wrong while compiling asm code to produce COM files.
Here’s simple code sample:
CSEG segment
ORG 100h
mov ah,9
mov dx,offset Message
int 21h
int 20h
Message db ‘Hello, world!$’
CSEG ends
end Begin
I compile it in command line like this:
ml test.asm /AT
I use /AT to enable tiny model (COM files). But I get the following:
test.obj : fatal error LNK1190: invalid fix-up found, type 0x0001 .
Could anyone tell me if there is a way to compile the 16-bit assembly code using Masm v.8 to produce COM files? Or I need to install like Masm v.6.xx?
Would appreciate any help
Answers
when you invoke ml.exe without any specific parameters the type of object file that it generates will be in coff format. coff format name mangling requires that your «Begin» should have a leading underscore. what you have written will work for intel’s omf object files. try using this with v.8 : «ml.exe /omf filename.asm». As far as I remember MS assemblers used to generate omf by default which the linker used to consume. Looks like this has been changed.
I’m not sure you have to follow this way. to build COM components.
A COM component hosts one or multiple COM class or coclass with is represented, structurally, as a virtual C++ class.
So you should continue to learn ASM, but to build COM class, you will have to build C++ applications, it is easier.
Note:
In the case you cant to build every thing from scratch, I do’nt know asm samples, but there are some C samples.
In the early days of COM programming, in the Win16 land, there were C sample code, provided in the Platform SDK that shown how to build COM coclass (with registration and every thing needed) using C langage.
May be it was in the OLE samples.
Well, I write C++ code anyways ( I’m first-year Computer Science student). I would just like to know whether it’s technically possible to compile, for instance, the above mentioned simple16-bit code using Masm v.8 to produce a COM file. (It just writes a classical «Hello World!»). It’s not the program itself that interests me. It’s how to do it in assembly language. And to be exact, how to produce a COM file using Masm v.8.
Maybe someone knows.
P.S.Thanks anyway for the answer
OK, at last I compiled the above mentioned 16-bit code to produce working COM file, but only after installing MASM v6.xx and only using 16-bit linker. And after linking I get .EXE file, which I convert to COM using exe2bin.
Seems like MASM v.8 is not supposed to link 16-bit programs.
when you invoke ml.exe without any specific parameters the type of object file that it generates will be in coff format. coff format name mangling requires that your «Begin» should have a leading underscore. what you have written will work for intel’s omf object files. try using this with v.8 : «ml.exe /omf filename.asm». As far as I remember MS assemblers used to generate omf by default which the linker used to consume. Looks like this has been changed.
Wow, it worked. You’re right that by default it generates object files in coff format. Without specifying, that ml has to compile an object module format object file, even if I used 16-bit linker, it would give a fatal error:
TEST.OBJ : fatal error L1101: invalid object module
, which now makes sense. A couple of days ago I figured out on myself how to compile my example code using MASM v.6.xx and 16-bit link.exe. I thought that I definetely have to use not only 16-bit linker, but ml.exe version 6.xx. But at last I was able to compile using ml.exe v.8! But still you have to use 16-bit linker ( for instance Microsoft link.exe v.5.xx) to link 16-bit code. It will produce an .EXE file, which I easily convert to .COM using exe2bin.
And of course it’s easier to write a batch file for this to make the compilation faster:
Источник
Fatal error lnk1190 invalid fixup found type 0x0001

|
Собирается таким батником:
Используй этот пример как скелет. |
|||||||||||||||||||||||
|
| LavYaAll |
|
||
Шустрый Профиль Репутация: нет |
|||
|
| W4FhLF |
|
||
found myself Профиль Репутация: 1 |
|||
|
| LavYaAll |
|
||
Шустрый Профиль Репутация: нет W4FhLF, при компиляции пишет C:masm32Hello.asm(6) : fatal error A1000: cannot open file : gdi32.inc Добавлено через 1 минуту и 55 секунд
|
|||
|
| W4FhLF |
|
||
found myself Профиль Репутация: 1
Ну и? Тебе это ни о чём не говорит? Проверь пути к инклудам. |
|||
|
| LavYaAll |
|
||
Шустрый Профиль Репутация: нет Так на месте же они. Добавлено через 42 секунды Добавлено через 4 минуты и 9 секунд |
|||
|
| W4FhLF |
|
|||
found myself Профиль Репутация: 1
Компилятор так не считает
|
||||
|
| LavYaAll |
|
||
Шустрый Профиль Репутация: нет
includelib C:masm32libgdi32.lib |
Добавлено через 1 минуту и 16 секунд
Цитата(W4FhLF @ 3.8.2008, 13:22 ) |
| Перва ссылка в гугле: http://www.google.com/search?q=Watcom+assembler |
|
![]() |
| W4FhLF |
|
||
found myself Профиль Репутация: 1
Пути до инклудов указаны в батнике. Если ты верно задал переменную %cmpl%, то полные пути в исходнике указывать не надо. |
|||
|
| LavYaAll |
|
||
Шустрый Профиль Репутация: нет |
|||
|
Профиль
Группа: Участник
Сообщений: 1
Регистрация: 29.12.2011
Репутация: нет
Всего: нет
| Булочкин |
|
||
| Цитата |
| W4FhLF, Да не, я просто компилил вручную, без батника. |
| Код |
| /z2 «prog.obj» / (без t) «prog.com» NUL LINK: warning LNK4044: unrecognized option «z2» ignored Hello.obj: warning LNK4033: converting object format from OMF to COFF Hello.obj: fatal error LNK1190: invalid fixup found, type 0x0001 |
| Код |
| D:masm32bin>set cmpl=d:masm32 |
D:masm32bin>d:masm32binml /nologo /c /coff /Cp /I d:masm32include proga1
.asm
Assembling: proga1.asm
MASM : fatal error A1000: cannot open file : proga1.asm
D:masm32bin>d:masm32binlink /NOLOGO /ALIGN:128 /SUBSYSTEM:WINDOWS /LIBPATH:
d:masm32lib prog.obj
LINK : warning LNK4108: /ALIGN specified without /DRIVER or /VXD; image may not
run
prog.obj : warning LNK4033: converting object format from OMF to COFF
prog.obj : fatal error LNK1190: invalid fixup found, type 0x0001
D:masm32bin>pause
Для продолжения нажмите любую клавишу . . .
что делать?
говорят что он не подходит для создание ком файлов, якобы лучше пользователя с старыми версиями 6.11-.13
находиля еще линкер с сайта майкрософта
может в старом масме запустит?
Это сообщение отредактировал(а) Булочкин — 29.12.2011, 18:36



















| Правила форума «Asm для начинающих» | |
|
Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, MAKCim.
| 0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) |
| 0 Пользователей: |
| « Предыдущая тема | Asm для начинающих | Следующая тема » |
[ Время генерации скрипта: 0.1468 ] [ Использовано запросов: 21 ] [ GZIP включён ]
Источник
Adblock
detector
|
roxkisHeavy 0 / 0 / 0 Регистрация: 02.07.2013 Сообщений: 8 |
||||
|
1 |
||||
|
03.07.2013, 20:06. Показов 4736. Ответов 5 Метки нет (Все метки)
Стоит masm32, код набираю в masm32 editor затем делаю console build and link.
выдает ошибку LNK 1190 : invalid fixup found, type 0x0001
__________________
0 |
|
Denhanter 0 / 0 / 0 Регистрация: 02.01.2013 Сообщений: 25 |
||||
|
03.07.2013, 21:26 |
2 |
|||
Такой пример попробуй запустить.
0 |
|
0 / 0 / 0 Регистрация: 02.07.2013 Сообщений: 8 |
|
|
03.07.2013, 22:45 [ТС] |
3 |
|
Denhanter, работает, но в чем проблема того кода? неужели ошибка в книге?
0 |
|
0 / 0 / 0 Регистрация: 02.01.2013 Сообщений: 25 |
|
|
03.07.2013, 22:59 |
4 |
|
Думаю в книге ошибки нет, разные версии masm
0 |
|
Ушел с форума 15703 / 7377 / 980 Регистрация: 11.11.2010 Сообщений: 13,321 |
|
|
04.07.2013, 03:51 |
5 |
|
roxkisHeavy,
0 |
|
0 / 0 / 0 Регистрация: 02.07.2013 Сообщений: 8 |
|
|
04.07.2013, 13:29 [ТС] |
6 |
|
Mikl___, спасибо, все прояснили.
0 |
Topic: Linker error (Read 6812 times)
Hello,
i have installed MASM 8.00 and finding this linker error with MASM.
*fatal error LNK1190: invalid fixup found, type 0x0001*
Let me know if any environmental settings required to be changed
C: LINUXLDR>ml LINUXLDR.Asm
Microsoft (R) Macro Assembler Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: LINUXLDR.Asm
LINUXLDR.Asm(404) : warning A4023: with /coff switch, leading underscore required for start address :
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
/OUT:LINUXLDR.exe
LINUXLDR.obj
LINUXLDR.obj : fatal error LNK1190: invalid fixup found, type 0x0001
Logged
Rough guess without seeing what you have done or where the code comes from is the object module type is wrong. Bit more info would be useful.
Logged
Other people on this board know a lot more than me about object models; your problem has to do with that. I assemble with /coff option, and use separate linker stage; this works.
ML /c /coff yourprog.asm
link /subsystem:console yourprog.obj /out:yourprog.exe
Try it like that it should work; altho there are other ways to do it.
Logged
I am NaN 
Hi nirmalarasu,
first things first: Welcome to the forum.
Could you post your used command line switches for linking, please?
Gunther
Logged
You have to know the facts before you can distort them.
he’s not using separate liner stage!, just ML with no switches. ML does the linking for u in that case, simply by calling the linker. U can pass the linker switches on the ML line but,
Seems easier the way I do it, /c to tell ML separate linker, /coff for object model, /subsystem:console on linker: that works
Logged
I am NaN 
FYI
Not sure if this will help, but I remember getting this when I was trying this:
; LEA EBX,COPYRIGHT
;$IDNUM0 EQU $
;* WHAT THE HELL??? CAN ONLY DO ‘LEA’ in .data?????!!!!!
;* SLEEP.obj : fatal error LNK1190: invalid fixup found, type 0x0001
;* asmlnk32 C: 1190 LINK
; LEA EBX,$IDNUM0
I could never figure it out, so I commented it all out. It seems that the content
of my assembler source actually caused it for me since, when commented,
but using the same .BAT I always use, it then worked OK…
Logged
I’m no expert but,
you can’t lea a symbol like $IDNUM0, since it has no address. If «COPYRIGHT» was also symbolic same thing applies.
«invalid fixup» means the linker couldn’t «fix» an address … when you correctly refer to an address in code, assembler doesn’t yet know the actual address when linked, only the relative addr to the module’s beginning. (There are exceptions with old-fashioned code which might not need a linker, not applicable here). So assembler passes it along to linker, telling it to «fix» the address when the .exe gets put together. One way to get the error, then, is to treat symbolic constant as an address (like a real data statement). Another way, if your object model is wrong; there are many ways that can happen, simplest (i.e. easiest to correct) is assembler not telling linker correct obj model. I think here we have one example of each problem.
BTW above description not the same as when the .exe is actually loaded into memory; then the loader makes the final adjustments depending on the start of program in mem.
If I’m wrong about any of that I’m not surprised … ! But I still think my recommendation may fix nirmalarasu’s problem
Logged
I am NaN 
But I still think my recommendation may fix nirmalarasu’s problem
Yes, that should work.
Gunther
Logged
You have to know the facts before you can distort them.
It still sounds like an incompatible object module that the linker does not understand. There has only been one post and we don’t really have enough information but I suspect that at least one object module is not a valid Microsoft COFF format file.
Logged
sinsi
Sounds like 16-bit code and trying to use the 32-bit linker.Try using link16 instead, although that won’t work in win64.
Logged
Hmmm, an EQU is not an address? I guess this is just another PC difference
btx the mainframe. Bummer! In the mainframe, ‘$IDNUM0’ would have a virtual
address; in my case, it would point to the «LEA» instruction:
$IDNUM0 EQU *
LA R15,$IDNUM0
I tried it again, but got the same LINK failure.
I added this to my assembler sample program source which
assembles and links OK B 4 this:
DUMMYMAC MACRO A,B
LOCAL $IDNUM0
$IDNUM0 EQU $
LEA EBX,$IDNUM0
ENDM
…
.CODE
…
DUMMYMAC
which generated this in .lst:
DUMMYMAC
1 LOCAL $IDNUM0
00000000 = 00000000 1 ??0023 EQU $
00000000 67& 8D 1E 0000 R 1 LEA EBX,??0023
yet, tho the assembly worked, the LINK failed:
Processed /DEFAULTLIB:kernel32.lib
Start Pass1
SAMPLE.obj : fatal error LNK1190: invalid fixup found, type 0x0001
Logged
HAH! F*#&IN’ A! Thankx to u stirring up my memories, I fixed my problem!
I used an old mainframe trick. I changed the EQU to a DS 0C (BYTE):
DUMMYMAC MACRO A,B
LOCAL $IDNUM0
;$IDNUM0 EQU $
$IDNUM0 BYTE 0 DUP(?)
LEA EBX,$IDNUM0
ENDM
TOTALLY COOL! It assembles, it links, it runs, and its’ verified
that EBX has its’ address:
Breakpoint 0 hit
eax=774b1102 ebx=7ffdb000 ecx=00000000 edx=00401000 esi=00000000 edi=00000000
eip=00401000 esp=0012ff8c ebp=0012ff94 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
SAMPLE!??0023:
00401000 8d1d00104000 lea ebx,[SAMPLE!??0023 (00401000)]
0:000> t
eax=774b1102 ebx=00401000 ecx=00000000 edx=00401000 esi=00000000 edi=00000000
eip=00401006 esp=0012ff8c ebp=0012ff94 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
SAMPLE!??0023+0x6:
00401006 b864000000 mov eax,64h
TOTALLY, TOTALLY COOL!!! Too bad I already found a different way (LOC over addr), but I think, from now on, for me, I will do this. Thankx!
Logged
congrats MtheK,
hope nirmalarasu is equally happy!
That «trick» makes sense, converts symbolic constant into data address … no logical difference perhaps but assembler / linker now treats it as u want. I’ve done similar thing, but never occurred to me use db 0 … why not, saves a byte, and is «cool»!
Logged
I am NaN 
Hi MtheK,
that’s indeed a very cool trick. It’ll work with 64-bit too, I hope.
Gunther
Logged
You have to know the facts before you can distort them.
Простейшее сообщение
, вывод 21h
- Подписаться на тему
- Сообщить другу
- Скачать/распечатать тему
|
|
|
|
Full Member Рейтинг (т): 2 |
s segment org 100h start: mov ah, 09 mov dx, offset string int 21 int 20 string db ‘PRIVET$’ s ends end start
Прога вроде верно написана Изображение не прикрепилось поравьте, если что не так Сообщение отредактировано: maxutov — 27.11.06, 13:20 |
Jin X |
|
|
Moderator Рейтинг (т): 117 |
Про компиляцию прог под ДОС с помощью MASM’а я ничего писать не буду, ибо это гемор, поэтому приведу пример для TASM: .COM: .MODEL Tiny .286 .CODE ORG 100h SMART LOCALS Start: int 20h END Start .EXE: .MODEL Small .286 .STACK 100h .DATA .CODE Start: .exit END Start Есть ещё и другие варианты, например, FASM и т.п. p.s. И с выбором подраздела поаккуратнее, ты пишешь не под WINDOWS/UNIX! |
|
AndNot |
|
|
Цитата 7in X @ 07.12.06, 18:00 с помощью MASM’а я ничего писать не буду, ибо это гемор
Цитата maxutov @ 20.11.06, 19:24 Это так сегмент кода объявляется? Цитата 7in X @ 07.12.06, 18:00 поэтому приведу пример для TASM Лучше уж так: ; COM .MODEL Tiny .286 .CODE ORG 100h SMART LOCALS Start: retn END Start
Сократили один байт |
|
maxutov |
|
|
Full Member Рейтинг (т): 2 |
Цитата AndNot @ 07.12.06, 20:56 Цитата 7in X @ 07.12.06, 18:00 с помощью MASM’а я ничего писать не буду, ибо это гемор
Цитата maxutov @ 20.11.06, 19:24 Это так сегмент кода объявляется? Цитата 7in X @ 07.12.06, 18:00 поэтому приведу пример для TASM Лучше уж так: ; COM .MODEL Tiny .286 .CODE ORG 100h SMART LOCALS Start: retn END Start
Сократили один байт
Так объявляется сегмент кода |
|
AndNot |
|
|
Цитата maxutov @ 08.12.06, 09:46 Так объявляется сегмент кода А где указано что это сегмент кода, а не стека или данных? Где тип выравнивания? Судя по всему ошибка связана именно с выравнивание. Такое у линкеров встречается. Добавлено 08.12.06, 11:58 int 21 ; т.е. int 15h …. int 20 ; int 14h
какой уж там вывод строки |
|
cppasm |
|
|
А ты не поделишься какая разница между кодом и данными с точки зрения проца? tasm /m proga.asm tlink /t proga.obj
Получишь proga.com. |
|
AndNot |
|
|
Цитата cppasm @ 08.12.06, 12:01 А ты не поделишься какая разница между кодом и данными с точки зрения проца?
Чтобы сгенерить правильный код, асму нужно знать какие сегментные регистры на какой сегмент настроены. Цитата cppasm @ 08.12.06, 12:01 tasm /m proga.asm
Можно вообще без параметров обойтись assume cs:_TEXT,ds:_TEXT,es:NOTHING Если не поможет, то явно объяви сегмент: _TEXT segment byte public ‘CODE’ assume cs:_TEXT,ds:_TEXT,es:NOTHING
Что то из этого должно помочь |
|
maxutov |
|
|
Full Member Рейтинг (т): 2 |
Цитата AndNot @ 08.12.06, 11:11 Цитата maxutov @ 08.12.06, 09:46 Так объявляется сегмент кода А где указано что это сегмент кода, а не стека или данных? Где тип выравнивания? Судя по всему ошибка связана именно с выравнивание. Такое у линкеров встречается. Добавлено 08.12.06, 11:58 int 21 ; т.е. int 15h …. int 20 ; int 14h
какой уж там вывод строки в 16-ричной тоже самое надо разобраться в ошибке invalid fixup found -Added 08.12.06, 12:53 Цитата cppasm @ 08.12.06, 12:01 А ты не поделишься какая разница между кодом и данными с точки зрения проца? tasm /m proga.asm tlink /t proga.obj
Получишь proga.com.
Да компилирую из-под винды -Added 08.12.06, 12:59 Цитата AndNot @ 08.12.06, 12:36 Цитата cppasm @ 08.12.06, 12:01 А ты не поделишься какая разница между кодом и данными с точки зрения проца?
Чтобы сгенерить правильный код, асму нужно знать какие сегментные регистры на какой сегмент настроены. Цитата cppasm @ 08.12.06, 12:01 tasm /m proga.asm
Можно вообще без параметров обойтись assume cs:_TEXT,ds:_TEXT,es:NOTHING Если не поможет, то явно объяви сегмент: _TEXT segment byte public ‘CODE’ assume cs:_TEXT,ds:_TEXT,es:NOTHING
Что то из этого должно помочь _TEXT segment byte public ‘CODE’ assume cs:_TEXT,ds:_TEXT,es:NOTHINGorg 100h start: mov ah, 09 mov dx, offset string int 21h int 20h string db ‘PRIVET$’ _TEXT ends end start
выдает ошибку Сообщение отредактировано: maxutov — 08.12.06, 13:00 |
|
cppasm |
|
|
Цитата maxutov @ 08.12.06, 12:51 Да компилирую из-под винды Есть, только он и проги собирает под винду, а у тебя дос. |
|
maxutov |
|
|
Full Member Рейтинг (т): 2 |
Цитата cppasm @ 08.12.06, 14:35 Цитата maxutov @ 08.12.06, 12:51 Да компилирую из-под винды Есть, только он и проги собирает под винду, а у тебя дос.
компилирую не из командной строки |
|
AndNot |
|
|
Цитата maxutov @ 08.12.06, 12:51 в 16-ричной тоже самое
Это относится только к неправильному коду, а не к линкеру Цитата maxutov @ 08.12.06, 12:51 underscore required for start address: start
Пессимисты оказались правы, масм действительно требует явного указания сегментов. code SEGMENT ASSUME cs:code, ds:code, ss:code, es:code entry: ORG 0100h mov ah,09 mov dx,offset tststr int 21h retn tststr db ‘PRIVET’,13,10,’$’ code ENDS ; конец сегмента текста программы END entry
Если нет, то, как и говорил cppasm, «асма у него не той системы» Цитата maxutov @ 08.12.06, 15:29 Захожу в Masm32 editor нажимаю Project->Built all Да! |
|
maxutov |
|
|
Full Member Рейтинг (т): 2 |
Цитата AndNot @ 08.12.06, 15:40 Цитата maxutov @ 08.12.06, 12:51 в 16-ричной тоже самое
Это относится только к неправильному коду, а не к линкеру Цитата maxutov @ 08.12.06, 12:51 underscore required for start address: start
Пессимисты оказались правы, масм действительно требует явного указания сегментов. code SEGMENT ASSUME cs:code, ds:code, ss:code, es:code entry: ORG 0100h mov ah,09 mov dx,offset tststr int 21h retn tststr db ‘PRIVET’,13,10,’$’ code ENDS ; конец сегмента текста программы END entry
Если нет, то, как и говорил cppasm, «асма у него не той системы» Цитата maxutov @ 08.12.06, 15:29 Захожу в Masm32 editor нажимаю Project->Built all Да!
Ура! proga.obj:fatal error LNK1190: invalid fixup found, type 0x0001 вот такую ошибку деает гад |
|
n0p |
|
|
maxutov — походу ты компилишь 32-bit Incremental Linker, который делает PE файлы под Windows ® Добавлено 08.12.06, 20:45 .model tiny .686 .code .startup mov ah,09 mov dx,offset tststr int 21h retn tststr db ‘PRIVET’,13,10,’$’ end вобщем по умолчанию масм (у меня 7.0) COFF-файлы генерит.. на что линкер послал Microsoft (R) Segmented Executable Linker Version 5.60.220 Sep 9 1994 Copyright (C) Microsoft Corp 1984-1993. All rights reserved. Object Modules [.obj]: xz.obj /t Run File [xz.com]: /OUT:»xz.com» LINK : warning L4017: /OUT : unrecognized option name; option ignored List File [nul.map]: Libraries [.lib]: Definitions File [nul.def]: xz.obj : fatal error L1101: invalid object module Object file offset: 1 Record type: 4c Добавлено 08.12.06, 20:48 C:WINNTTemp>ML.EXE /omf xz.asm Microsoft (R) Macro Assembler Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. Microsoft (R) Segmented Executable Linker Version 5.60.220 Sep 9 1994 Copyright (C) Microsoft Corp 1984-1993. All rights reserved. Object Modules [.obj]: xz.obj /t Run File [xz.com]: «xz.com» List File [nul.map]: NUL Libraries [.lib]: Definitions File [nul.def]: даже не пикнул.. Добавлено 08.12.06, 20:50 |
|
Barbosman |
|
|
в хелпах все написано!!! тока мне самому ниче не ясно |
0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
0 пользователей:
- Предыдущая тема
- Assembler
- Следующая тема
[ Script execution time: 0,0624 ] [ 15 queries used ] [ Generated: 9.02.23, 16:42 GMT ]
I can’t get this to link for some reason.
LNK1190: Invalid fixup found, type 0x0001
I’ve checkd msdn and the solution is to recompile because the «object file is corrupted.» Well, that doesn’t really help. Is there something fundamentally wrong with anything here:
edit: assembling with ml /c /coff /Cp Simple.asm
linking with link Simple.asm
(The error still occurs with /SUBSYSTEM: and a few other flags set for link)
.model small
.data
hello db "hello world","$"
.code
_start:
;mov ax, SEG hello ; move the segment address (ie what's in DS or ES) into ax
mov dx, OFFSET hello ; move the offset address into dx
;mov ds, ax ; may not be needed if ds points to data segment from start
mov ah, 09h ; print function
int 21h ; display hello message
mov ax, 4c00h ; call 4c exit function with exit code 0
int 21h
end _start
P.S. I couldn’t get the SEG directive to work without complaints with .model small (maybe because it’s all in same segment?).
«I study differential and integral calculus in my spare time.» — Karl Marx
From msdn
Quote:
/coff Generates common object file format (COFF) type of object module. Generally required for Win32 assembly language development.
So you want to create a Win32 application ?
But your code looks like a simple 16bit .com application.
In 32bit applications you usually assume a flat address space (no segments).
Quote:
link Simple.asm
BTW link expects object files, not assembler source files…
Edit:
From Link Reference
Quote:
LINK is a 32-bit tool that links Common Object File Format (COFF) object files and libraries to create a 32-bit executable (.exe) file or dynamic-link library (DLL).
Use NASM instead: nasm.sourceforge.net
I know I could use nasm, but this has to be done in masm (might get paid on RentACoder if I can get something very simple done in masm). I’m pretty proficient with nasm/alink. I’ll try alink. Btw, I did assemble without the /coff option, but a warning comes up (converting omf to coff) and the same error persists. There’s not another assembler and linker that comes in the MASM32 package that i’m supposed to be using is there? I’ll try alink now, but last time I tried going the other way, using link with nasm-generated code it didn’t work because of format differences, so it doesn’t look promising, but I’ll get back…
«I study differential and integral calculus in my spare time.» — Karl Marx
Quote:Original post by nmi
From msdnQuote:
/coff Generates common object file format (COFF) type of object module. Generally required for Win32 assembly language development.So you want to create a Win32 application ?
But your code looks like a simple 16bit .com application.
In 32bit applications you usually assume a flat address space (no segments).
I think the small model is still flat, but it uses only one one 16-bit segment, which is what i was going for. I tried specifying flat but got a shitload of meaningless errors, so I thought this way was the better.
«I study differential and integral calculus in my spare time.» — Karl Marx
With «-f bin» option you can create .com files using nasm. There is an example in the documentation I think.
With «-f win32» you can create .obj files that link together with other object files generated by VC++ for instance.
Changing small to flat I get:
Assembling: SimpleMasm1.asmSimpleMasm1.asm(1) : error A2085: instruction or register not accepted in current CPU modeSimpleMasm1.asm(3) : error A2013: .MODEL must precede this directiveSimpleMasm1.asm(4) : error A2034: must be in segment blockSimpleMasm1.asm(6) : error A2013: .MODEL must precede this directiveSimpleMasm1.asm(7) : error A2034: must be in segment blockSimpleMasm1.asm(9) : error A2034: must be in segment blockSimpleMasm1.asm(11) : error A2034: must be in segment blockSimpleMasm1.asm(12) : error A2034: must be in segment blockSimpleMasm1.asm(14) : error A2034: must be in segment blockSimpleMasm1.asm(15) : error A2034: must be in segment blockSimpleMasm1.asm(16) : error A2006: undefined symbol : _start
«I study differential and integral calculus in my spare time.» — Karl Marx
Quote:Original post by nmi
With «-f bin» option you can create .com files using nasm. There is an example in the documentation I think.With «-f win32» you can create .obj files that link together with other object files generated by VC++ for instance.
But this has got to be Masm source code. So if I want to get it to work I have to at least get hello world working.
«I study differential and integral calculus in my spare time.» — Karl Marx
I’ve got to find out how to specify .org 100h in masm, because I get warnings when linking with alink and the com doesn’t run right (that was with a non-COFF object code from MASM ml), so to troubleshoot I tried with /coff and alink spits out:
ALINK v1.6 (C) Copyright 1998-9 Anthony A.J. Williams.All Rights ReservedLoading file SimpleMasm1.objunsupported COFF relocation type 0001
… which might shed a little more light on the meaning of that error I was getting, because we see type 0001 appearing again. Ideas?
«I study differential and integral calculus in my spare time.» — Karl Marx
So I do this:
.model small.dataorg 100h ; ***NEW***hello db "hello world","$".code _start: ;mov ax, SEG hello ; move the segment address (ie what's in DS or ES) into ax mov dx, OFFSET hello ; move the offset address into dx ;mov ds, ax ; may not be needed if ds points to data segment from start mov ah, 09h ; print function int 21h ; display hello message mov ax, 4c00h ; call 4c exit function with exit code 0 int 21h end _start
Link with alink:
ALINK v1.6 (C) Copyright 1998-9 Anthony A.J. Williams.All Rights ReservedLoading file SimpleMasm1.objmatched Externsmatched ComDefsWarning, start address not 0100h as required for COM file
Am I missing the big picture on how to do com files in masm? I was just scrolling through the MASM Ref manual and there seems to be another syntax for declaring segments. Am I using the right method?
«I study differential and integral calculus in my spare time.» — Karl Marx

))

» title=»>» width=»8″ height=»8″/> Пример из учебника, MASM32 v9.0

Загрузка .



)






Точнее не скажешь. Но мне непонятна вот эта строчка:
Глянул повнимательнее и…. е мое, maxutov, у тебяж инты в десятичной системе указаны!!!!!!