[[완료]] 32bit 인텔 플랫폼으로 작성된 것을 64비트에서 컴파일시에

choboja의 이미지

프로젝트를 컴파일 중인데 호환성 문제때문인지 컴파일이 되지 않네요.
현재 제 컴퓨터는 64bit이고 gcc는 x86-64 인데
이 프로젝트는 i386 플랫폼에서 작성된거 같습니다.

인터넷을 검색해보니 gcc option에 -32m 을 주면 된다고하는데
컴파일이 제대로 되지 않네요.

make 파일에 -32m옵션을 주지 않은 경우

linux-2.6.23.14/include/asm/irqflags.h: Assembler messages:
linux-2.6.23.14/include/asm/irqflags.h:18: Error: suffix or operands invalid for `pushf'
linux-2.6.23.14/include/asm/irqflags.h:18: Error: suffix or operands invalid for `pop'
linux-2.6.23.14/include/asm/irqflags.h:24: Error: suffix or operands invalid for `push'
linux-2.6.23.14/include/asm/irqflags.h:24: Error: suffix or operands invalid for `popf'
linux-2.6.23.14/include/asm/irqflags.h:24: Error: suffix or operands invalid for `push'
linux-2.6.23.14/include/asm/irqflags.h:24: Error: suffix or operands invalid for `popf'
linux-2.6.23.14/include/asm/cmpxchg.h:91: Error: Incorrect register `%rax' used with `l' suffix
make: *** [linux-2.6.23.14/kernel/sched.o] 오류 

어떻게 풀어야될까요?

danskesb의 이미지

우선 -32m이 아니라 -m32입니다. 리눅스 커널 트리를 컴파일하려고 하는 것 같은데, i386/amd64 어셈블리는 서로 호환되지 않습니다. 커널 설정을 다시 해야 할 것 같습니다.

---- 절취선 ----
http://blog.peremen.name

choboja의 이미지

오타가 있었네요.

일단 gcc -m32 옵션으로 컴파일 되었네요.
i386과 intel x86-64는 호환되지 않나요?

danskesb의 이미지

대부분 호환되나, 레지스터 갯수가 amd64 쪽이 더 많고, 64비트 데이터를 다루는 연산이 추가되었습니다. 증가한 레지스터에 맞춰서 호출 규약도 변경되었습니다.

http://www.milw0rm.com/papers/110 에서 i386/amd64 사이의 차이를 간략하게 설명하고 있습니다.

---- 절취선 ----
http://blog.peremen.name

choboja의 이미지

amd64가 i386을 포함하지 않나요?
그래서 -m32 옵션을 사용하면 amd64에서는 i386으로 작성된 코드를 사용할 수 있는거 아닌가요?
반대의 경우 불가능한 경우도 있겠지만요~

답변 부탁드릴께요.

tj의 이미지

하위호완성이 상당히 높긴 하지만 작동 모드에 따라 그 정도가 다르고, "코드"의 종류에 따라서도 달라요. 질문 범위가 너무 넓어서 그렇기도 하고 그렇지않기도 하다고 밖에 대답할 수가 없내요. 자료는 많으니 우선 좀 읽으시고 질문을 가다듬어 하시는 게 좋을 것 같습니다.

choboja의 이미지


넵! 두분 답변 모두 감사드립니다.^^

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.