我正在尝试链接C++文件和程序集文件.Assembly文件定义了一个名为的C++函数add.我正在使用64位Mac OS.我尝试编译程序时收到以下错误:
Undefined symbols for architecture x86_64:
"_add", referenced from:
_main in main-d71cab.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main.o] Error 1
Run Code Online (Sandbox Code Playgroud)
Makefile文件
hello: main.o hello.o
g++ main.o hello.o -o hello
hello.o: hello.asm
nasm -f macho64 hello.asm -o hello.o
main.o: main.cpp
g++ main.cpp -o main.o
Run Code Online (Sandbox Code Playgroud)
hello.asm
global add
segment .text
add:
mov rax, rdi
add rax, rsi
ret
Run Code Online (Sandbox Code Playgroud)
main.cpp中
#include <iostream> …Run Code Online (Sandbox Code Playgroud) 我有一个Spring Boot项目,无论server.port属性如何,服务器端口总是设置为8080.除server.port之外的所有属性都会被正确覆盖.属性配置bean:
@Bean
public PropertySourcesPlaceholderConfigurer properties() {
final PropertySourcesPlaceholderConfigurer poc = new PropertySourcesPlaceholderConfigurer();
poc.setIgnoreResourceNotFound(true);
poc.setIgnoreUnresolvablePlaceholders(true);
final List<Resource> list = new ArrayList<Resource>();
// default (dev) properties
list.add(new ClassPathResource(PROPERTIES_FILE));
// override with -Dproperties.location=C:/path/to/properties/ where overriding application.properties resides
list.add(new FileSystemResource(System.getProperty(EXTERNAL_ARGUMENT_NAME)+PROPERTIES_FILE));
poc.setLocations(list.toArray(new Resource[]{}));
return poc;
}
Run Code Online (Sandbox Code Playgroud)
这意味着我的classpath application.properties是默认的(dev属性),它被jvm参数-Dproperties.location = C:\ application\config覆盖.
server.port属性未在我的类路径属性文件中定义,因此在开发环境中默认为8080.这很好,但是为了测试我想指定端口.我的外部属性文件包含以下属性:
server.port=10070
Run Code Online (Sandbox Code Playgroud)
日志:
[2016-01-19 11:14:10:010 CET] INFO [restartedMain] support.PropertySourcesPlaceholderConfigurer: Loading properties file from class path resource [application.properties]
[2016-01-19 11:14:10:010 CET] INFO [restartedMain] support.PropertySourcesPlaceholderConfigurer: Loading properties file from file [C:\var\opt\application\config\application.properties]
[2016-01-19 11:14:11:011 CET] INFO …Run Code Online (Sandbox Code Playgroud) 当我使用它们获取地址时,mov和lea之间究竟有什么区别?
假设我有一个程序从第5个字符开始打印出一个字符串,其代码如下所示:
section .text
global _start
_start:
mov edx, 0x06 ;the length of msg from its 5th char to the last is 6.
lea ecx, [msg + 4]
mov ebx, 1
mov eax, 4
int 0x80
section .data
msg db '1234567890'
Run Code Online (Sandbox Code Playgroud)
然后,如果我换lea ecx, [msg + 4]了mov ecx, msg + 4,将它运行不同?
我试过两个,输出看起来是一样的.但是,我从这个链接中读到,LEA指令的目的是什么?,在第一个答案的评论部分,似乎有人声称有类似mov ecx, msg + 4无效的东西,但我没有看到它.有人能帮助我理解这个吗?提前致谢!
我正在编写一个包含我的32位内核的Multiboot兼容的ELF可执行文件.我的主要问题是我在生成可执行文件时收到一系列链接器错误:
重定位被截断以适合:R_386_16对``.text'
链接器脚本,代码和构建脚本如下
我决定尝试在我的操作系统中实现VESA VBE图形.我在OSDev论坛中发现了一个现有的VESA驱动程序,我试图将它集成到我自己的操作系统中.我尝试将它添加到我的源目录,用NASM组装并将其链接到LD的最终可执行文件中.我收到的具体错误是:
vesa.asm:(.text+0x64): relocation truncated to fit: R_386_16 against `.text'
obj/vesa.o: In function `svga_mode':
vesa.asm:(.text+0x9d): relocation truncated to fit: R_386_16 against `.text'
vesa.asm:(.text+0xb5): relocation truncated to fit: R_386_16 against `.text'
obj/vesa.o: In function `done':
vesa.asm:(.text+0xc7): relocation truncated to fit: R_386_16 against `.text'
Run Code Online (Sandbox Code Playgroud)
导致错误的行(按顺序)如下:
mov ax,[vid_mode]
mov cx,[vid_mode]
mov bx,[vid_mode]
jmp 0x8:pm1
Run Code Online (Sandbox Code Playgroud)
我还评论了"链接器错误"的行
这是文件(vesa.asm):
BITS 32
global do_vbe
save_idt: dd 0
dw 0
save_esp: dd 0
vid_mode: dw 0
do_vbe: …Run Code Online (Sandbox Code Playgroud) 我意识到有人提出并关闭了一个非常相似的问题,因为它不够具体,也没有说明结果。 关闭的话题
问题:从 REST 控制器返回的 JSON 为空。经过验证的数据存在并且在 Iterable 中。
预期结果:将返回一个包含对象的 JSON 数组。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.codeexcursion</groupId>
<organization>
<name>Chris Lynch</name>
</organization>
<version>1.00.000</version>
<artifactId>work-tracking</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<name>Work Tracking</name>
<inceptionYear>2017</inceptionYear>
<developers>
<developer>
<id />
<name>Chris Lynch</name>
<email>chrislynch42@yahoo.com</email>
<timezone>-4</timezone>
<roles>
<role>Chief cook and bottle washer.</role>
</roles>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.10.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>1.5.10.RELEASE</version> …Run Code Online (Sandbox Code Playgroud) 有没有人将Spring boot 2.0.1(带启动器)生成的战争部署到Jboss EAP 6.4?
我试着做一些调整,但没有成功.
有没有在这里发光?
谢谢!
我在16位x86汇编中编写自己的操作系统,我正在尝试注册自己的中断,如MS-DOS中的INT 21H.我在网上找不到任何东西.我正在使用NASM作为汇编程序.
我正在尝试制作一个简单的x86汇编程序(我使用NASM作为我的汇编程序),它使用ANSI代码将终端文本颜色更改为红色,然后打印一些将用红色前景打印的内容.代码如下:
; This macro is equivalent to printf(message)
%macro print 1
lea rdi, [rel %1]
call _printf
%endmacro
; Example call:
; print prompt
; Where prompt is something like:
; prompt:
; db "Hiya dude! What's your name?", 0
; These are the terminal colors, they are ANSI codes that, when printed, will change the color of the text.
section .data
COLOR_FORE_RED:
db "\033[31m",0 ; ANSI Fore Red code
%define SetColor_FRed print COLOR_FORE_RED
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用以下内容时使用这些宏:
SetColorFRed ; Set text color …Run Code Online (Sandbox Code Playgroud) 好吧,我已经在程序集中编写了一个引导加载程序,并尝试从中加载C内核。
这是引导程序:
bits 16
xor ax,ax
jmp 0x0000:boot
extern kernel_main
global boot
boot:
mov ah, 0x02 ; load second stage to memory
mov al, 1 ; numbers of sectors to read into memory
mov dl, 0x80 ; sector read from fixed/usb disk ;0 for floppy; 0x80 for hd
mov ch, 0 ; cylinder number
mov dh, 0 ; head number
mov cl, 2 ; sector number
mov bx, 0x8000 ; load into es:bx segment :offset of buffer
int 0x13 ; …Run Code Online (Sandbox Code Playgroud) 我有一个 Spring Boot 应用程序,当我们使用 kill pid 终止进程时,它需要清除或清理资源。@predestroy 带注释的方法不起作用,也没有被调用。请建议我们如何捕获 SIGTERM 并调用 predestroy 方法